mirror of
https://github.com/SWG-Source/dsrc.git
synced 2026-07-31 00:15:54 -04:00
268 lines
7.9 KiB
Plaintext
268 lines
7.9 KiB
Plaintext
// ======================================================================
|
|
//
|
|
// injured_agent.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.groundquests;
|
|
include library.utils;
|
|
|
|
// ======================================================================
|
|
// Script Constants
|
|
// ======================================================================
|
|
|
|
string c_stringFile = "conversation/injured_agent";
|
|
|
|
// ======================================================================
|
|
// Script Conditions
|
|
// ======================================================================
|
|
|
|
boolean injured_agent_condition__defaultCondition (obj_id player, obj_id npc)
|
|
{
|
|
return true;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
boolean injured_agent_condition_hasDelivery (obj_id player, obj_id npc)
|
|
{
|
|
return groundquests.isTaskActive(player, "u16_nym_themepark_save_agent", "findAgent")
|
|
|| (groundquests.hasCompletedQuest(player, "u16_nym_themepark_save_agent")
|
|
&& !groundquests.isQuestActiveOrComplete(player, "u16_nym_themepark_safe"));
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
boolean injured_agent_condition_doneReturn (obj_id player, obj_id npc)
|
|
{
|
|
return groundquests.isQuestActiveOrComplete(player, "u16_nym_themepark_safe");
|
|
}
|
|
|
|
// ======================================================================
|
|
// Script Actions
|
|
// ======================================================================
|
|
|
|
void injured_agent_action_clearDelivery (obj_id player, obj_id npc)
|
|
{
|
|
groundquests.sendSignal(player, "hasCompletedAgentTask");
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
void injured_agent_action_giveReturnQuest (obj_id player, obj_id npc)
|
|
{
|
|
groundquests.grantQuest(player, "u16_nym_themepark_safe");
|
|
}
|
|
|
|
// ======================================================================
|
|
// Script %TO Tokens
|
|
// ======================================================================
|
|
|
|
// ======================================================================
|
|
// Script %DI Tokens
|
|
// ======================================================================
|
|
|
|
// ======================================================================
|
|
// Script %DF Tokens
|
|
// ======================================================================
|
|
|
|
// ======================================================================
|
|
// handleBranch<n> Functions
|
|
// ======================================================================
|
|
|
|
int injured_agent_handleBranch2 (obj_id player, obj_id npc, string_id response)
|
|
{
|
|
//-- [BRANCH NOTE]
|
|
//-- NPC: *Moan*
|
|
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: Rei? Ralia sent me. Here are the medical supplies you need.
|
|
if (response == "s_6")
|
|
{
|
|
//-- [NOTE]
|
|
if (injured_agent_condition__defaultCondition (player, npc))
|
|
{
|
|
injured_agent_action_giveReturnQuest (player, npc);
|
|
|
|
//-- NPC: That was close; these are almost expired! I'm so glad you made it in time! Thank you!
|
|
string_id message = new string_id (c_stringFile, "s_8");
|
|
utils.removeScriptVar (player, "conversation.injured_agent.branchId");
|
|
|
|
npcEndConversationWithMessage (player, message);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
}
|
|
|
|
return SCRIPT_DEFAULT;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
// ======================================================================
|
|
// User Script Triggers
|
|
// ======================================================================
|
|
|
|
trigger OnInitialize ()
|
|
{
|
|
if ((!isTangible (self)) || (isPlayer (self)))
|
|
detachScript(self, "conversation.injured_agent");
|
|
|
|
setCondition (self, CONDITION_CONVERSABLE);
|
|
setCondition( self, CONDITION_INTERESTING );
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
trigger OnAttach ()
|
|
{
|
|
setCondition (self, CONDITION_CONVERSABLE);
|
|
setCondition( self, CONDITION_INTERESTING );
|
|
|
|
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.injured_agent");
|
|
|
|
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 (injured_agent_condition_doneReturn (player, npc))
|
|
{
|
|
doAnimationAction (npc, "handshake_tandem");
|
|
|
|
doAnimationAction (player, "handshake_tandem");
|
|
|
|
//-- NPC: I'm still hurt but I'll recover, now, thanks to you.
|
|
string_id message = new string_id (c_stringFile, "s_11");
|
|
chat.chat (npc, player, message);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//-- [NOTE]
|
|
if (injured_agent_condition_hasDelivery (player, npc))
|
|
{
|
|
injured_agent_action_clearDelivery (player, npc);
|
|
|
|
//-- NPC: *Moan*
|
|
string_id message = new string_id (c_stringFile, "s_4");
|
|
int numberOfResponses = 0;
|
|
|
|
boolean hasResponse = false;
|
|
|
|
//-- PLAYER: Rei? Ralia sent me. Here are the medical supplies you need.
|
|
boolean hasResponse0 = false;
|
|
if (injured_agent_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.injured_agent.branchId", 2);
|
|
|
|
npcStartConversation (player, npc, "injured_agent", message, responses);
|
|
}
|
|
else
|
|
{
|
|
chat.chat (npc, player, message);
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//-- [NOTE]
|
|
if (injured_agent_condition__defaultCondition (player, npc))
|
|
{
|
|
//-- NPC: Can't you see I'm hurt?! Go find help! Find Ralia!
|
|
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 != "injured_agent")
|
|
return SCRIPT_CONTINUE;
|
|
|
|
obj_id npc = self;
|
|
|
|
int branchId = utils.getIntScriptVar (player, "conversation.injured_agent.branchId");
|
|
|
|
if (branchId == 2 && injured_agent_handleBranch2 (player, npc, response) == SCRIPT_CONTINUE)
|
|
return SCRIPT_CONTINUE;
|
|
|
|
chat.chat (npc, "Error: Fell through all branches and responses for OnNpcConversationResponse.");
|
|
|
|
utils.removeScriptVar (player, "conversation.injured_agent.branchId");
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
// ======================================================================
|
|
|