mirror of
https://github.com/SWG-Source/dsrc.git
synced 2026-08-01 01:15:59 -04:00
91 lines
1.9 KiB
Plaintext
91 lines
1.9 KiB
Plaintext
include library.ai_lib;
|
|
include library.utils;
|
|
include ai.ai_combat;
|
|
include library.healing;
|
|
|
|
const string DATATABLE = "datatables/event/invasion/ewok_bonus_loot.iff";
|
|
|
|
trigger OnAttach()
|
|
{
|
|
messageTo(self, "startAttack", null, 1, false);
|
|
messageTo(self, "goDie", null, 3600, false);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
messageHandler startAttack()
|
|
{
|
|
location target = getLocationObjVar(self, "auto_invasion.target");
|
|
|
|
float destinationOffset = getFloatObjVar(self, "auto_invasion.dest_offset");
|
|
|
|
location adjustedLoc = utils.getRandomLocationInRing(target, 0, destinationOffset);
|
|
|
|
ai_lib.aiPathTo(self, adjustedLoc);
|
|
setMovementRun(self);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
messageHandler goDie()
|
|
{
|
|
if(!ai_lib.isAiDead(self) )
|
|
destroyObject(self);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
trigger OnIncapacitated(obj_id killer)
|
|
{
|
|
int myNumber = getIntObjVar(self, "auto_invasion.my_number");
|
|
|
|
dictionary params = new dictionary();
|
|
params.put("myNumber", myNumber);
|
|
params.put("deadGuy", self);
|
|
|
|
obj_id mom = getObjIdObjVar(self, "auto_invasion.mom");
|
|
|
|
removeObjVar(mom, "auto_invasion.spawn" + myNumber);
|
|
messageTo(mom, "invaderDied", params, 1, false);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
/*******************************************************
|
|
messageHandler aiCorpsePrepared()
|
|
{
|
|
|
|
int chance = rand(1, 200);
|
|
|
|
if(hasObjVar(self, "auto_invasion.teh_uber") )
|
|
{
|
|
chance = 200;
|
|
}
|
|
|
|
if(chance > 195)
|
|
{
|
|
int roll = rand(1, 100);
|
|
int tableLength = dataTableGetNumRows(DATATABLE);
|
|
|
|
if(tableLength < 1)
|
|
{
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
for(int i = 0; i < tableLength; i++)
|
|
{
|
|
int minRoll = dataTableGetInt(DATATABLE, i, "MIN_ROLL");
|
|
|
|
if(minRoll > roll)
|
|
{
|
|
string loot = dataTableGetString(DATATABLE, i, "LOOT");
|
|
obj_id inventory = utils.getInventoryContainer(self);
|
|
obj_id reward = createObject(loot, inventory, "");
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
************************************************************/ |