I've been putting the script on triggers and door and setting the local variables in the variables proporty tab of the door or trigger. I can't determine any pattern to when it does or does not work.
//reaction
/*
This script handles the reaction of a specific character when an area or trigger
is entered or a door opened. The tigger area or door should have local variables
to determine the reaction of the character when the script is run.
Variables:
sCreatureTag - the tag of the creature or object to react
sSpeakString - the line for the reacting character to speak, leave blank if no
line should be spoken.
iGoHostile - set as 1 to make the creature go hostile, 2 to also issue an attack
command.
*/
//Shaun H. 2/12/11
#include "nw_i0_generic"
void main()
{
//Check to make sure script's activator is the PC
object oPC = GetEnteringObject();
if (!GetIsPC(oPC)) return;
//Run only once
int DoOnce = GetLocalInt(OBJECT_SELF,"DoOnce");
if(DoOnce == TRUE) return;
SetLocalInt(OBJECT_SELF,"DoOnce",TRUE);
//Get Target 1
object oTarget = GetObjectByTag(GetLocalString(OBJECT_SELF,"sCreatureTag"));
//Speak string
string sLine = GetLocalString(OBJECT_SELF,"sSpeakString");
if(StringCompare(sLine,"") != 0) SpeakString(sLine);
//Faction change
int iFaction = GetLocalInt(OBJECT_SELF,"iGoHostile");
if(iFaction > 0) ChangeFaction(oTarget,GetObjectByTag("Hostile"));
if(iFaction == 2)
{
AssignCommand(oTarget, ActionAttack(oPC));
AssignCommand(oTarget, DetermineCombatRound(oPC));
}
}





Retour en haut






