Files
dsrc/sku.0/sys.server/compiled/game/script/theme_park/utils/npcdeath.script
T

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;
}