mirror of
https://github.com/SWG-Source/dsrc.git
synced 2026-08-03 03:15:55 -04:00
97 lines
1.8 KiB
Plaintext
97 lines
1.8 KiB
Plaintext
include ai.ai_combat;
|
|
include library.utils;
|
|
include library.ai_lib;
|
|
|
|
trigger OnAttach()
|
|
{
|
|
messageTo(self, "checkForNewTargets", null, 6, false);
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
|
|
trigger OnIncapacitated(obj_id killer)
|
|
{
|
|
obj_id mom = getObjIdObjVar(self, "ep3demo.mom");
|
|
|
|
if(utils.hasScriptVar(self, "ep3demo.victim") )
|
|
{
|
|
messageTo(mom, "spawnAnotherVictim", null, 1, false);
|
|
messageTo(self, "destroyYourself", null, 5, false);
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
if(utils.hasScriptVar(self, "ep3demo.aggressor") )
|
|
{
|
|
messageTo(mom, "spawnAnotherAggressor", null, 1, false);
|
|
messageTo(self, "destroyYourself", null, 5, false);
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
trigger OnHearSpeech(obj_id objSpeaker, string strText)
|
|
{
|
|
|
|
if(!isGod(objSpeaker))
|
|
{
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
if(toLower(strText).startsWith("stop battle"))
|
|
{
|
|
destroyObject(self);
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
messageHandler checkForNewTargets()
|
|
{
|
|
if(!ai_lib.isInCombat(self) )
|
|
{
|
|
lookForSomeoneToKill(self);
|
|
}
|
|
|
|
messageTo(self, "checkForNewTargets", null, 6, false);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
messageHandler destroyYourself()
|
|
{
|
|
destroyObject(self);
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
void lookForSomeoneToKill(obj_id self)
|
|
{
|
|
location here = getLocation(self);
|
|
obj_id[] objects = getObjectsInRange(here, 32);
|
|
|
|
for(int i = 0; i < objects.length; i++)
|
|
{
|
|
if(utils.hasScriptVar(self, "ep3demo.aggressor") )
|
|
{
|
|
if(utils.hasScriptVar(objects[i], "ep3demo.victim") )
|
|
{
|
|
startCombat(self, objects[i]);
|
|
return;
|
|
}
|
|
}
|
|
|
|
if(utils.hasScriptVar(self, "ep3demo.victim") )
|
|
{
|
|
if(utils.hasScriptVar(objects[i], "ep3demo.aggressor") )
|
|
{
|
|
startCombat(self, objects[i]);
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
|
|
// location home = getLocationObjVar(self, "ep3demo.spawnPoint");
|
|
// ai_lib.pathTo(self, home);
|
|
|
|
return;
|
|
} |