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

281 lines
8.3 KiB
Plaintext

// ======================================================================
//
// sd_event_convo.script
// Copyright 2004, Sony Online Entertainment
// All Rights Reserved.
//
// Created with SwgConversationEditor 1.37 - DO NOT EDIT THIS AUTO-GENERATED FILE!
//
// ======================================================================
// ======================================================================
// Library Includes
// ======================================================================
include library.ai_lib;
include library.chat;
include library.conversation;
include library.prose;
include library.trial;
include library.utils;
// ======================================================================
// Script Constants
// ======================================================================
string c_stringFile = "conversation/sd_event_convo";
// ======================================================================
// Script Conditions
// ======================================================================
boolean sd_event_convo_condition__defaultCondition (obj_id player, obj_id npc)
{
return true;
}
// ----------------------------------------------------------------------
boolean sd_event_convo_condition_hasTalked (obj_id player, obj_id npc)
{
return hasObjVar(npc, "talked");
}
// ======================================================================
// Script Actions
// ======================================================================
void sd_event_convo_action_openingEcho (obj_id player, obj_id npc)
{
obj_id[] players = trial.getPlayersInDungeon(trial.getTop(npc));
prose_package pp = new prose_package();
pp.target.set(player);
pp.stringId = new string_id("spam", "event_one_kenkirk_incursion");
utils.sendSystemMessageProse(players, pp);
faceTo(npc, player);
}
// ----------------------------------------------------------------------
void sd_event_convo_action_kickoffSdEvent (obj_id player, obj_id npc)
{
if (hasObjVar(npc, "talked"))
return;
dictionary dict = trial.getSessionDict(trial.getTop(npc));
dict.put("triggerType", "triggerId");
dict.put("triggerName", "start_event");
messageTo(trial.getTop(npc), "triggerFired", dict, 0.0f, false);
setObjVar(npc, "talked", 1);
obj_id[] players = trial.getPlayersInDungeon(trial.getTop(npc));
prose_package pp = new prose_package();
pp.target.set(player);
pp.stringId = new string_id("spam", "event_one_kenkirk_walkaway");
utils.sendSystemMessageProse(players, pp);
}
// ----------------------------------------------------------------------
void sd_event_convo_action_playerResponse (obj_id player, obj_id npc)
{
obj_id[] players = trial.getPlayersInDungeon(trial.getTop(npc));
prose_package pp = new prose_package();
pp.target.set(player);
pp.stringId = new string_id("spam", "event_one_player_response");
utils.sendSystemMessageProse(players, pp);
}
// ======================================================================
// Script %TO Tokens
// ======================================================================
// ======================================================================
// Script %DI Tokens
// ======================================================================
// ======================================================================
// Script %DF Tokens
// ======================================================================
// ======================================================================
// handleBranch<n> Functions
// ======================================================================
int sd_event_convo_handleBranch1 (obj_id player, obj_id npc, string_id response)
{
//-- [BRANCH NOTE]
//-- NPC: I do not know who you are, but your incursion onto this ship is at an end.
//-- [RESPONSE NOTE]
//-- PLAYER: Remove these bars, and we will see who is at their end.
if (response == "s_6")
{
sd_event_convo_action_playerResponse (player, npc);
//-- [NOTE]
if (sd_event_convo_condition__defaultCondition (player, npc))
{
sd_event_convo_action_kickoffSdEvent (player, npc);
//-- NPC: Perhaps you will have your chance. Find the squad leader, he has the key.
string_id message = new string_id (c_stringFile, "s_8");
utils.removeScriptVar (player, "conversation.sd_event_convo.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
}
return SCRIPT_DEFAULT;
}
// ----------------------------------------------------------------------
// ======================================================================
// User Script Triggers
// ======================================================================
trigger OnInitialize ()
{
if ((!isTangible (self)) || (isPlayer (self)))
detachScript(self, "conversation.sd_event_convo");
setCondition (self, CONDITION_CONVERSABLE);
return SCRIPT_CONTINUE;
}
trigger OnAttach ()
{
setCondition (self, CONDITION_CONVERSABLE);
setHologramType(self, HOLOGRAM_TYPE1_QUALITY4);
return SCRIPT_CONTINUE;
}
trigger OnObjectMenuRequest (obj_id player, menu_info menuInfo)
{
int menu = menuInfo.addRootMenu (menu_info_types.CONVERSE_START, null);
menu_info_data menuInfoData = menuInfo.getMenuItemById (menu);
menuInfoData.setServerNotify (false);
setCondition (self, CONDITION_CONVERSABLE);
return SCRIPT_CONTINUE;
}
trigger OnIncapacitated (obj_id killer)
{
clearCondition (self, CONDITION_CONVERSABLE);
detachScript (self, "conversation.sd_event_convo");
return SCRIPT_CONTINUE;
}
// ======================================================================
// Script Triggers
// ======================================================================
//-- This function should move to base_class.java
boolean npcStartConversation(obj_id player, obj_id npc, string convoName, string_id greetingId, prose_package greetingProse, string_id[] responses)
{
Object[] objects = new Object[responses.length];
System.arraycopy(responses, 0, objects, 0, responses.length);
return npcStartConversation(player, npc, convoName, greetingId, greetingProse, objects);
}
// ----------------------------------------------------------------------
trigger OnStartNpcConversation (obj_id player)
{
obj_id npc = self;
if (ai_lib.isInCombat (npc) || ai_lib.isInCombat (player))
return SCRIPT_OVERRIDE;
//-- [NOTE]
if (!sd_event_convo_condition_hasTalked (player, npc))
{
doAnimationAction (npc, "wave_finger_warning");
sd_event_convo_action_openingEcho (player, npc);
//-- NPC: I do not know who you are, but your incursion onto this ship is at an end.
string_id message = new string_id (c_stringFile, "s_4");
int numberOfResponses = 0;
boolean hasResponse = false;
//-- PLAYER: Remove these bars, and we will see who is at their end.
boolean hasResponse0 = false;
if (sd_event_convo_condition__defaultCondition (player, npc))
{
++numberOfResponses;
hasResponse = true;
hasResponse0 = true;
}
if (hasResponse)
{
int responseIndex = 0;
string_id responses [] = new string_id [numberOfResponses];
if (hasResponse0)
responses [responseIndex++] = new string_id (c_stringFile, "s_6");
utils.setScriptVar (player, "conversation.sd_event_convo.branchId", 1);
npcStartConversation (player, npc, "sd_event_convo", message, responses);
}
else
{
chat.chat (npc, player, message);
}
return SCRIPT_CONTINUE;
}
//-- [NOTE]
if (sd_event_convo_condition__defaultCondition (player, npc))
{
//-- NPC: Your time will come.
string_id message = new string_id (c_stringFile, "s_10");
chat.chat (npc, player, message);
return SCRIPT_CONTINUE;
}
chat.chat (npc, "Error: All conditions for OnStartNpcConversation were false.");
return SCRIPT_CONTINUE;
}
// ----------------------------------------------------------------------
trigger OnNpcConversationResponse (string conversationId, obj_id player, string_id response)
{
if (conversationId != "sd_event_convo")
return SCRIPT_CONTINUE;
obj_id npc = self;
int branchId = utils.getIntScriptVar (player, "conversation.sd_event_convo.branchId");
if (branchId == 1 && sd_event_convo_handleBranch1 (player, npc, response) == SCRIPT_CONTINUE)
return SCRIPT_CONTINUE;
chat.chat (npc, "Error: Fell through all branches and responses for OnNpcConversationResponse.");
utils.removeScriptVar (player, "conversation.sd_event_convo.branchId");
return SCRIPT_CONTINUE;
}
// ======================================================================