Files
dsrc/sku.0/sys.server/compiled/game/script/poi/tusken_attack/beast.script
T
2013-09-10 23:17:15 -07:00

160 lines
4.2 KiB
Plaintext

/**
* Copyright (c) ©2000,2001 Sony Online Entertainment Inc.
* All Rights Reserved
*
* Title: antagonist.script
* Description: antagonist object script: POI = gangwar
* @author $Author: breinhart $
* @version $Revision: #1 $
*/
//------------------------------------------------
// Includes
//------------------------------------------------
include library.ai_lib;
include library.scenario;
include library.poi;
include library.pclib;
include ai.ai_combat;
//-----------------------------------------------
// Inherits
//-----------------------------------------------
inherits poi.base.scenario_actor;
//------------------------------------------------
// Constants
//------------------------------------------------
const string SCRIPT_CONVERSE = "npc.converse.npc_converse_menu";
const string LOG_NAME = "poiTuskenAttack Antagonist";
//------------------------------------------------
// Methods
//------------------------------------------------
//------------------------------------------------
// OnAttach
//------------------------------------------------
trigger OnAttach()
{
detachScript( self, SCRIPT_CONVERSE );
return SCRIPT_CONTINUE;
}
//------------------------------------------------
// OnIncapacitated
//------------------------------------------------
trigger OnIncapacitated( obj_id killer )
{
// Get reference to base.
obj_id poiMaster = poi.getBaseObject( self );
if ( (poiMaster == null) || (poiMaster == obj_id.NULL_ID) )
return SCRIPT_CONTINUE;
messageTo( poiMaster, scenario.HANDLER_ACTOR_DEATH, null, 0, false );
return SCRIPT_CONTINUE;
}
//------------------------------------------------
// OnTriggerVolumeEntered
//------------------------------------------------
trigger OnTriggerVolumeEntered( string volumeName, obj_id breacher )
{
return SCRIPT_OVERRIDE;
}
//------------------------------------------------
// vocalizeEndCombat
//
// Find a new target once ours is dead.
//------------------------------------------------
messageHandler vocalizeEndCombat()
{
// Don't do this if dead or in combat.
if ( ai_lib.isDead( self ) || ai_lib.isInCombat( self ))
return SCRIPT_OVERRIDE;
// Kill players that are down.
obj_id[] players = getPlayerCreaturesInRange(self, 80f);
for ( int i = 0; i < players.length; i++ )
{
if ( isIncapacitated( players[i] ) && getPosture( players[i] ) != POSTURE_DEAD )
{
pclib.coupDeGrace( players[i], self );
return SCRIPT_OVERRIDE;
}
}
// Get base object reference.
obj_id poiMaster = poi.getBaseObject(self);
if ( (poiMaster == null) || (poiMaster == obj_id.NULL_ID) )
return SCRIPT_CONTINUE;
// Find a new target.
obj_id[] mediators = scenario.getTeamMembers( poiMaster, "mediator" );
for ( int i=0; i<mediators.length; i++ )
{
if ( isIncapacitated( mediators[i] ) || ai_lib.isDead( mediators[i] ) )
continue;
startCombat( self, mediators[i] );
return SCRIPT_CONTINUE;
}
// Celebrate.
if ( getPosture( self ) == POSTURE_UPRIGHT )
{
string skeleton = dataTableGetString("datatables/ai/species.iff", ai_lib.aiGetSpecies( self ), "Skeleton");
if ( skeleton == "human" )
doAnimationAction( self, "celebrate" );
else
doAnimationAction( self, "vocalize" );
}
messageTo( self, "postCombatPathHome", null, rand(10,20), false );
// Allow us to loiter.
ai_lib.setDefaultCalmBehavior( self, ai_lib.BEHAVIOR_SENTINEL );
return SCRIPT_OVERRIDE;
}
//------------------------------------------------
// OnTargeted
//------------------------------------------------
trigger OnTargeted( obj_id attacker )
{
// Only do this once ever.
if ( hasObjVar( self, "attackedByElse" ) )
return SCRIPT_CONTINUE;
setObjVar( self, "attackedByElse", 1 );
// Get base object reference.
obj_id poiMaster = poi.getBaseObject(self);
if ( (poiMaster == null) || (poiMaster == obj_id.NULL_ID) )
return SCRIPT_CONTINUE;
// Check to see if we were targetted by a non-mediator.
obj_id[] mediators = scenario.getTeamMembers( poiMaster, "mediator" );
for ( int i=0; i<mediators.length; i++ )
{
if ( mediators[i] == attacker )
return SCRIPT_CONTINUE;
}
// Say something!
poi.quickSay( self, "a_whatthehell" );
// We were targeted by a non mediator. Start the attack!
messageTo( self, "startAttack", null, 0, false );
return SCRIPT_CONTINUE;
}