Files
dsrc/sku.0/sys.server/compiled/game/script/theme_park/warren/escapee.script
T
2013-09-10 23:17:15 -07:00

159 lines
4.7 KiB
Plaintext

include library.utils;
include library.ai_lib;
include library.chat;
include ai.ai_combat;
const string CONVO_FILE = "theme_park/warren/warren";
const string SYSTEM_MESSAGES = "theme_park/warren/warren_system_messages";
const string PASSKEYCODE = "object/tangible/mission/quest_item/warren_passkey_s01.iff";
trigger OnAttach()
{
ai_lib.setDefaultCalmBehavior( self, ai_lib.BEHAVIOR_WANDER );
setCondition( self, CONDITION_CONVERSABLE );
chat.setChatMood( self, chat.MOOD_SCARED );
obj_id bldg = getObjIdObjVar( self, "warren.bldg" );
ai_combat.aiCombatFlee( self, bldg, 80.0f, 120.0f );
setName( self, "" );
setName( self, new string_id ( "theme_park/warren/warren_system_messages", "name_ovitt" ));
setInvulnerable( self, true );
return SCRIPT_CONTINUE;
}
trigger OnObjectMenuRequest(obj_id player, menu_info mi)
{
int mnu = mi.addRootMenu (menu_info_types.CONVERSE_START, null);
menu_info_data mdata = mi.getMenuItemById(mnu);
mdata.setServerNotify(false);
return SCRIPT_CONTINUE;
}
trigger OnStartNpcConversation (obj_id speaker)
{
if ( ai_lib.isInCombat( self ) || ai_lib.isInCombat( speaker ) || ai_lib.aiIsDead( self ) )
return SCRIPT_CONTINUE;
chat.setChatMood( self, chat.MOOD_SCARED );
faceToBehavior( self, speaker );
string_id greeting = new string_id (CONVO_FILE, "escapee_start");//I can't believe I escaped that terrible place
string_id response[] = new string_id [1];
response[0] = new string_id (CONVO_FILE, "escapee_reply_1");//what place?
npcStartConversation (speaker, self, CONVO_FILE, greeting, response);
return SCRIPT_CONTINUE;
}
trigger OnNpcConversationResponse(string convo, obj_id player, string_id response)
{
if ( !convo.equals( CONVO_FILE ) )
return SCRIPT_CONTINUE;
npcRemoveConversationResponse(player, response );
if ( response.getAsciiId().equals("escapee_reply_1"))//What place?
{
string_id message = new string_id (CONVO_FILE, "escapee_1");//the warren
npcSpeak( player, message );
npcAddConversationResponse( player, new string_id( CONVO_FILE, "escapee_1_reply_1" ));//where is that?
npcAddConversationResponse( player, new string_id( CONVO_FILE, "escapee_1_reply_2" ));//What's so bad about it?
return SCRIPT_CONTINUE;
}
if ( response.getAsciiId().equals("escapee_1_reply_1"))//Where is that?
{
obj_id playerInv = utils.getInventoryContainer( player );
if ( isIdValid( playerInv ) )
{
if ( hasKey( playerInv ) )
{
string_id message = new string_id (CONVO_FILE, "escapee_haskey" );//you already have a key
npcSpeak( player, message );
return SCRIPT_CONTINUE;
}
}
string_id message = new string_id (CONVO_FILE, "escapee_2" );//here's a waypoint
npcSpeak( player, message );
obj_id warren = getObjIdObjVar( self, "warren.bldg" );
if ( !isIdValid(warren) )
{
//debugSpeakMsg( self, "warren is invalid" );
return SCRIPT_CONTINUE;
}
obj_id wayp = createWaypointInDatapad( player, warren );
if ( isIdValid( wayp ) )
{
//debugSpeakMsg( self, "wayp is valid" );
//debugSpeakMsg( self, "wayp is valid" );
//setWaypointName( wayp, utils.packStringId( new string_id ( SYSTEM_MESSAGES, "waypoint_name" )));
setWaypointName( wayp, getString( new string_id ( SYSTEM_MESSAGES, "waypoint_name" )));
//debugSpeakMsg( self, "I set its name" );
setWaypointActive( wayp, true );
setWaypointVisible( wayp, true );
//debugSpeakMsg( self, "I made it visible and active" );
if ( isIdValid( playerInv ) )
{
obj_id passKey = createObject( PASSKEYCODE, playerInv, "");
if ( isIdValid( passKey ) )
{
//debugSpeakMsg( self, "I made a thing for you" );
setObjVar( passKey, "warren.keycode", true );
setName( passKey, "" );
setName( passKey, new string_id( SYSTEM_MESSAGES, "passkey_name" ) );
}
}
else
{
//debugSpeakMsg( self, "You have no inventory" );
}
}
else
{
//debugSpeakMsg( self, "wayp is valid" );
}
return SCRIPT_CONTINUE;
}
if ( response.getAsciiId().equals("escapee_1_reply_2"))//What's so bad about it?
{
string_id message = new string_id (CONVO_FILE, "escapee_3" );//dreadful research
npcSpeak( player, message );
return SCRIPT_CONTINUE;
}
return SCRIPT_CONTINUE;
}
trigger OnIncapacitated( obj_id killer )
{
obj_id warren = getObjIdObjVar( self, "warren.bldg" );
messageTo( warren, "handleEscapeeDied", null, 5, false );
return SCRIPT_CONTINUE;
}
trigger OnRemovingFromWorld()
{
obj_id warren = getObjIdObjVar( self, "warren.bldg" );
messageTo( warren, "handleEscapeeDied", null, 120, false );
return SCRIPT_CONTINUE;
}
boolean hasKey( obj_id inv )
{
obj_id[] contents = getContents( inv );
if ( contents==null )
return false;
for ( int i = 0; i < contents.length; i++ )
{
if ( hasObjVar( contents[i], "warren.keycode" ) )
return true;
}
return false;
}