Aller au contenu

Photo

Maintained Blood Control


  • Veuillez vous connecter pour répondre
1 réponse à ce sujet

#1
Kesaru

Kesaru
  • Members
  • 130 messages
I'm trying to change Blood Control so that it's a maintain that makes the target an ally until you de-toggle it, much like Animate Dead or probably any other summon. I'd also like to gain control over the target's actions like with a summon but that's another issue.

I tried just changing it to a maintain in ABI_base, and obviously that didn't work. I looked through the lines inside Spell_modal.nss and realized the ability's script has to be inside that for it to work as a real maintain that can be toggled on and off. So I took the code out of Spell_singletarget.nss and put it inside of Spell_modal.nss.
I then found this line; "EFFECT_DURATION_TYPE_TEMPORARY", and changed it to "EFFECT_DURATION_TYPE_PERMANENT", since that seemed necessary to make it last as long as it was maintained rather than just the regular 20 seconds.
I know about the issue with the damage being applied while the ability is active rather than when it fails, and could see exactly what was causing it; the damage lines were positioned to always occur, rather than only if the mental check succeeded, so I tried to move that.
But that created this error message when exporting;
"E: 16:58:53 - spell_modal.nss - spell_modal.nss(134): Unknown state in compiler", so I just scrapped that section entirely since it was unnecessary.

Now here's the real problem. After doing all of that, I get this new message when exporting;
"E: 17:11:23 - spell_modal.nss - spell_modal.nss(128): Variable defined without type (while compiling var_constants_h.nss)"
The line it's referring to is this; "eEffect = EffectCharm(stEvent.oCaster, stEvent.oTarget);"
When I try it out in-game, the spell appears to succeed (no failure message), and the ability toggles on, but it has no effect on the target. That botched line appears to be the crux of the whole spell where it applies the charm effect, so that's clearly the issue. But I have absolutely no idea how to fix it.
Can anyone help?

Here's what the whole section looks like;
case ABILITY_SPELL_BLOOD_CONTROL:
        {
            // if creature has blood
            int nAppearanceType = GetAppearanceType(stEvent.oTarget);
            if (GetM2DAInt(TABLE_APPEARANCE, "bCanBleed", nAppearanceType) == TRUE)
            {
                // remove stacking effects
                RemoveStackingEffects(stEvent.oTarget, stEvent.oCaster, stEvent.nAbility);

                // does not work on PCs
                if (IsPartyMember(stEvent.oTarget) == FALSE)
                {
                    // creatures with conversations are not charmed
                    // this is to prevent creatures that talk then turn hostile from talking again
                    if (HasConversation(stEvent.oTarget) == FALSE)
                    {
                        // mental resistance
                        if (ResistanceCheck(stEvent.oCaster, stEvent.oTarget, PROPERTY_ATTRIBUTE_SPELLPOWER, RESISTANCE_MENTAL) == FALSE)
                        {
                            float fDuration = GetRankAdjustedEffectDuration(stEvent.oTarget, BLOOD_CONTROL_DURATION);

                            eEffect = EffectCharm(stEvent.oCaster, stEvent.oTarget);
                            eEffect = SetEffectEngineInteger(eEffect, EFFECT_INTEGER_VFX, Ability_GetImpactObjectVfxId(stEvent.nAbility));
                            ApplyEffectOnObject(EFFECT_DURATION_TYPE_PERMANENT, eEffect, stEvent.oTarget, fDuration, stEvent.oCaster, stEvent.nAbility);
                        }   
                    }
                }
            } else
            {
                UI_DisplayMessage(stEvent.oTarget, UI_MESSAGE_IMMUNE);
            }
            bHostile = TRUE;

            break;
        }

Modifié par Kesaru, 03 mars 2010 - 10:54 .


#2
Kesaru

Kesaru
  • Members
  • 130 messages
Lots and lots of problems...
I changed the section to look like this and got it to save properly and work;
        case ABILITY_SPELL_BLOOD_CONTROL:
        {
            // if creature has blood
            int nAppearanceType = GetAppearanceType(stEvent.oTarget);
            if (GetM2DAInt(TABLE_APPEARANCE, "bCanBleed", nAppearanceType) == TRUE)
            {
                // remove stacking effects
                RemoveStackingEffects(stEvent.oTarget, stEvent.oCaster, stEvent.nAbility);

                // does not work on PCs
                if (IsPartyMember(stEvent.oTarget) == FALSE)
                {
                    // creatures with conversations are not charmed
                    // this is to prevent creatures that talk then turn hostile from talking again
                    if (HasConversation(stEvent.oTarget) == FALSE)
                    {
                        // mental resistance
                        if (ResistanceCheck(stEvent.oCaster, stEvent.oTarget, PROPERTY_ATTRIBUTE_SPELLPOWER, RESISTANCE_MENTAL) == FALSE)
                        {
                            float fDuration = GetRankAdjustedEffectDuration(stEvent.oTarget, BLOOD_CONTROL_DURATION);

                            eEffects[0] = EffectCharm(stEvent.oCaster, stEvent.oTarget);
                            eEffects[0] = SetEffectEngineInteger(eEffects[0], EFFECT_INTEGER_VFX, Ability_GetImpactObjectVfxId(stEvent.nAbility));
                            ApplyEffectOnObject(EFFECT_DURATION_TYPE_PERMANENT, eEffects[0], stEvent.oTarget, fDuration, stEvent.oCaster, stEvent.nAbility);
                        }
                    }
                }
            } else
            {
                UI_DisplayMessage(stEvent.oTarget, UI_MESSAGE_IMMUNE);
            }
            bHostile = TRUE;

            break;
        }

As well as adding this to the start of the script;
    // effects
    effect[] eEffects;
    int bPartywide = FALSE;
    int bEffectValid = TRUE;
    int bHostile = FALSE;

Here's the problem now. It works at first, but for some reason I lose direct control of my own character while it's active (at first he stood still completely, but several seconds after switching characters he started running tactics).
Not only that, but after I deactivated the ability, I was unable to activate it again.
-Edit- Okay, I figured out why it's causing me to lose control of my character; for some reason it's applying the charm effect to both myself and my target (and since my character is charmed by himself, it basically just forces him to run off tactics without me being able to control him directly).
I still don't understand why I can only use it once, though. I tried removing the whole int bHostile = FALSE; thing and using using int bEffectValid = TRUE; like other modal abilities, but it seemed to do nothing at all.

Modifié par Kesaru, 04 mars 2010 - 08:48 .