Skip to content

Creating a true heal effect

So I'm recreating an old mechanic from Rogue where when the player can pick up potions but not know what effects they will have until they've drunk them. I have my own list of effects and so far I've managed to make them work. I've been able to polymorph the drinker, blind them, and create a bunch of useless visual effects so far.

What I'm struggling with is the effect of the Heal spell. Simply put: one of the possible random effects I want to have happen is the effect of the Heal spell. Fully heal the target and remove all debuffs. I haven't been able to figure out how to do this. I can dispel stuff but I can't make it target debuffs. And I can heal the target using EffectHeal but I need to indicate an amount of heal (which isn't terrible but seems unnecessary).

How would I accomplish this?

Comments

  • meaglynmeaglyn Member Posts: 146
    That's how the spell does it.
    	//Figure out how much to heal
            nHeal = GetMaxHitPoints(oTarget);
            //Set the heal effect
            eHeal = EffectHeal(nHeal);
    
  • Dragonfolk2000Dragonfolk2000 Member Posts: 377
    meaglyn wrote: »
    That's how the spell does it.
    	//Figure out how much to heal
            nHeal = GetMaxHitPoints(oTarget);
            //Set the heal effect
            eHeal = EffectHeal(nHeal);
    

    That doesn't do it. Yeah, it'll heal the hit points but it won't remove things like disease, poison, or other negative status effects.
  • ForSeriousForSerious Member Posts: 446
    You're looking for greater restoration: NW_S0_GrRestore.
    Just copy what's in that script.
  • Dragonfolk2000Dragonfolk2000 Member Posts: 377
    ForSerious wrote: »
    You're looking for greater restoration: NW_S0_GrRestore.
    Just copy what's in that script.

    What I was hoping for was that there would already be a thing that wouldn't have to require me to go through every negative effect in the game. It appears I'll need to do that if I want this though. Something like a full heal function that just does it instead of me listing everything bad that can possibly happen.
  • TarotRedhandTarotRedhand Member Posts: 1,481
    Here's the code for that from the Neverwinter Nights Newbie FAQ #2 (see Just The FAQs, ma'am) -
        effect eBad = GetFirstEffect(oPlayer);
        
        //Search for negative effects
    
        while(GetIsEffectValid(eBad))
        {
            if (GetEffectType(eBad) == EFFECT_TYPE_ABILITY_DECREASE ||
            GetEffectType(eBad) == EFFECT_TYPE_AC_DECREASE ||
            GetEffectType(eBad) == EFFECT_TYPE_ATTACK_DECREASE ||
            GetEffectType(eBad) == EFFECT_TYPE_DAMAGE_DECREASE ||
            GetEffectType(eBad) == EFFECT_TYPE_DAMAGE_IMMUNITY_DECREASE ||
            GetEffectType(eBad) == EFFECT_TYPE_SAVING_THROW_DECREASE ||
            GetEffectType(eBad) == EFFECT_TYPE_SPELL_RESISTANCE_DECREASE ||
            GetEffectType(eBad) == EFFECT_TYPE_SKILL_DECREASE ||
            GetEffectType(eBad) == EFFECT_TYPE_BLINDNESS ||
            GetEffectType(eBad) == EFFECT_TYPE_DEAF ||
            GetEffectType(eBad) == EFFECT_TYPE_PARALYZE ||
            GetEffectType(eBad) == EFFECT_TYPE_NEGATIVELEVEL)
            {
                //Remove effect if it is negative.
    
                RemoveEffect(oPlayer, eBad);
            }
            eBad = GetNextEffect(oPlayer);
        }
    

    and combine it with the other code you've already been given (copy and paste it).

    TR
  • meaglynmeaglyn Member Posts: 146
    meaglyn wrote: »
    That's how the spell does it.
    	//Figure out how much to heal
            nHeal = GetMaxHitPoints(oTarget);
            //Set the heal effect
            eHeal = EffectHeal(nHeal);
    

    That doesn't do it. Yeah, it'll heal the hit points but it won't remove things like disease, poison, or other negative status effects.

    Sorry, you said heal spell... Yeah, restoration and friends go through the effects and remove the bad ones. Not sure why that's a problem. That's sort of what scripting is for. You get some basic building blocks and can then assemble whatever you want.
  • Dragonfolk2000Dragonfolk2000 Member Posts: 377
    Here's the code for that from the Neverwinter Nights Newbie FAQ #2 (see Just The FAQs, ma'am) -
        effect eBad = GetFirstEffect(oPlayer);
        
        //Search for negative effects
    
        while(GetIsEffectValid(eBad))
        {
            if (GetEffectType(eBad) == EFFECT_TYPE_ABILITY_DECREASE ||
            GetEffectType(eBad) == EFFECT_TYPE_AC_DECREASE ||
            GetEffectType(eBad) == EFFECT_TYPE_ATTACK_DECREASE ||
            GetEffectType(eBad) == EFFECT_TYPE_DAMAGE_DECREASE ||
            GetEffectType(eBad) == EFFECT_TYPE_DAMAGE_IMMUNITY_DECREASE ||
            GetEffectType(eBad) == EFFECT_TYPE_SAVING_THROW_DECREASE ||
            GetEffectType(eBad) == EFFECT_TYPE_SPELL_RESISTANCE_DECREASE ||
            GetEffectType(eBad) == EFFECT_TYPE_SKILL_DECREASE ||
            GetEffectType(eBad) == EFFECT_TYPE_BLINDNESS ||
            GetEffectType(eBad) == EFFECT_TYPE_DEAF ||
            GetEffectType(eBad) == EFFECT_TYPE_PARALYZE ||
            GetEffectType(eBad) == EFFECT_TYPE_NEGATIVELEVEL)
            {
                //Remove effect if it is negative.
    
                RemoveEffect(oPlayer, eBad);
            }
            eBad = GetNextEffect(oPlayer);
        }
    

    and combine it with the other code you've already been given (copy and paste it).

    TR

    I think this will do it. I can combine this with the aforementioned healing effect to make this work. Against my better judgement I won't be tested each and every one of these.
  • MelkiorMelkior Member Posts: 179
    Open any module and edit any script. Go to open a new script and select All and open "nw_d1_templeheal". It should do exactly what you want, or at least be easy to modify to do what you want.
Sign In or Register to comment.