Author Topic: How to reset Reputation after a spell ends? Help, please?  (Read 366 times)

Legacy_Monsieur T

  • Jr. Member
  • **
  • Posts: 62
  • Karma: +0/-0
How to reset Reputation after a spell ends? Help, please?
« on: October 03, 2010, 07:26:57 pm »


               The script below enables a PC to turn into an animal for 10 minutes or until the polymorph is cancelled.
Thanks to Baragg, it now works nicely and makes the Hostile faction ignore the polymorphed PC.
This allows the PC to spy on bad guys while in animal form.
However I was stupid and did not realize that once the spell ends, the Hostiles STILL like the PC!!!
Does anyone know of a way that I can set the Hostile faction back to hating the PC (especially if the spell ends and reveals his true form when hostiles are close by)?
Any help would be greatly appreciated, thanks.


//::///////////////////////////////////////////////
//:: Lesser Shapechange
//:: pt_polyself2.nss
//:: Copyright © 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*
    The PC is able to change their form to one of
    the following: Wolf, Brown Bear or Winter Wolf.
    The effect lasts for 10 minutes or until
    cancelled or negated.
*/
//:://////////////////////////////////////////////
//:: Created By: Preston Watamaniuk
//:: Created On: Jan 21, 2002
//:://////////////////////////////////////////////
#include "x2_inc_spellhook"
void main()
{
/*
  Spellcast Hook Code
  Added 2003-06-23 by GeorgZ
  If you want to make changes to all spells,
  check x2_inc_spellhook.nss to find out more
*/
    if (!X2PreSpellCastCode())
    {
    // If code within the PreSpellCastHook (i.e. UMD) reports FALSE, do not run this spell
        return;
    }
// End of Spell Cast Hook

    //Declare major variables
    int nSpell = GetSpellId();
    object oTarget = GetSpellTargetObject();
    effect eVis = EffectVisualEffect(VFX_IMP_POLYMORPH);
    effect ePoly;
    int nPoly;
    int nDuration = 10;
    //Determine Polymorph subradial type
    if(nSpell == 1936)
    {
        nPoly = 96;
    }
    else if (nSpell == 1937)
    {
        nPoly = 97;
    }
    else if (nSpell == 1938)
    {
        nPoly = 102;
    }
    ePoly = EffectPolymorph(nPoly);
    //Fire cast spell at event for the specified target
    SignalEvent(oTarget, EventSpellCastAt(OBJECT_SELF, 1932, FALSE));
    //Apply the VFX impact and effects
    AssignCommand(oTarget, ClearAllActions()); // prevents an exploit
    ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oTarget);
    ApplyEffectToObject(DURATION_TYPE_TEMPORARY, ePoly, oTarget, TurnsToSeconds(nDuration));
    AdjustReputation(oTarget, GetObjectByTag("CustomFactionHolderHostile"), 100);
}
               
               

               
            

Legacy_GhostOfGod

  • Hero Member
  • *****
  • Posts: 1490
  • Karma: +0/-0
How to reset Reputation after a spell ends? Help, please?
« Reply #1 on: October 04, 2010, 03:43:10 am »


               A couple different ways to do this maybe.

One would be to add a delayed line to the bottom of this script to change the reputation back. However that would only work for a locked version of the polymorph. If the player can cancel the effect then the hostiles will still be nice until the delay changes the reputation back.

Another way might be to use the bad guys' OnPerception script. Make it so that if the object they last perceived doesn't have a certain appearance type..then set the reputation back.

All I can think of off the top of my head.
               
               

               


                     Modifié par GhostOfGod, 04 octobre 2010 - 02:43 .
                     
                  


            

Legacy__Knightmare_

  • Full Member
  • ***
  • Posts: 191
  • Karma: +0/-0
How to reset Reputation after a spell ends? Help, please?
« Reply #2 on: October 04, 2010, 01:03:23 pm »


               What about firing off a pseudo-heartbeat type script that checks to see if the player is still in animal form? If they still are do nothing (except re-execute the psuedo-hb), if they are not then change reputation back to hostile.
               
               

               
            

Legacy_Baragg

  • Sr. Member
  • ****
  • Posts: 496
  • Karma: +0/-0
How to reset Reputation after a spell ends? Help, please?
« Reply #3 on: October 04, 2010, 04:00:54 pm »


               When they are polyed do they receive a skin for the ploy type? If so you can put a bit of code on the playerunacquire module level script to reset the settings on unacquiring those skins.

IE:
Player cancels poly or poly ends ---> Player loses poly skin ---> Module level Unacquire script resets settings
               
               

               


                     Modifié par Baragg, 04 octobre 2010 - 03:01 .
                     
                  


            

Legacy_Monsieur T

  • Jr. Member
  • **
  • Posts: 62
  • Karma: +0/-0
How to reset Reputation after a spell ends? Help, please?
« Reply #4 on: October 05, 2010, 03:14:20 am »


               Thank you for your help, folks.

Baragg, you are a genius! I would never have thought of your idea in a million years!

Thanks again.