mirror of
https://github.com/SWG-Source/dsrc.git
synced 2026-07-31 00:15:54 -04:00
525 lines
15 KiB
Plaintext
525 lines
15 KiB
Plaintext
// ======================================================================
|
|
//
|
|
// tusken_expert.script
|
|
// Copyright 2004, Sony Online Entertainment
|
|
// All Rights Reserved.
|
|
//
|
|
// Created with SwgConversationEditor 1.36 - DO NOT EDIT THIS AUTO-GENERATED FILE!
|
|
//
|
|
// ======================================================================
|
|
|
|
// ======================================================================
|
|
// Library Includes
|
|
// ======================================================================
|
|
|
|
include library.ai_lib;
|
|
include library.chat;
|
|
include library.factions;
|
|
include library.groundquests;
|
|
include library.utils;
|
|
|
|
// ======================================================================
|
|
// Script Constants
|
|
// ======================================================================
|
|
|
|
string c_stringFile = "conversation/tusken_expert";
|
|
|
|
// ======================================================================
|
|
// Script Conditions
|
|
// ======================================================================
|
|
|
|
boolean tusken_expert_condition__defaultCondition (obj_id player, obj_id npc)
|
|
{
|
|
return true;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
boolean tusken_expert_condition_starportNeedsCrew (obj_id player, obj_id npc)
|
|
{
|
|
return groundquests.isTaskActive(player, "heroic_tusken_tracking_02", "heroic_tusken_starport_crew");
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
boolean tusken_expert_condition_wattoNeedsCrew (obj_id player, obj_id npc)
|
|
{
|
|
return groundquests.isTaskActive(player, "heroic_tusken_tracking_02", "heroic_tusken_watto_crew");
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
boolean tusken_expert_condition_medcenterNeedsCrew (obj_id player, obj_id npc)
|
|
{
|
|
return groundquests.isTaskActive(player, "heroic_tusken_tracking_02", "heroic_tusken_medcenter_crew");
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
boolean tusken_expert_condition_universityNeedsCrew (obj_id player, obj_id npc)
|
|
{
|
|
return groundquests.isTaskActive(player, "heroic_tusken_tracking_02", "heroic_tusken_university_crew");
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
boolean tusken_expert_condition_clonecenterNeedsCrew (obj_id player, obj_id npc)
|
|
{
|
|
return groundquests.isTaskActive(player, "heroic_tusken_tracking_02", "heroic_tusken_cloning_crew");
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
boolean tusken_expert_condition_combathallNeedsCrew (obj_id player, obj_id npc)
|
|
{
|
|
return groundquests.isTaskActive(player, "heroic_tusken_tracking_02", "heroic_tusken_combat_crew");
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
boolean tusken_expert_condition_allBuildingsHaveCrews (obj_id player, obj_id npc)
|
|
{
|
|
return ( groundquests.hasCompletedTask(player, "heroic_tusken_tracking_02", "heroic_tusken_starport_crew") &&
|
|
groundquests.hasCompletedTask(player, "heroic_tusken_tracking_02", "heroic_tusken_watto_crew") &&
|
|
groundquests.hasCompletedTask(player, "heroic_tusken_tracking_02", "heroic_tusken_medcenter_crew") &&
|
|
groundquests.hasCompletedTask(player, "heroic_tusken_tracking_02", "heroic_tusken_university_crew") &&
|
|
groundquests.hasCompletedTask(player, "heroic_tusken_tracking_02", "heroic_tusken_cloning_crew") &&
|
|
groundquests.hasCompletedTask(player, "heroic_tusken_tracking_02", "heroic_tusken_combat_crew") );
|
|
}
|
|
|
|
// ======================================================================
|
|
// Script Actions
|
|
// ======================================================================
|
|
|
|
void tusken_expert_action_goToStarport (obj_id player, obj_id npc)
|
|
{
|
|
dictionary dict = new dictionary();
|
|
dict.put("pathAction", "patrol_path");
|
|
dict.put("pathName", "toStarport");
|
|
messageTo(npc, "doPathAction", dict, 0.0f, false);
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
void tusken_expert_action_goToUniversity (obj_id player, obj_id npc)
|
|
{
|
|
dictionary dict = new dictionary();
|
|
dict.put("pathAction", "patrol_path");
|
|
dict.put("pathName", "toUniversity");
|
|
messageTo(npc, "doPathAction", dict, 0.0f, false);
|
|
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
void tusken_expert_action_goToMedicalCenter (obj_id player, obj_id npc)
|
|
{
|
|
dictionary dict = new dictionary();
|
|
dict.put("pathAction", "patrol_path");
|
|
dict.put("pathName", "toMedical");
|
|
messageTo(npc, "doPathAction", dict, 0.0f, false);
|
|
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
void tusken_expert_action_goToCommerce (obj_id player, obj_id npc)
|
|
{
|
|
dictionary dict = new dictionary();
|
|
dict.put("pathAction", "patrol_path");
|
|
dict.put("pathName", "toCommerce");
|
|
messageTo(npc, "doPathAction", dict, 0.0f, false);
|
|
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
void tusken_expert_action_goToCloning (obj_id player, obj_id npc)
|
|
{
|
|
dictionary dict = new dictionary();
|
|
dict.put("pathAction", "patrol_path");
|
|
dict.put("pathName", "toCloning");
|
|
messageTo(npc, "doPathAction", dict, 0.0f, false);
|
|
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
void tusken_expert_action_goToCombat (obj_id player, obj_id npc)
|
|
{
|
|
dictionary dict = new dictionary();
|
|
dict.put("pathAction", "patrol_path");
|
|
dict.put("pathName", "toCombat");
|
|
messageTo(npc, "doPathAction", dict, 0.0f, false);
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
void tusken_expert_action_goToWatto (obj_id player, obj_id npc)
|
|
{
|
|
dictionary dict = new dictionary();
|
|
dict.put("pathAction", "patrol_path");
|
|
dict.put("pathName", "toWatto");
|
|
messageTo(npc, "doPathAction", dict, 0.0f, false);
|
|
}
|
|
|
|
// ======================================================================
|
|
// Script %TO Tokens
|
|
// ======================================================================
|
|
|
|
// ======================================================================
|
|
// Script %DI Tokens
|
|
// ======================================================================
|
|
|
|
// ======================================================================
|
|
// Script %DF Tokens
|
|
// ======================================================================
|
|
|
|
// ======================================================================
|
|
// handleBranch<n> Functions
|
|
// ======================================================================
|
|
|
|
int tusken_expert_handleBranch2 (obj_id player, obj_id npc, string_id response)
|
|
{
|
|
//-- [BRANCH NOTE]
|
|
//-- NPC: Thank goodness you are here, what should I do?
|
|
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: The cloning center needs to get back on line.
|
|
if (response == "s_22")
|
|
{
|
|
//-- [NOTE]
|
|
if (tusken_expert_condition__defaultCondition (player, npc))
|
|
{
|
|
tusken_expert_action_goToCloning (player, npc);
|
|
|
|
//-- NPC: I'm on my way.
|
|
string_id message = new string_id (c_stringFile, "s_24");
|
|
utils.removeScriptVar (player, "conversation.tusken_expert.branchId");
|
|
|
|
npcEndConversationWithMessage (player, message);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
}
|
|
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: Get to the medical center, find a stimpack and start making yourself useful.
|
|
if (response == "s_14")
|
|
{
|
|
//-- [NOTE]
|
|
if (tusken_expert_condition__defaultCondition (player, npc))
|
|
{
|
|
tusken_expert_action_goToMedicalCenter (player, npc);
|
|
|
|
//-- NPC: I'm on my way.
|
|
string_id message = new string_id (c_stringFile, "s_16");
|
|
utils.removeScriptVar (player, "conversation.tusken_expert.branchId");
|
|
|
|
npcEndConversationWithMessage (player, message);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
}
|
|
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: Go to the university, we need to know everything about these tuskens immediately.
|
|
if (response == "s_11")
|
|
{
|
|
//-- [NOTE]
|
|
if (tusken_expert_condition__defaultCondition (player, npc))
|
|
{
|
|
tusken_expert_action_goToUniversity (player, npc);
|
|
|
|
//-- NPC: I'm on my way.
|
|
string_id message = new string_id (c_stringFile, "s_13");
|
|
utils.removeScriptVar (player, "conversation.tusken_expert.branchId");
|
|
|
|
npcEndConversationWithMessage (player, message);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
}
|
|
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: It's the combat hall for you.
|
|
if (response == "s_26")
|
|
{
|
|
//-- [NOTE]
|
|
if (tusken_expert_condition__defaultCondition (player, npc))
|
|
{
|
|
tusken_expert_action_goToCombat (player, npc);
|
|
|
|
//-- NPC: I'm on my way.
|
|
string_id message = new string_id (c_stringFile, "s_28");
|
|
utils.removeScriptVar (player, "conversation.tusken_expert.branchId");
|
|
|
|
npcEndConversationWithMessage (player, message);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
}
|
|
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: If you know you way around a droid, then head on over to Watto's junk shop.
|
|
if (response == "s_19")
|
|
{
|
|
//-- [NOTE]
|
|
if (tusken_expert_condition__defaultCondition (player, npc))
|
|
{
|
|
tusken_expert_action_goToWatto (player, npc);
|
|
|
|
//-- NPC: I'm on my way.
|
|
string_id message = new string_id (c_stringFile, "s_21");
|
|
utils.removeScriptVar (player, "conversation.tusken_expert.branchId");
|
|
|
|
npcEndConversationWithMessage (player, message);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
}
|
|
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: We need a flight crew at the starport, get there.
|
|
if (response == "s_25")
|
|
{
|
|
//-- [NOTE]
|
|
if (tusken_expert_condition__defaultCondition (player, npc))
|
|
{
|
|
tusken_expert_action_goToStarport (player, npc);
|
|
|
|
//-- NPC: I'm on my way.
|
|
string_id message = new string_id (c_stringFile, "s_30");
|
|
utils.removeScriptVar (player, "conversation.tusken_expert.branchId");
|
|
|
|
npcEndConversationWithMessage (player, message);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
}
|
|
|
|
return SCRIPT_DEFAULT;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
// ======================================================================
|
|
// User Script Triggers
|
|
// ======================================================================
|
|
|
|
trigger OnInitialize ()
|
|
{
|
|
if ((!isTangible (self)) || (isPlayer (self)))
|
|
detachScript(self, "conversation.tusken_expert");
|
|
|
|
setCondition (self, CONDITION_CONVERSABLE);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
trigger OnAttach ()
|
|
{
|
|
setCondition (self, CONDITION_CONVERSABLE);
|
|
setTriggerVolume(self);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
trigger OnTriggerVolumeEntered(string volumeName, obj_id breacher)
|
|
{
|
|
if (volumeName.equals("tusken_citizen"))
|
|
{
|
|
if (factions.getFaction(breacher).equals("heroic_tusken"))
|
|
{
|
|
addHate(breacher, self, 1000.0f);
|
|
}
|
|
}
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
void setTriggerVolume(obj_id self)
|
|
{
|
|
createTriggerVolume("tusken_citizen", 6.0f, true);
|
|
}
|
|
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.tusken_expert");
|
|
|
|
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 (tusken_expert_condition_allBuildingsHaveCrews (player, npc))
|
|
{
|
|
//-- NPC: Looks like you have all of the expert assistance you need. I'm going to go find someplace to hide.
|
|
string_id message = new string_id (c_stringFile, "s_29");
|
|
chat.chat (npc, player, message);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//-- [NOTE]
|
|
if (tusken_expert_condition__defaultCondition (player, npc))
|
|
{
|
|
//-- NPC: Thank goodness you are here, what should I do?
|
|
string_id message = new string_id (c_stringFile, "s_5");
|
|
int numberOfResponses = 0;
|
|
|
|
boolean hasResponse = false;
|
|
|
|
//-- PLAYER: The cloning center needs to get back on line.
|
|
boolean hasResponse0 = false;
|
|
if (tusken_expert_condition_clonecenterNeedsCrew (player, npc))
|
|
{
|
|
++numberOfResponses;
|
|
hasResponse = true;
|
|
hasResponse0 = true;
|
|
}
|
|
|
|
//-- PLAYER: Get to the medical center, find a stimpack and start making yourself useful.
|
|
boolean hasResponse1 = false;
|
|
if (tusken_expert_condition_medcenterNeedsCrew (player, npc))
|
|
{
|
|
++numberOfResponses;
|
|
hasResponse = true;
|
|
hasResponse1 = true;
|
|
}
|
|
|
|
//-- PLAYER: Go to the university, we need to know everything about these tuskens immediately.
|
|
boolean hasResponse2 = false;
|
|
if (tusken_expert_condition_universityNeedsCrew (player, npc))
|
|
{
|
|
++numberOfResponses;
|
|
hasResponse = true;
|
|
hasResponse2 = true;
|
|
}
|
|
|
|
//-- PLAYER: It's the combat hall for you.
|
|
boolean hasResponse3 = false;
|
|
if (tusken_expert_condition_combathallNeedsCrew (player, npc))
|
|
{
|
|
++numberOfResponses;
|
|
hasResponse = true;
|
|
hasResponse3 = true;
|
|
}
|
|
|
|
//-- PLAYER: If you know you way around a droid, then head on over to Watto's junk shop.
|
|
boolean hasResponse4 = false;
|
|
if (tusken_expert_condition_wattoNeedsCrew (player, npc))
|
|
{
|
|
++numberOfResponses;
|
|
hasResponse = true;
|
|
hasResponse4 = true;
|
|
}
|
|
|
|
//-- PLAYER: We need a flight crew at the starport, get there.
|
|
boolean hasResponse5 = false;
|
|
if (tusken_expert_condition_starportNeedsCrew (player, npc))
|
|
{
|
|
++numberOfResponses;
|
|
hasResponse = true;
|
|
hasResponse5 = true;
|
|
}
|
|
|
|
if (hasResponse)
|
|
{
|
|
int responseIndex = 0;
|
|
string_id responses [] = new string_id [numberOfResponses];
|
|
|
|
if (hasResponse0)
|
|
responses [responseIndex++] = new string_id (c_stringFile, "s_22");
|
|
|
|
if (hasResponse1)
|
|
responses [responseIndex++] = new string_id (c_stringFile, "s_14");
|
|
|
|
if (hasResponse2)
|
|
responses [responseIndex++] = new string_id (c_stringFile, "s_11");
|
|
|
|
if (hasResponse3)
|
|
responses [responseIndex++] = new string_id (c_stringFile, "s_26");
|
|
|
|
if (hasResponse4)
|
|
responses [responseIndex++] = new string_id (c_stringFile, "s_19");
|
|
|
|
if (hasResponse5)
|
|
responses [responseIndex++] = new string_id (c_stringFile, "s_25");
|
|
|
|
utils.setScriptVar (player, "conversation.tusken_expert.branchId", 2);
|
|
|
|
npcStartConversation (player, npc, "tusken_expert", 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 != "tusken_expert")
|
|
return SCRIPT_CONTINUE;
|
|
|
|
obj_id npc = self;
|
|
|
|
int branchId = utils.getIntScriptVar (player, "conversation.tusken_expert.branchId");
|
|
|
|
if (branchId == 2 && tusken_expert_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.tusken_expert.branchId");
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
// ======================================================================
|
|
|