Is it possible that smarter folks than me could look at this problem, please?
I want to use a custom polymorph script to enable PCs to shapechange into a chosen animal form through the use of an item so that they can spy on bad guys without using Concealment or Invisibility.
So far, so good. It all works fine and dandy.
However, I DO NOT want the PC in animal form to be attacked by hostile factions.
Therefore I have created a non-plot placeholder hostile NPC (tagged CustomFactionHolderHostile) in a DM-only area as advised by Script Lexicon :-
"One method of maximizing the versatility of the AdjustReputation function in conjunction with custom factions is to create an inaccesible area devoted to holding custom faction holders. Let's say your custom faction is titled "CLO" . You would give a creature the tag "CustomFactionHolderCLO", set "CLO" as the faction on the creature and place it in the custom faction holder bed. Keep it isolated from all other custom faction holders. Do not check the "plot" flag on your creature (or this won't work). You are using a creature rather than a placeable because AdjustReputation does not work with placeables. Now, for example, if you want the entire custom faction to turn hostile against your PC, you would script:
AdjustReputation(PC, GetObjectByTag("CustomFactionHolderCLO"), -100)
You can even create a custom faction holder for a standard faction so that you can easily use AdjustReputation with that standard faction."
The problem comes when compiling the following script:
//::///////////////////////////////////////////////
//:: 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);
}
The script does not compile, citing a "Unknown State In Compiler" error on the last line.
I would be very grateful if someone a lot more clever than me could explain what I have done wrong!