here is a sample code how to cancel delayed action/function for specific target
Example presumes there are two triggers, when PC enters trigger A he have to get to the trigger B within 60seconds otherwise guards will find him and send to jail
code for trigger A:
void DoSomething(object oPC)
{
if(GetLocalInt(OBJECT_SELF,"DoSomething_"+ObjectToString(oPC)))
{
//cancel the teleport, PC made it in time
return;
}
//actual code to do something, like teleport to prison
AssignCommand(oPC, ClearAllActions());
AssignCommand(oPC, ActionJumpToObject(GetObjectByTag("JAIL")));
}
void main()
{
object oPC = GetEnteringObject();
DelayCommand(60.0, DoSomething(oPC));
}
code for trigger B
void main()
{
object oPC = GetEnteringObject();
object triggerA = GetObjectByTag("TRIGGER_A");
//cancel delay on trigger A from trigger B
SetLocalInt(triggerA,"DoSomething_"+ObjectToString(oPC),-1);
}
Modifié par ShaDoOoW, 15 novembre 2011 - 01:44 .