Files
dsrc/sku.0/sys.server/compiled/game/script/conversation/tatooine_wald_customer.script
T

776 lines
22 KiB
Plaintext

// ======================================================================
//
// tatooine_wald_customer.script
//
//
//
// Created with SwgConversationEditor 1.36 - DO NOT EDIT THIS AUTO-GENERATED FILE!
//
// ======================================================================
// ======================================================================
// Library Includes
// ======================================================================
include library.ai_lib;
include library.chat;
include library.groundquests;
include library.utils;
// ======================================================================
// Script Constants
// ======================================================================
string c_stringFile = "conversation/tatooine_wald_customer";
// ======================================================================
// Script Conditions
// ======================================================================
boolean tatooine_wald_customer_condition__defaultCondition (obj_id player, obj_id npc)
{
return true;
}
// ----------------------------------------------------------------------
boolean tatooine_wald_customer_condition_task_2_3_active (obj_id player, obj_id npc)
{
// checking for tasks 2(swoop parts) and 3(engine parts) being active
return groundquests.isTaskActive(player, "tatooine_wald_firstquest", "tatooine_wald_firstquest_task_two_and_three_complete_WFT");
}
// ----------------------------------------------------------------------
boolean tatooine_wald_customer_condition_task2_active (obj_id player, obj_id npc)
{
// Checks to see if the swoop parts task is active (task 2).
return groundquests.isTaskActive(player, "tatooine_wald_firstquest", "tatooine_wald_firstquest_laserflits_DML");
}
// ----------------------------------------------------------------------
boolean tatooine_wald_customer_condition_del_swp_pts_active (obj_id player, obj_id npc)
{
// checks to see if all swoop parts have been recovered yet
return groundquests.isTaskActive(player, "tatooine_wald_firstquest", "tatooine_wald_firstquest_deliver_swoop_parts_WFS");
}
// ----------------------------------------------------------------------
boolean tatooine_wald_customer_condition_task3_active (obj_id player, obj_id npc)
{
// checks for the engine parts task being active (task 3)
return groundquests.isTaskActive(player, "tatooine_wald_firstquest", "tatooine_wald_firstquest_engineparts_WFS");
}
// ----------------------------------------------------------------------
boolean tatooine_wald_customer_condition_quest_complete (obj_id player, obj_id npc)
{
// checks to see if both the engine parts and swoop parts have been delivered to the customer
// not trying to catch if the whole quest is completed, though it will cover that, too, of course
return groundquests.hasCompletedTask(player, "tatooine_wald_firstquest", "tatooine_wald_firstquest_task_two_and_three_complete_WFT");
}
// ======================================================================
// Script Actions
// ======================================================================
void tatooine_wald_customer_action_send_signal_3 (obj_id player, obj_id npc)
{
// Send the signal that both deliveries have been made
groundquests.sendSignal(player, "tatooine_wald_firstquest_engineparts_aquired");
}
// ----------------------------------------------------------------------
void tatooine_wald_customer_action_send_signal_2 (obj_id player, obj_id npc)
{
// Send the signal that Wald's credit chip has been delivered and the engine parts
// are on the way to the shop.
groundquests.sendSignal(player, "tatooine_wald_firstquest_engineparts_aquired");
}
// ----------------------------------------------------------------------
void tatooine_wald_customer_action_send_signal_4 (obj_id player, obj_id npc)
{
// Send the signal that all the swoop parts have been recovered and just need
// to be delivered to the waiting customer in the starport.
groundquests.sendSignal(player, "swoop_parts_delivered");
}
// ======================================================================
// Script %TO Tokens
// ======================================================================
// ======================================================================
// Script %DI Tokens
// ======================================================================
// ======================================================================
// Script %DF Tokens
// ======================================================================
// ======================================================================
// handleBranch<n> Functions
// ======================================================================
int tatooine_wald_customer_handleBranch2 (obj_id player, obj_id npc, string_id response)
{
//-- [BRANCH NOTE]
//-- NPC: What can I do for you?
//-- [RESPONSE NOTE]
//-- PLAYER: Are you waiting on a delivery from Wald, from Watto's junkshop?
if (response == "s_11")
{
doAnimationAction (player, "explain");
//-- [NOTE]
if (tatooine_wald_customer_condition__defaultCondition (player, npc))
{
doAnimationAction (npc, "nod");
//-- NPC: Yes, I'm waiting for a delivery from Wald.
string_id message = new string_id (c_stringFile, "s_14");
int numberOfResponses = 0;
boolean hasResponse = false;
//-- PLAYER: I have those swoop parts for you.
boolean hasResponse0 = false;
if (tatooine_wald_customer_condition_del_swp_pts_active (player, npc))
{
++numberOfResponses;
hasResponse = true;
hasResponse0 = true;
}
//-- PLAYER: Well, good luck with that.
boolean hasResponse1 = false;
if (tatooine_wald_customer_condition__defaultCondition (player, npc))
{
++numberOfResponses;
hasResponse = true;
hasResponse1 = true;
}
if (hasResponse)
{
int responseIndex = 0;
string_id responses [] = new string_id [numberOfResponses];
if (hasResponse0)
responses [responseIndex++] = new string_id (c_stringFile, "s_42");
if (hasResponse1)
responses [responseIndex++] = new string_id (c_stringFile, "s_26");
utils.setScriptVar (player, "conversation.tatooine_wald_customer.branchId", 3);
npcSpeak (player, message);
npcSetConversationResponses (player, responses);
}
else
{
utils.removeScriptVar (player, "conversation.tatooine_wald_customer.branchId");
npcEndConversationWithMessage (player, message);
}
return SCRIPT_CONTINUE;
}
}
//-- [RESPONSE NOTE]
//-- PLAYER: I have his credit chip with me for those engine parts.
if (response == "s_48")
{
doAnimationAction (player, "explain");
//-- [NOTE]
if (tatooine_wald_customer_condition__defaultCondition (player, npc))
{
doAnimationAction (npc, "fakepunch");
doAnimationAction (player, "taken_aback");
tatooine_wald_customer_action_send_signal_2 (player, npc);
//-- NPC: Excellent! I'll have the engine pods delivered at once. I don't suppose Wald sent along any swoop parts with you?
string_id message = new string_id (c_stringFile, "s_50");
int numberOfResponses = 0;
boolean hasResponse = false;
//-- PLAYER: Yes, I have them here.
boolean hasResponse0 = false;
if (tatooine_wald_customer_condition_del_swp_pts_active (player, npc))
{
++numberOfResponses;
hasResponse = true;
hasResponse0 = true;
}
//-- PLAYER: No. Wald is having me pick them up next. I'll bring them to you as soon as I do.
boolean hasResponse1 = false;
if (tatooine_wald_customer_condition_task2_active (player, npc))
{
++numberOfResponses;
hasResponse = true;
hasResponse1 = true;
}
if (hasResponse)
{
int responseIndex = 0;
string_id responses [] = new string_id [numberOfResponses];
if (hasResponse0)
responses [responseIndex++] = new string_id (c_stringFile, "s_52");
if (hasResponse1)
responses [responseIndex++] = new string_id (c_stringFile, "s_60");
utils.setScriptVar (player, "conversation.tatooine_wald_customer.branchId", 5);
npcSpeak (player, message);
npcSetConversationResponses (player, responses);
}
else
{
utils.removeScriptVar (player, "conversation.tatooine_wald_customer.branchId");
npcEndConversationWithMessage (player, message);
}
return SCRIPT_CONTINUE;
}
}
//-- [RESPONSE NOTE]
//-- PLAYER: Nothing. I'm just looking for a good seat here at the bar.
if (response == "s_68")
{
doAnimationAction (player, "dismiss");
//-- [NOTE]
if (tatooine_wald_customer_condition__defaultCondition (player, npc))
{
doAnimationAction (npc, "shrug_hands");
//-- NPC: Plenty to go around.
string_id message = new string_id (c_stringFile, "s_70");
utils.removeScriptVar (player, "conversation.tatooine_wald_customer.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
}
return SCRIPT_DEFAULT;
}
// ----------------------------------------------------------------------
int tatooine_wald_customer_handleBranch3 (obj_id player, obj_id npc, string_id response)
{
//-- [BRANCH NOTE]
//-- NPC: Yes, I'm waiting for a delivery from Wald.
//-- [RESPONSE NOTE]
//-- PLAYER: I have those swoop parts for you.
if (response == "s_42")
{
doAnimationAction (player, "explain");
//-- [NOTE]
if (tatooine_wald_customer_condition__defaultCondition (player, npc))
{
doAnimationAction (npc, "strut");
doAnimationAction (player, "listen");
tatooine_wald_customer_action_send_signal_4 (player, npc);
//-- NPC: Wonderful! I have transferred the appropriate credits to Wald's accounts. Wald said he is waiting for you back at Watto's shop.
string_id message = new string_id (c_stringFile, "s_54");
int numberOfResponses = 0;
boolean hasResponse = false;
//-- PLAYER: I appreciate it.
boolean hasResponse0 = false;
if (tatooine_wald_customer_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_56");
utils.setScriptVar (player, "conversation.tatooine_wald_customer.branchId", 6);
npcSpeak (player, message);
npcSetConversationResponses (player, responses);
}
else
{
utils.removeScriptVar (player, "conversation.tatooine_wald_customer.branchId");
npcEndConversationWithMessage (player, message);
}
return SCRIPT_CONTINUE;
}
}
//-- [RESPONSE NOTE]
//-- PLAYER: Well, good luck with that.
if (response == "s_26")
{
doAnimationAction (player, "dismiss");
//-- [NOTE]
if (tatooine_wald_customer_condition__defaultCondition (player, npc))
{
doAnimationAction (npc, "thank");
//-- NPC: Thanks.
string_id message = new string_id (c_stringFile, "s_28");
utils.removeScriptVar (player, "conversation.tatooine_wald_customer.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
}
return SCRIPT_DEFAULT;
}
// ----------------------------------------------------------------------
int tatooine_wald_customer_handleBranch5 (obj_id player, obj_id npc, string_id response)
{
//-- [BRANCH NOTE]
//-- NPC: Excellent! I'll have the engine pods delivered at once. I don't suppose Wald sent along any swoop parts with you?
//-- [RESPONSE NOTE]
//-- PLAYER: Yes, I have them here.
if (response == "s_52")
{
doAnimationAction (player, "explain");
//-- [NOTE]
if (tatooine_wald_customer_condition__defaultCondition (player, npc))
{
doAnimationAction (npc, "strut");
doAnimationAction (player, "listen");
tatooine_wald_customer_action_send_signal_4 (player, npc);
//-- NPC: Wonderful! I have transferred the appropriate credits to Wald's accounts. Wald said he is waiting for you back at Watto's shop.
string_id message = new string_id (c_stringFile, "s_54");
int numberOfResponses = 0;
boolean hasResponse = false;
//-- PLAYER: I appreciate it.
boolean hasResponse0 = false;
if (tatooine_wald_customer_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_56");
utils.setScriptVar (player, "conversation.tatooine_wald_customer.branchId", 6);
npcSpeak (player, message);
npcSetConversationResponses (player, responses);
}
else
{
utils.removeScriptVar (player, "conversation.tatooine_wald_customer.branchId");
npcEndConversationWithMessage (player, message);
}
return SCRIPT_CONTINUE;
}
}
//-- [RESPONSE NOTE]
//-- PLAYER: No. Wald is having me pick them up next. I'll bring them to you as soon as I do.
if (response == "s_60")
{
doAnimationAction (player, "shake_head_no");
//-- [NOTE]
if (tatooine_wald_customer_condition__defaultCondition (player, npc))
{
doAnimationAction (npc, "nod");
//-- NPC: Alright then. I'll be right here waiting.
string_id message = new string_id (c_stringFile, "s_62");
utils.removeScriptVar (player, "conversation.tatooine_wald_customer.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
}
return SCRIPT_DEFAULT;
}
// ----------------------------------------------------------------------
int tatooine_wald_customer_handleBranch6 (obj_id player, obj_id npc, string_id response)
{
//-- [BRANCH NOTE]
//-- NPC: Wonderful! I have transferred the appropriate credits to Wald's accounts. Wald said he is waiting for you back at Watto's shop.
//-- [RESPONSE NOTE]
//-- PLAYER: I appreciate it.
if (response == "s_56")
{
doAnimationAction (player, "nod_head_once");
//-- [NOTE]
if (tatooine_wald_customer_condition__defaultCondition (player, npc))
{
doAnimationAction (npc, "wave2");
doAnimationAction (player, "salute2");
//-- NPC: Have a great day!
string_id message = new string_id (c_stringFile, "s_58");
utils.removeScriptVar (player, "conversation.tatooine_wald_customer.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
}
return SCRIPT_DEFAULT;
}
// ----------------------------------------------------------------------
int tatooine_wald_customer_handleBranch10 (obj_id player, obj_id npc, string_id response)
{
//-- [BRANCH NOTE]
//-- NPC: Greetings, my friend! Sit down. Share a drink. Wald didn't send you, did he?
//-- [RESPONSE NOTE]
//-- PLAYER: Wald?
if (response == "s_36")
{
doAnimationAction (player, "huh");
//-- [NOTE]
if (tatooine_wald_customer_condition__defaultCondition (player, npc))
{
doAnimationAction (npc, "explain");
//-- NPC: Wald is a rodian who works for Watto the Toydarian in his junk shop here in Mos Espa. Obviously he didn't send you if you don't know him.
string_id message = new string_id (c_stringFile, "s_38");
utils.removeScriptVar (player, "conversation.tatooine_wald_customer.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
}
//-- [RESPONSE NOTE]
//-- PLAYER: No.
if (response == "s_44")
{
doAnimationAction (player, "shake_head_no");
//-- [NOTE]
if (tatooine_wald_customer_condition__defaultCondition (player, npc))
{
doAnimationAction (npc, "apologize");
//-- NPC: My mistake. Sorry to bother.
string_id message = new string_id (c_stringFile, "s_46");
utils.removeScriptVar (player, "conversation.tatooine_wald_customer.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
}
return SCRIPT_DEFAULT;
}
// ----------------------------------------------------------------------
// ======================================================================
// User Script Triggers
// ======================================================================
trigger OnInitialize ()
{
if ((!isTangible (self)) || (isPlayer (self)))
detachScript(self, "conversation.tatooine_wald_customer");
setCondition (self, CONDITION_CONVERSABLE);
return SCRIPT_CONTINUE;
}
trigger OnAttach ()
{
setCondition (self, CONDITION_CONVERSABLE);
setCondition (self, CONDITION_INTERESTING);
setInvulnerable (self, true);
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);
faceTo( self, player );
return SCRIPT_CONTINUE;
}
trigger OnIncapacitated (obj_id killer)
{
clearCondition (self, CONDITION_CONVERSABLE);
detachScript (self, "conversation.tatooine_wald_customer");
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 (tatooine_wald_customer_condition_quest_complete (player, npc))
{
doAnimationAction (npc, "thank");
//-- NPC: I appreciate you making those deliveries for Wald and I.
string_id message = new string_id (c_stringFile, "s_4");
chat.chat (npc, player, message);
return SCRIPT_CONTINUE;
}
//-- [NOTE]
if (tatooine_wald_customer_condition_task_2_3_active (player, npc))
{
doAnimationAction (npc, "greet");
//-- NPC: What can I do for you?
string_id message = new string_id (c_stringFile, "s_7");
int numberOfResponses = 0;
boolean hasResponse = false;
//-- PLAYER: Are you waiting on a delivery from Wald, from Watto's junkshop?
boolean hasResponse0 = false;
if (tatooine_wald_customer_condition_del_swp_pts_active (player, npc))
{
++numberOfResponses;
hasResponse = true;
hasResponse0 = true;
}
//-- PLAYER: I have his credit chip with me for those engine parts.
boolean hasResponse1 = false;
if (tatooine_wald_customer_condition_task3_active (player, npc))
{
++numberOfResponses;
hasResponse = true;
hasResponse1 = true;
}
//-- PLAYER: Nothing. I'm just looking for a good seat here at the bar.
boolean hasResponse2 = false;
if (tatooine_wald_customer_condition__defaultCondition (player, npc))
{
++numberOfResponses;
hasResponse = true;
hasResponse2 = true;
}
if (hasResponse)
{
int responseIndex = 0;
string_id responses [] = new string_id [numberOfResponses];
if (hasResponse0)
responses [responseIndex++] = new string_id (c_stringFile, "s_11");
if (hasResponse1)
responses [responseIndex++] = new string_id (c_stringFile, "s_48");
if (hasResponse2)
responses [responseIndex++] = new string_id (c_stringFile, "s_68");
utils.setScriptVar (player, "conversation.tatooine_wald_customer.branchId", 2);
npcStartConversation (player, npc, "tatooine_wald_customer", message, responses);
}
else
{
chat.chat (npc, player, message);
}
return SCRIPT_CONTINUE;
}
//-- [NOTE]
if (tatooine_wald_customer_condition__defaultCondition (player, npc))
{
doAnimationAction (npc, "check_wrist_device");
//-- NPC: Greetings, my friend! Sit down. Share a drink. Wald didn't send you, did he?
string_id message = new string_id (c_stringFile, "s_34");
int numberOfResponses = 0;
boolean hasResponse = false;
//-- PLAYER: Wald?
boolean hasResponse0 = false;
if (tatooine_wald_customer_condition__defaultCondition (player, npc))
{
++numberOfResponses;
hasResponse = true;
hasResponse0 = true;
}
//-- PLAYER: No.
boolean hasResponse1 = false;
if (tatooine_wald_customer_condition__defaultCondition (player, npc))
{
++numberOfResponses;
hasResponse = true;
hasResponse1 = true;
}
if (hasResponse)
{
int responseIndex = 0;
string_id responses [] = new string_id [numberOfResponses];
if (hasResponse0)
responses [responseIndex++] = new string_id (c_stringFile, "s_36");
if (hasResponse1)
responses [responseIndex++] = new string_id (c_stringFile, "s_44");
utils.setScriptVar (player, "conversation.tatooine_wald_customer.branchId", 10);
npcStartConversation (player, npc, "tatooine_wald_customer", message, responses);
}
else
{
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 != "tatooine_wald_customer")
return SCRIPT_CONTINUE;
obj_id npc = self;
int branchId = utils.getIntScriptVar (player, "conversation.tatooine_wald_customer.branchId");
if (branchId == 2 && tatooine_wald_customer_handleBranch2 (player, npc, response) == SCRIPT_CONTINUE)
return SCRIPT_CONTINUE;
if (branchId == 3 && tatooine_wald_customer_handleBranch3 (player, npc, response) == SCRIPT_CONTINUE)
return SCRIPT_CONTINUE;
if (branchId == 5 && tatooine_wald_customer_handleBranch5 (player, npc, response) == SCRIPT_CONTINUE)
return SCRIPT_CONTINUE;
if (branchId == 6 && tatooine_wald_customer_handleBranch6 (player, npc, response) == SCRIPT_CONTINUE)
return SCRIPT_CONTINUE;
if (branchId == 10 && tatooine_wald_customer_handleBranch10 (player, npc, response) == SCRIPT_CONTINUE)
return SCRIPT_CONTINUE;
chat.chat (npc, "Error: Fell through all branches and responses for OnNpcConversationResponse.");
utils.removeScriptVar (player, "conversation.tatooine_wald_customer.branchId");
return SCRIPT_CONTINUE;
}
// ======================================================================