mirror of
https://github.com/SWG-Source/dsrc.git
synced 2026-10-05 21:12:59 -04:00
543 lines
16 KiB
Plaintext
543 lines
16 KiB
Plaintext
// ======================================================================
|
|
//
|
|
// tusken_kav_golder.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.instance;
|
|
include library.utils;
|
|
|
|
// ======================================================================
|
|
// Script Constants
|
|
// ======================================================================
|
|
|
|
string c_stringFile = "conversation/tusken_kav_golder";
|
|
|
|
// ======================================================================
|
|
// Script Conditions
|
|
// ======================================================================
|
|
|
|
boolean tusken_kav_golder_condition__defaultCondition (obj_id player, obj_id npc)
|
|
{
|
|
return true;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
boolean tusken_kav_golder_condition_inside (obj_id player, obj_id npc)
|
|
{
|
|
return getIntObjVar(npc, "phase") == 1;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
boolean tusken_kav_golder_condition_start_two (obj_id player, obj_id npc)
|
|
{
|
|
return getIntObjVar(npc, "phase") == 2;
|
|
}
|
|
|
|
// ======================================================================
|
|
// Script Actions
|
|
// ======================================================================
|
|
|
|
void tusken_kav_golder_action_exitInstance (obj_id player, obj_id npc)
|
|
{
|
|
instance.requestExitPlayer("heroic_tusken_army", player);
|
|
}
|
|
|
|
// ======================================================================
|
|
// Script %TO Tokens
|
|
// ======================================================================
|
|
|
|
// ======================================================================
|
|
// Script %DI Tokens
|
|
// ======================================================================
|
|
|
|
// ======================================================================
|
|
// Script %DF Tokens
|
|
// ======================================================================
|
|
|
|
// ======================================================================
|
|
// handleBranch<n> Functions
|
|
// ======================================================================
|
|
|
|
int tusken_kav_golder_handleBranch1 (obj_id player, obj_id npc, string_id response)
|
|
{
|
|
//-- [BRANCH NOTE]
|
|
//-- NPC: Now that we have our facilities back, we need to get them staffed up. Scattered calls for help are coming in from around town. I need you to get out there and get those people.
|
|
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: What do we do with them?
|
|
if (response == "s_13")
|
|
{
|
|
//-- [NOTE]
|
|
if (tusken_kav_golder_condition__defaultCondition (player, npc))
|
|
{
|
|
//-- NPC: Try to identify the key citizens, we need to get our facilities back up to speed. Lets hole everyone else up in the Hotel to wait out the storm.
|
|
string_id message = new string_id (c_stringFile, "s_14");
|
|
int numberOfResponses = 0;
|
|
|
|
boolean hasResponse = false;
|
|
|
|
//-- PLAYER: I am on my way.
|
|
boolean hasResponse0 = false;
|
|
if (tusken_kav_golder_condition__defaultCondition (player, npc))
|
|
{
|
|
++numberOfResponses;
|
|
hasResponse = true;
|
|
hasResponse0 = true;
|
|
}
|
|
|
|
//-- PLAYER: I need to get out of town, what is the quickest way out of here?
|
|
boolean hasResponse1 = false;
|
|
if (tusken_kav_golder_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_15");
|
|
|
|
if (hasResponse1)
|
|
responses [responseIndex++] = new string_id (c_stringFile, "s_26");
|
|
|
|
utils.setScriptVar (player, "conversation.tusken_kav_golder.branchId", 2);
|
|
|
|
npcSpeak (player, message);
|
|
npcSetConversationResponses (player, responses);
|
|
}
|
|
else
|
|
{
|
|
utils.removeScriptVar (player, "conversation.tusken_kav_golder.branchId");
|
|
|
|
npcEndConversationWithMessage (player, message);
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
}
|
|
|
|
return SCRIPT_DEFAULT;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
int tusken_kav_golder_handleBranch2 (obj_id player, obj_id npc, string_id response)
|
|
{
|
|
//-- [BRANCH NOTE]
|
|
//-- NPC: Try to identify the key citizens, we need to get our facilities back up to speed. Lets hole everyone else up in the Hotel to wait out the storm.
|
|
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: I am on my way.
|
|
if (response == "s_15")
|
|
{
|
|
//-- [NOTE]
|
|
if (tusken_kav_golder_condition__defaultCondition (player, npc))
|
|
{
|
|
//-- NPC: Try to hurry, this Tusken storm looks to get worse before it gets better.
|
|
string_id message = new string_id (c_stringFile, "s_16");
|
|
utils.removeScriptVar (player, "conversation.tusken_kav_golder.branchId");
|
|
|
|
npcEndConversationWithMessage (player, message);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
}
|
|
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: I need to get out of town, what is the quickest way out of here?
|
|
if (response == "s_26")
|
|
{
|
|
//-- [NOTE]
|
|
if (tusken_kav_golder_condition__defaultCondition (player, npc))
|
|
{
|
|
tusken_kav_golder_action_exitInstance (player, npc);
|
|
|
|
//-- NPC: Just head on out why don't you, not like there is an invasion or anything.
|
|
string_id message = new string_id (c_stringFile, "s_28");
|
|
utils.removeScriptVar (player, "conversation.tusken_kav_golder.branchId");
|
|
|
|
npcEndConversationWithMessage (player, message);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
}
|
|
|
|
return SCRIPT_DEFAULT;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
int tusken_kav_golder_handleBranch4 (obj_id player, obj_id npc, string_id response)
|
|
{
|
|
//-- [BRANCH NOTE]
|
|
//-- NPC: We need to hurry, I spied more Tusken columns coming over the dunes.
|
|
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: Should we take the fight to them?
|
|
if (response == "s_12")
|
|
{
|
|
//-- [NOTE]
|
|
if (tusken_kav_golder_condition__defaultCondition (player, npc))
|
|
{
|
|
//-- NPC: No. Our first concern is to fortify the city and get the citizens to safety. I have identified a number of key structures for you. Once we have them under control we can mount a proper defense.
|
|
string_id message = new string_id (c_stringFile, "s_18");
|
|
utils.removeScriptVar (player, "conversation.tusken_kav_golder.branchId");
|
|
|
|
npcEndConversationWithMessage (player, message);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
}
|
|
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: I need to get out of town, what is the quickest way out of here?
|
|
if (response == "s_27")
|
|
{
|
|
//-- [NOTE]
|
|
if (tusken_kav_golder_condition__defaultCondition (player, npc))
|
|
{
|
|
tusken_kav_golder_action_exitInstance (player, npc);
|
|
|
|
//-- NPC: Just head on out why don't you, not like there is an invasion or anything.
|
|
string_id message = new string_id (c_stringFile, "s_28");
|
|
utils.removeScriptVar (player, "conversation.tusken_kav_golder.branchId");
|
|
|
|
npcEndConversationWithMessage (player, message);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
}
|
|
|
|
return SCRIPT_DEFAULT;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
int tusken_kav_golder_handleBranch6 (obj_id player, obj_id npc, string_id response)
|
|
{
|
|
//-- [BRANCH NOTE]
|
|
//-- NPC: It is good that you are here but we might already be too late. The city is overrun and the citizens are in hiding.
|
|
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: What can we do?
|
|
if (response == "s_22")
|
|
{
|
|
//-- [NOTE]
|
|
if (tusken_kav_golder_condition__defaultCondition (player, npc))
|
|
{
|
|
//-- NPC: We are going to need a base of operations. Retake the Cantina in the center of town and we will move out from there.
|
|
string_id message = new string_id (c_stringFile, "s_24");
|
|
utils.removeScriptVar (player, "conversation.tusken_kav_golder.branchId");
|
|
|
|
npcEndConversationWithMessage (player, message);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
}
|
|
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: I need to get out of town, what is the quickest way out of here?
|
|
if (response == "s_25")
|
|
{
|
|
//-- [NOTE]
|
|
if (tusken_kav_golder_condition__defaultCondition (player, npc))
|
|
{
|
|
tusken_kav_golder_action_exitInstance (player, npc);
|
|
|
|
//-- NPC: Just head on out why don't you, not like there is an invasion or anything.
|
|
string_id message = new string_id (c_stringFile, "s_28");
|
|
utils.removeScriptVar (player, "conversation.tusken_kav_golder.branchId");
|
|
|
|
npcEndConversationWithMessage (player, message);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
}
|
|
|
|
return SCRIPT_DEFAULT;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
// ======================================================================
|
|
// User Script Triggers
|
|
// ======================================================================
|
|
|
|
trigger OnInitialize ()
|
|
{
|
|
if ((!isTangible (self)) || (isPlayer (self)))
|
|
detachScript(self, "conversation.tusken_kav_golder");
|
|
|
|
setCondition (self, CONDITION_CONVERSABLE);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
trigger OnAttach ()
|
|
{
|
|
setCondition (self, CONDITION_CONVERSABLE);
|
|
|
|
if (!isInvulnerable(self))
|
|
{
|
|
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", 9.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_kav_golder");
|
|
|
|
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_kav_golder_condition_start_two (player, npc))
|
|
{
|
|
//-- NPC: Now that we have our facilities back, we need to get them staffed up. Scattered calls for help are coming in from around town. I need you to get out there and get those people.
|
|
string_id message = new string_id (c_stringFile, "s_9");
|
|
int numberOfResponses = 0;
|
|
|
|
boolean hasResponse = false;
|
|
|
|
//-- PLAYER: What do we do with them?
|
|
boolean hasResponse0 = false;
|
|
if (tusken_kav_golder_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_13");
|
|
|
|
utils.setScriptVar (player, "conversation.tusken_kav_golder.branchId", 1);
|
|
|
|
npcStartConversation (player, npc, "tusken_kav_golder", message, responses);
|
|
}
|
|
else
|
|
{
|
|
chat.chat (npc, player, message);
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//-- [NOTE]
|
|
if (tusken_kav_golder_condition_inside (player, npc))
|
|
{
|
|
//-- NPC: We need to hurry, I spied more Tusken columns coming over the dunes.
|
|
string_id message = new string_id (c_stringFile, "s_10");
|
|
int numberOfResponses = 0;
|
|
|
|
boolean hasResponse = false;
|
|
|
|
//-- PLAYER: Should we take the fight to them?
|
|
boolean hasResponse0 = false;
|
|
if (tusken_kav_golder_condition__defaultCondition (player, npc))
|
|
{
|
|
++numberOfResponses;
|
|
hasResponse = true;
|
|
hasResponse0 = true;
|
|
}
|
|
|
|
//-- PLAYER: I need to get out of town, what is the quickest way out of here?
|
|
boolean hasResponse1 = false;
|
|
if (tusken_kav_golder_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_12");
|
|
|
|
if (hasResponse1)
|
|
responses [responseIndex++] = new string_id (c_stringFile, "s_27");
|
|
|
|
utils.setScriptVar (player, "conversation.tusken_kav_golder.branchId", 4);
|
|
|
|
npcStartConversation (player, npc, "tusken_kav_golder", message, responses);
|
|
}
|
|
else
|
|
{
|
|
chat.chat (npc, player, message);
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//-- [NOTE]
|
|
if (tusken_kav_golder_condition__defaultCondition (player, npc))
|
|
{
|
|
//-- NPC: It is good that you are here but we might already be too late. The city is overrun and the citizens are in hiding.
|
|
string_id message = new string_id (c_stringFile, "s_20");
|
|
int numberOfResponses = 0;
|
|
|
|
boolean hasResponse = false;
|
|
|
|
//-- PLAYER: What can we do?
|
|
boolean hasResponse0 = false;
|
|
if (tusken_kav_golder_condition__defaultCondition (player, npc))
|
|
{
|
|
++numberOfResponses;
|
|
hasResponse = true;
|
|
hasResponse0 = true;
|
|
}
|
|
|
|
//-- PLAYER: I need to get out of town, what is the quickest way out of here?
|
|
boolean hasResponse1 = false;
|
|
if (tusken_kav_golder_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_22");
|
|
|
|
if (hasResponse1)
|
|
responses [responseIndex++] = new string_id (c_stringFile, "s_25");
|
|
|
|
utils.setScriptVar (player, "conversation.tusken_kav_golder.branchId", 6);
|
|
|
|
npcStartConversation (player, npc, "tusken_kav_golder", 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_kav_golder")
|
|
return SCRIPT_CONTINUE;
|
|
|
|
obj_id npc = self;
|
|
|
|
int branchId = utils.getIntScriptVar (player, "conversation.tusken_kav_golder.branchId");
|
|
|
|
if (branchId == 1 && tusken_kav_golder_handleBranch1 (player, npc, response) == SCRIPT_CONTINUE)
|
|
return SCRIPT_CONTINUE;
|
|
|
|
if (branchId == 2 && tusken_kav_golder_handleBranch2 (player, npc, response) == SCRIPT_CONTINUE)
|
|
return SCRIPT_CONTINUE;
|
|
|
|
if (branchId == 4 && tusken_kav_golder_handleBranch4 (player, npc, response) == SCRIPT_CONTINUE)
|
|
return SCRIPT_CONTINUE;
|
|
|
|
if (branchId == 6 && tusken_kav_golder_handleBranch6 (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_kav_golder.branchId");
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
// ======================================================================
|
|
|