mirror of
https://bitbucket.org/seefoe/dsrc.git
synced 2026-07-31 01:15:55 -04:00
44 lines
1.0 KiB
Plaintext
44 lines
1.0 KiB
Plaintext
/* This script is attached to NPCs by
|
|
* quests.spawnAttackers
|
|
*
|
|
* NPCs message the target when they are destroyed
|
|
* with a dictionary containing the string name
|
|
* that was passed to spawnAttackers and the
|
|
* obj_id of the npc (in "name" and "npc")
|
|
* --------------------------------------------------*/
|
|
trigger OnAttach()
|
|
{
|
|
if ( !hasObjVar( self, "quests.target") )
|
|
{
|
|
detachScript( self, "theme_park.utils.npcdeath");
|
|
}
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
trigger OnDestroy()
|
|
{
|
|
if ( !hasObjVar( self, "quests.target") )
|
|
{
|
|
detachScript( self, "theme_park.utils.npcdeath");
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
obj_id target = getObjIdObjVar( self, "quests.target" );
|
|
string msgHandlerName = getStringObjVar( self, "quests.msgHandlerName" );
|
|
messageTo( target, msgHandlerName, null, 0, true );
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
trigger OnIncapacitated(obj_id killer)
|
|
{
|
|
setHealth( self, -5000 );
|
|
messageTo( self, "killMe", null, 5, true );
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
messageHandler killMe()
|
|
{
|
|
destroyObject( self );
|
|
return SCRIPT_CONTINUE;
|
|
}
|