mirror of
https://bitbucket.org/seefoe/dsrc.git
synced 2026-07-31 01:15:55 -04:00
493 lines
14 KiB
Plaintext
493 lines
14 KiB
Plaintext
// ======================================================================
|
|
//
|
|
// padawan_architect_01.script
|
|
//
|
|
//
|
|
//
|
|
// Created with SwgConversationEditor 1.34 - DO NOT EDIT THIS AUTO-GENERATED FILE!
|
|
//
|
|
// ======================================================================
|
|
|
|
// ======================================================================
|
|
// Library Includes
|
|
// ======================================================================
|
|
|
|
include library.ai_lib;
|
|
include library.chat;
|
|
include library.jedi_trials;
|
|
include library.utils;
|
|
|
|
// ======================================================================
|
|
// Script Constants
|
|
// ======================================================================
|
|
|
|
string c_stringFile = "conversation/padawan_architect_01";
|
|
|
|
// ======================================================================
|
|
// Script Conditions
|
|
// ======================================================================
|
|
|
|
boolean padawan_architect_01_condition__defaultCondition (obj_id player, obj_id npc)
|
|
{
|
|
return true;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
boolean padawan_architect_01_condition_isTrialPlayer (obj_id player, obj_id npc)
|
|
{
|
|
obj_id trialPlayer = getObjIdObjVar(npc, jedi_trials.PADAWAN_TRIAL_PLAYER_OBJVAR);
|
|
if ( player == trialPlayer )
|
|
{
|
|
string trialName = jedi_trials.getJediTrialName(player);
|
|
|
|
if ( trialName != null && trialName.equals("architect") )
|
|
{
|
|
return !hasObjVar(npc, "padawan_trials.playerFailed");
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
boolean padawan_architect_01_condition_wasTargetEliminated (obj_id player, obj_id npc)
|
|
{
|
|
obj_id trialPlayer = getObjIdObjVar(npc, jedi_trials.PADAWAN_TRIAL_PLAYER_OBJVAR);
|
|
if ( player == trialPlayer )
|
|
{
|
|
return hasObjVar(player, "jedi_trials.padawan_trials.temp.killedTarget");
|
|
}
|
|
return false;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
boolean padawan_architect_01_condition_wasTargetSpokenTo (obj_id player, obj_id npc)
|
|
{
|
|
obj_id trialPlayer = getObjIdObjVar(npc, jedi_trials.PADAWAN_TRIAL_PLAYER_OBJVAR);
|
|
if ( player == trialPlayer )
|
|
{
|
|
if ( hasObjVar(player, "jedi_trials.padawan_trials.temp.spokeToTarget_01") )
|
|
{
|
|
if ( !hasObjVar(player, "jedi_trials.padawan_trials.temp.killedTarget") )
|
|
{
|
|
return true;
|
|
}
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
boolean padawan_architect_01_condition_isOnNextStep (obj_id player, obj_id npc)
|
|
{
|
|
obj_id trialPlayer = getObjIdObjVar(npc, jedi_trials.PADAWAN_TRIAL_PLAYER_OBJVAR);
|
|
if ( player == trialPlayer )
|
|
{
|
|
return hasObjVar(player, "jedi_trials.padawan_trials.temp.acceptedTask");
|
|
}
|
|
return false;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
boolean padawan_architect_01_condition_completedSuccess (obj_id player, obj_id npc)
|
|
{
|
|
obj_id trialPlayer = getObjIdObjVar(npc, jedi_trials.PADAWAN_TRIAL_PLAYER_OBJVAR);
|
|
if ( player == trialPlayer )
|
|
{
|
|
string trialName = jedi_trials.getJediTrialName(player);
|
|
|
|
if ( trialName != null && !trialName.equals("architect") )
|
|
{
|
|
return hasObjVar(npc, "padawan_trials.playerSucceeded");
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
// ======================================================================
|
|
// Script Actions
|
|
// ======================================================================
|
|
|
|
void padawan_architect_01_action_questFailure (obj_id player, obj_id npc)
|
|
{
|
|
setObjVar(npc, "padawan_trials.playerFailed", true);
|
|
|
|
messageTo(player, "handleQuestFailure", null, 1, false);
|
|
return;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
void padawan_architect_01_action_questSuccess (obj_id player, obj_id npc)
|
|
{
|
|
setObjVar(npc, "padawan_trials.playerSucceeded", true);
|
|
|
|
messageTo(player, "handleTrialComplete", null, 1, false);
|
|
return;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
void padawan_architect_01_action_sendToNextNpc (obj_id player, obj_id npc)
|
|
{
|
|
setObjVar(npc, "padawan_trials.playerAccepted", true);
|
|
setObjVar(player, "jedi_trials.padawan_trials.temp.acceptedTask", true);
|
|
|
|
messageTo(player, "handleSetSecondLoc", null, 1, false);
|
|
return;
|
|
}
|
|
|
|
// ======================================================================
|
|
// Script %TO Tokens
|
|
// ======================================================================
|
|
|
|
// ======================================================================
|
|
// Script %DI Tokens
|
|
// ======================================================================
|
|
|
|
// ======================================================================
|
|
// Script %DF Tokens
|
|
// ======================================================================
|
|
|
|
// ======================================================================
|
|
// handleBranch<n> Functions
|
|
// ======================================================================
|
|
|
|
int padawan_architect_01_handleBranch2 (obj_id player, obj_id npc, string_id response)
|
|
{
|
|
//-- [BRANCH NOTE] After the player has spoken to, or killed the Jawa family.
|
|
//-- NPC: Is the area cleared?
|
|
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: Yes, it is. I'm proud to say that the gungan claiming to own the land is dead.
|
|
if (response == "s_f0d9878f")
|
|
{
|
|
//-- [NOTE] Quest Failed.
|
|
if (padawan_architect_01_condition__defaultCondition (player, npc))
|
|
{
|
|
doAnimationAction (npc, "laugh_cackle");
|
|
|
|
padawan_architect_01_action_questFailure (player, npc);
|
|
|
|
//-- NPC: I'm glad to hear that, construction can now begin. Thank you for your hard work.
|
|
string_id message = new string_id (c_stringFile, "s_50bf04b1");
|
|
utils.removeScriptVar (player, "conversation.padawan_architect_01.branchId");
|
|
|
|
chat.chat (npc, player, message);
|
|
npcEndConversation (player);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
}
|
|
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: That land already has an owner. You have no right to take it from them.
|
|
if (response == "s_88ac3394")
|
|
{
|
|
//-- [NOTE]
|
|
if (padawan_architect_01_condition__defaultCondition (player, npc))
|
|
{
|
|
doAnimationAction (npc, "shake_head_disgust");
|
|
|
|
padawan_architect_01_action_questSuccess (player, npc);
|
|
|
|
//-- NPC: An owner?! That family may occupy that land, but I am it's owner. Your sympathy is sickening.
|
|
string_id message = new string_id (c_stringFile, "s_8bf180e7");
|
|
utils.removeScriptVar (player, "conversation.padawan_architect_01.branchId");
|
|
|
|
chat.chat (npc, player, message);
|
|
npcEndConversation (player);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
}
|
|
|
|
return SCRIPT_DEFAULT;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
int padawan_architect_01_handleBranch5 (obj_id player, obj_id npc, string_id response)
|
|
{
|
|
//-- [BRANCH NOTE] Padawan quest text.
|
|
//-- NPC: I have a quick job for you friend.
|
|
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: Sure, I'd be happy to help.
|
|
if (response == "s_a1ef941b")
|
|
{
|
|
doAnimationAction (player, "nod_head_once");
|
|
|
|
//-- [NOTE]
|
|
if (padawan_architect_01_condition__defaultCondition (player, npc))
|
|
{
|
|
doAnimationAction (npc, "pose_proudly");
|
|
|
|
padawan_architect_01_action_sendToNextNpc (player, npc);
|
|
|
|
//-- NPC: Excellent, thank you very much. I do appreciate this. Here is a waypoint to the location I need you to scout out. Please remove any squatters who are loitering there.
|
|
string_id message = new string_id (c_stringFile, "s_ea2c487d");
|
|
utils.removeScriptVar (player, "conversation.padawan_architect_01.branchId");
|
|
|
|
chat.chat (npc, player, message);
|
|
npcEndConversation (player);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
}
|
|
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: Stop! I'm not interested in your petty little problems.
|
|
if (response == "s_cc9db25e")
|
|
{
|
|
doAnimationAction (player, "slow_down");
|
|
|
|
padawan_architect_01_action_questFailure (player, npc);
|
|
|
|
//-- [NOTE]
|
|
if (padawan_architect_01_condition__defaultCondition (player, npc))
|
|
{
|
|
doAnimationAction (npc, "wave_finger_warning");
|
|
|
|
padawan_architect_01_action_questFailure (player, npc);
|
|
|
|
//-- NPC: Wha... if you do not wish to help, then so be it. But there is no call for being rude.
|
|
string_id message = new string_id (c_stringFile, "s_f2d3daf1");
|
|
utils.removeScriptVar (player, "conversation.padawan_architect_01.branchId");
|
|
|
|
chat.chat (npc, player, message);
|
|
npcEndConversation (player);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
}
|
|
|
|
return SCRIPT_DEFAULT;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
// ======================================================================
|
|
// User Script Triggers
|
|
// ======================================================================
|
|
|
|
trigger OnInitialize ()
|
|
{
|
|
if ((!isMob (self)) || (isPlayer (self)))
|
|
detachScript(self, "conversation.padawan_architect_01");
|
|
|
|
setCondition (self, CONDITION_CONVERSABLE);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
trigger OnAttach ()
|
|
{
|
|
setCondition (self, CONDITION_CONVERSABLE);
|
|
|
|
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.padawan_architect_01");
|
|
|
|
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 (padawan_architect_01_condition_completedSuccess (player, npc))
|
|
{
|
|
//-- NPC: Bah... I'll just find someone else who can clear that land for me. Leave me alone.
|
|
string_id message = new string_id (c_stringFile, "s_ac5709b0");
|
|
chat.chat (npc, player, message);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//-- [NOTE] After the player has spoken to, or killed the Jawa family.
|
|
if (padawan_architect_01_condition_isOnNextStep (player, npc))
|
|
{
|
|
//-- NPC: Is the area cleared?
|
|
string_id message = new string_id (c_stringFile, "s_91e6aa00");
|
|
int numberOfResponses = 0;
|
|
|
|
boolean hasResponse = false;
|
|
|
|
//-- PLAYER: Yes, it is. I'm proud to say that the gungan claiming to own the land is dead.
|
|
boolean hasResponse0 = false;
|
|
if (padawan_architect_01_condition_wasTargetEliminated (player, npc))
|
|
{
|
|
++numberOfResponses;
|
|
hasResponse = true;
|
|
hasResponse0 = true;
|
|
}
|
|
|
|
//-- PLAYER: That land already has an owner. You have no right to take it from them.
|
|
boolean hasResponse1 = false;
|
|
if (padawan_architect_01_condition_wasTargetSpokenTo (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_f0d9878f");
|
|
|
|
if (hasResponse1)
|
|
responses [responseIndex++] = new string_id (c_stringFile, "s_88ac3394");
|
|
|
|
utils.setScriptVar (player, "conversation.padawan_architect_01.branchId", 2);
|
|
|
|
npcStartConversation (player, npc, "padawan_architect_01", message, responses);
|
|
}
|
|
else
|
|
{
|
|
chat.chat (npc, player, message);
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//-- [NOTE] Padawan quest text.
|
|
if (padawan_architect_01_condition_isTrialPlayer (player, npc))
|
|
{
|
|
doAnimationAction (npc, "beckon");
|
|
|
|
//-- NPC: I have a quick job for you friend.
|
|
string_id message = new string_id (c_stringFile, "s_7637308a");
|
|
int numberOfResponses = 0;
|
|
|
|
boolean hasResponse = false;
|
|
|
|
//-- PLAYER: Sure, I'd be happy to help.
|
|
boolean hasResponse0 = false;
|
|
if (padawan_architect_01_condition__defaultCondition (player, npc))
|
|
{
|
|
++numberOfResponses;
|
|
hasResponse = true;
|
|
hasResponse0 = true;
|
|
}
|
|
|
|
//-- PLAYER: Stop! I'm not interested in your petty little problems.
|
|
boolean hasResponse1 = false;
|
|
if (padawan_architect_01_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_a1ef941b");
|
|
|
|
if (hasResponse1)
|
|
responses [responseIndex++] = new string_id (c_stringFile, "s_cc9db25e");
|
|
|
|
utils.setScriptVar (player, "conversation.padawan_architect_01.branchId", 5);
|
|
|
|
npcStartConversation (player, npc, "padawan_architect_01", message, responses);
|
|
}
|
|
else
|
|
{
|
|
chat.chat (npc, player, message);
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//-- [NOTE]
|
|
if (padawan_architect_01_condition__defaultCondition (player, npc))
|
|
{
|
|
doAnimationAction (npc, "check_wrist_device");
|
|
|
|
//-- NPC: Sorry friend... can't talk. I'm losing money every day we fail to begin construction.
|
|
string_id message = new string_id (c_stringFile, "s_25d34a1e");
|
|
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 != "padawan_architect_01")
|
|
return SCRIPT_CONTINUE;
|
|
|
|
obj_id npc = self;
|
|
|
|
int branchId = utils.getIntScriptVar (player, "conversation.padawan_architect_01.branchId");
|
|
|
|
if (branchId == 2 && padawan_architect_01_handleBranch2 (player, npc, response) == SCRIPT_CONTINUE)
|
|
return SCRIPT_CONTINUE;
|
|
|
|
if (branchId == 5 && padawan_architect_01_handleBranch5 (player, npc, response) == SCRIPT_CONTINUE)
|
|
return SCRIPT_CONTINUE;
|
|
|
|
chat.chat (npc, "Error: Fell through all branches and responses for OnNpcConversationResponse.");
|
|
|
|
utils.removeScriptVar (player, "conversation.padawan_architect_01.branchId");
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
// ======================================================================
|
|
|