The two scripts below are intended to enable a PC to polymorph into a Dog, Rat or Raven and spy on Hostile npcs whose faction is temporarily rendered friendly to this PC.
This is achieved by the use of a "reference creature" of the hostile faction placed in a DM-only area.
Unfortunately, although I have created a custom skin which is applied to the polymorphed PC via polymorph.2da (as suggested by Barag), the OnUnacquire Item script I have written does NOT reset the hostile faction back to hating the PC on either the cancellation of the polymorph or on the end of the spell's duration.
I would be very grateful if someone could tell me if I have done something wrong!
The Spell Script:
//::///////////////////////////////////////////////
//:: Lesser Shapechange
//:: pt_polyself1.nss
//:: Copyright © 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*
The PC is able to change their form to one of
the following: Dog, Brown Rat or Raven.
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 == 1933)
{
nPoly = 98;
}
else if (nSpell == 1934)
{
nPoly = 99;
}
else if (nSpell == 1935)
{
nPoly = 100;
}
ePoly = EffectPolymorph(nPoly);
//Fire cast spell at event for the specified target
SignalEvent(oTarget, EventSpellCastAt(OBJECT_SELF, 1931, 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("factionplaceholderhostile"),100);
}
And now the OnUnacquire script:
#include "habd_include"
void main()
{
// Support for Lesser Shapechange Spell & Item
object oLost = GetModuleItemLost();
if (GetTag(oLost)== "pt_it_emptyskin")
{
object oTarget = GetModuleItemLostBy();
AdjustReputation(oTarget,GetObjectByTag("factionplaceholderhostile"),0);
}
// HABD support
if (HABDOnUnAcquiredItem(GetModuleItemLostBy(), GetModuleItemLost()))
{
return;
}
}
My thanks for any input, folks.