mirror of
https://github.com/SWG-Source/dsrc.git
synced 2026-08-02 02:15:48 -04:00
47 lines
1.2 KiB
Plaintext
47 lines
1.2 KiB
Plaintext
include library.ai_lib;
|
|
include library.create;
|
|
include library.utils;
|
|
include ai.ai_combat;
|
|
|
|
trigger OnAttach()
|
|
{
|
|
messageTo(self, "startAttack", null, 1, false);
|
|
messageTo(self, "cleanUp", null, 7200, false);
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
trigger OnHearSpeech(obj_id objSpeaker, string strText)
|
|
{
|
|
obj_id coordinator = getObjIdObjVar(self, "event.invasion.coordinator");
|
|
obj_id target = getObjIdObjVar(self, "event.invasion.target");
|
|
|
|
if(objSpeaker == coordinator && strText.equals("abortEventNow"))
|
|
{
|
|
messageTo(target, "cleanUp", null, 1, false);
|
|
messageTo(self, "cleanUp", null, 1, false);
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
messageHandler startAttack()
|
|
{
|
|
obj_id target = getObjIdObjVar(self, "event.invasion.target");
|
|
obj_id coordinator = getObjIdObjVar(self, "event.invasion.coordinator");
|
|
|
|
float destinationOffset = getFloatObjVar(target, "event.invasion.spawning.destinationOffset");
|
|
|
|
location locationDestination = getLocation(target);
|
|
location adjustedLoc = utils.getRandomLocationInRing(locationDestination, destinationOffset, destinationOffset + 10);
|
|
|
|
ai_lib.aiPathTo(self, adjustedLoc);
|
|
setMovementRun(self);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
messageHandler cleanUp()
|
|
{
|
|
destroyObject(self);
|
|
return SCRIPT_CONTINUE;
|
|
} |