Skip to content

Any function to Remove All Negative Effects on the PC?

Is there a function or whatever you call them to remove all negative effects on the PC in one shot WITHOUT healing them?

Comments

  • Ugly_DuckUgly_Duck Member Posts: 182
    Also, how do you update items in the game that are in the possession of players? A couple examples of what I'm talking about:

    1.) I had a necklace on a vendor that I changes some properties on. But, the ones bought by the players before the update were unchanged. I wanted the purchased items to update too.

    2.) I am giving out a book item that has all the credits for people that helped me when the player logs in for the first time. I added more credits to the book's description in the toolset, but they didn't update the ones already in the players possession. Same thing as #1, just a different item.
  • TerrorbleTerrorble Member Posts: 179
    edited March 2022
    1. Function to remove all negative effects:
        effect eBad = GetFirstEffect(oTarget);
        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_CURSE ||
                GetEffectType(eBad) == EFFECT_TYPE_DISEASE ||
                GetEffectType(eBad) == EFFECT_TYPE_POISON ||
                GetEffectType(eBad) == EFFECT_TYPE_PARALYZE ||
                GetEffectType(eBad) == EFFECT_TYPE_CHARMED ||
                GetEffectType(eBad) == EFFECT_TYPE_DOMINATED ||
                GetEffectType(eBad) == EFFECT_TYPE_DAZED ||
                GetEffectType(eBad) == EFFECT_TYPE_CONFUSED ||
                GetEffectType(eBad) == EFFECT_TYPE_FRIGHTENED ||
                GetEffectType(eBad) == EFFECT_TYPE_NEGATIVELEVEL ||
                GetEffectType(eBad) == EFFECT_TYPE_PARALYZE ||
                GetEffectType(eBad) == EFFECT_TYPE_SLOW ||
                GetEffectType(eBad) == EFFECT_TYPE_STUNNED )
            {
                RemoveEffect(oTarget, eBad);
            }
            eBad = GetNextEffect(oTarget);
        }
    
    Credit to whomever mentioned the script for greater restoration (nw_s0_grrestore). This is the loop within that script that scans thru all the effects on the target and removes them if they are in the list. I think a lot of rest scripts do a similar thing but just remove any effect where GetEffectDurationType(eEffect) == DURATION_TYPE_TEMPORARY. But that will also removes beneficial stuff.

    2. Updating items players already have:
    Right, so updating the blueprint doesn't change what players already have.
    You could check somewhere (e.g. OnModuleEnter) if they have the thing, destroy it and give them another one.
     object oPC = GetEnteringObject();   
     object oExchange;
    
        oExchange = GetItemPossessedBy(oPC,"OLD_ITEM_TAG");
    
        if( oExchange != OBJECT_INVALID )
        {
            //In the toolset, you should give the new versions a new TAG.
            //Otherwise, this script destroys it regardless everytime they join.
                CreateItemOnObject(GetResRef(oExchange),oPC);
            
            DestroyObject(oExchange);
        }
    
        //Repeat the process for the other item.
        oExchange = GetItemPossessedBy(oPC,"OLD_CREDIT_BOOK_TAG");
    
        if( oExchange != OBJECT_INVALID )
        {
            CreateItemOnObject(GetResRef(oExchange),oPC);
            DestroyObject(oExchange);
        }
    
  • ProlericProleric Member Posts: 1,316
    Players can put items in chests, of course, or drop them, or sell them, so the safest method is to cycle through all item instances using GetObjectByTag, applying the change.
  • MelkiorMelkior Member Posts: 204
    You should be able to copy just the "remove negative effects" part from "nw_d1_templeheal" to do this. Just remove the part which does the healing.
Sign In or Register to comment.