mirror of
https://github.com/SWG-Source/dsrc.git
synced 2026-10-10 01:12:58 -04:00
116 lines
2.9 KiB
Plaintext
116 lines
2.9 KiB
Plaintext
/**
|
|
|
|
*
|
|
* Title: prisoner.script
|
|
* Description: script for prisoners: POI = factoryliberation
|
|
|
|
*/
|
|
|
|
//------------------------------------------------
|
|
// Includes
|
|
//------------------------------------------------
|
|
|
|
include library.ai_lib;
|
|
include library.factions;
|
|
include library.poi;
|
|
include library.scenario;
|
|
|
|
//------------------------------------------------
|
|
// Constants
|
|
//------------------------------------------------
|
|
|
|
const string frustrationEmotes[] = { "scratch", "yawn", "tantrum", "cough", "curse", "fear", "steam" };
|
|
const string joyEmotes[] = { "thank", "cheer", "applaud", "laugh", "softclap", "yes", "glow" };
|
|
|
|
//------------------------------------------------
|
|
// Methods
|
|
//------------------------------------------------
|
|
|
|
//------------------------------------------------
|
|
// OnAttach
|
|
//------------------------------------------------
|
|
|
|
trigger OnAttach()
|
|
{
|
|
// We ignore combat.
|
|
ai_lib.setIgnoreCombat( self, true );
|
|
|
|
// We cannot be attacked while in prison.
|
|
setObjVar( self, "oldFaction", factions.getFaction( self ) );
|
|
factions.setFaction( self, "Unattackable" );
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//------------------------------------------------
|
|
// OnLoiterWaiting
|
|
//
|
|
// Prisoners emote every once in a while.
|
|
//------------------------------------------------
|
|
|
|
trigger OnLoiterWaiting( modifiable_float time )
|
|
{
|
|
stop( self );
|
|
|
|
if ( scenario.isComplete( poi.getBaseObject(self) ) )
|
|
messageTo( self, "emoteJoy", null, 4, false );
|
|
else
|
|
messageTo( self, "emoteFrustration", null, 4, false );
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//------------------------------------------------
|
|
// emoteFrustration
|
|
//------------------------------------------------
|
|
|
|
messageHandler emoteFrustration()
|
|
{
|
|
// There is a chance we'll do a social.
|
|
int dosocial = rand( 1, 4 );
|
|
if ( dosocial == 1 )
|
|
{
|
|
// Perform a social.
|
|
int whichsocial = rand( 0, 6 );
|
|
queueCommand( self, ##"social", null, frustrationEmotes[whichsocial], COMMAND_PRIORITY_DEFAULT );
|
|
}
|
|
|
|
messageTo( self, "resumeDefaultCalmBehavior", null, 3, false );
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//------------------------------------------------
|
|
// emoteJoy
|
|
//------------------------------------------------
|
|
|
|
messageHandler emoteJoy()
|
|
{
|
|
// There is a chance we'll do a social.
|
|
int dosocial = rand( 1, 4 );
|
|
if ( dosocial == 1 )
|
|
{
|
|
// Perform a social.
|
|
int whichsocial = rand( 0, 6 );
|
|
queueCommand( self, ##"social", null, joyEmotes[whichsocial], COMMAND_PRIORITY_DEFAULT );
|
|
}
|
|
|
|
messageTo( self, "resumeDefaultCalmBehavior", null, 3, false );
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//------------------------------------------------
|
|
// celebrateFreedom
|
|
//------------------------------------------------
|
|
|
|
messageHandler celebrateFreedom()
|
|
{
|
|
stop( self );
|
|
int whichsocial = rand( 0, 6 );
|
|
queueCommand( self, ##"social", null, joyEmotes[whichsocial], COMMAND_PRIORITY_DEFAULT );
|
|
messageTo( self, "resumeDefaultCalmBehavior", null, 3, false );
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|