I’m at a total loss here. This script does things but ingame nothing is happening. Why? Can anyone help? When the PC is entering this area, a lot of enemies that are at first set as “Commoner” are turned into hostiles. I’ve done a few “SendMessageToPC” to see if things run, and I get a lot of messages, so it seems that the script runs, but none of the NPCs turn into enemies. Not a single one. Why? Please help. I can see nothing wrong, but apparently it’s not working at all.
#include "nw_i0_generic"
#include "ginc_object"
void Death(string sTagString, int iInstance = 0)
{
PrettyDebug("Applying Death Effect To: " + sTagString + " Instance = " + IntToString(iInstance));
object oObject = GetObjectByTag(sTagString, iInstance);
AssignCommand(oObject, SetIsDestroyable( FALSE,FALSE,TRUE ));
SetImmortal( oObject, FALSE );
SetPlotFlag( oObject, FALSE );
effect eFX = EffectDeath();
PrettyDebug("Name of oObject = " + GetName(oObject));
ApplyEffectToObject( DURATION_TYPE_INSTANT,eFX,oObject );
}
void PlayCustomAnimationVoid(object oObject, string sAnimation, int iLoop = 0, float fSpeed = 1.f)
{
PlayCustomAnimation(oObject, sAnimation, iLoop, fSpeed);
}
void main()
{
object oPC = GetEnteringObject();
if(!GetIsPC(oPC)) return;
if(GetLocalInt(OBJECT_SELF,"Done")) return;
SetLocalInt(OBJECT_SELF,"Done",1);
object oHeadmage = GetNearestObjectByTag("teacher2");
int nENEMYSkeleton = 1;
int nENEMYOrc = 1;
int nENEMYWarrior = 1;
int nENEMYGoblin = 1;
while (nENEMYGoblin <= 4)
{
object oGoblin = GetNearestObjectByTag("l_goblin" + IntToString(nENEMYGoblin));
SendMessageToPC(oPC,"Found a goblin");
ChangeToStandardFaction(oGoblin, STANDARD_FACTION_HOSTILE);
SetIsTemporaryEnemy(oPC, oGoblin);
AssignCommand(oGoblin, ActionAttack(oPC));
AssignCommand(oGoblin, DetermineCombatRound(oPC));
nENEMYGoblin = nENEMYGoblin + 1;
}
object oSkeletonBlackguard = GetNearestObjectByTag("c_skeleton7");
ChangeToStandardFaction(oSkeletonBlackguard, STANDARD_FACTION_HOSTILE);
SetIsTemporaryEnemy(oPC, oSkeletonBlackguard);
AssignCommand(oSkeletonBlackguard, ActionAttack(oPC));
AssignCommand(oSkeletonBlackguard, DetermineCombatRound(oPC));
while (nENEMYWarrior <= 4)
{
object oWarrior = GetNearestObjectByTag("villian" + IntToString(nENEMYWarrior));
SendMessageToPC(oPC,"Found a warrior");
ChangeToStandardFaction(oWarrior, STANDARD_FACTION_HOSTILE);
SetIsTemporaryEnemy(oPC, oWarrior);
AssignCommand(oWarrior, ActionAttack(oPC));
AssignCommand(oWarrior, DetermineCombatRound(oPC));
nENEMYWarrior = nENEMYWarrior + 1;
}
while (nENEMYOrc <= 8)
{
object oOrc = GetNearestObjectByTag("l_orc" + IntToString(nENEMYOrc));
SendMessageToPC(oPC,"Found an orc");
ChangeToStandardFaction(oOrc, STANDARD_FACTION_HOSTILE);
SetIsTemporaryEnemy(oPC, oOrc);
AssignCommand(oOrc, ActionAttack(oPC));
AssignCommand(oOrc, DetermineCombatRound(oPC));
nENEMYOrc = nENEMYOrc + 1;
}
while (nENEMYSkeleton <= 4)
{
object oSkeleton = GetNearestObjectByTag("l_skeletonwarrior" + IntToString(nENEMYSkeleton));
SendMessageToPC(oPC,"Found a skeleton");
ChangeToStandardFaction(oSkeleton, STANDARD_FACTION_HOSTILE);
SendMessageToPC(oPC,"Skeleton now hostile");
SetIsTemporaryEnemy(oPC, oSkeleton);
AssignCommand(oSkeleton, ActionAttack(oPC));
AssignCommand(oSkeleton, DetermineCombatRound(oPC));
nENEMYSkeleton = nENEMYSkeleton + 1;
}
Death("agatha2");
Death("befden2");
PlayCustomAnimationVoid(oHeadmage,"*proneB",1);
}