mirror of
https://github.com/SWG-Source/dsrc.git
synced 2026-07-31 00:15:54 -04:00
619 lines
17 KiB
Plaintext
619 lines
17 KiB
Plaintext
// ======================================================================
|
|
//
|
|
// huffs_guard.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.groundquests;
|
|
include library.utils;
|
|
|
|
// ======================================================================
|
|
// Script Constants
|
|
// ======================================================================
|
|
|
|
string c_stringFile = "conversation/huffs_guard";
|
|
|
|
// ======================================================================
|
|
// Script Conditions
|
|
// ======================================================================
|
|
|
|
boolean huffs_guard_condition__defaultCondition (obj_id player, obj_id npc)
|
|
{
|
|
return true;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
boolean huffs_guard_condition_lookingForRifle (obj_id player, obj_id npc)
|
|
{
|
|
if (groundquests.isQuestActive (player, "quest/huffs_guard_rifle"))
|
|
{
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
boolean huffs_guard_condition_alreadyBroughtRifle (obj_id player, obj_id npc)
|
|
{
|
|
if (groundquests.hasCompletedQuest (player, "quest/huffs_guard_rifle"))
|
|
{
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
// ======================================================================
|
|
// Script Actions
|
|
// ======================================================================
|
|
|
|
void huffs_guard_action_grantHuffQuest (obj_id player, obj_id npc)
|
|
{
|
|
groundquests.grantQuest (player, "quest/huffs_guard_rifle");
|
|
}
|
|
|
|
// ======================================================================
|
|
// Script %TO Tokens
|
|
// ======================================================================
|
|
|
|
// ======================================================================
|
|
// Script %DI Tokens
|
|
// ======================================================================
|
|
|
|
// ======================================================================
|
|
// Script %DF Tokens
|
|
// ======================================================================
|
|
|
|
// ======================================================================
|
|
// handleBranch<n> Functions
|
|
// ======================================================================
|
|
|
|
int huffs_guard_handleBranch3 (obj_id player, obj_id npc, string_id response)
|
|
{
|
|
//-- [BRANCH NOTE]
|
|
//-- NPC: Sorry, no one gets in to see Mr. Darklighter.
|
|
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: How come no one gets in?
|
|
if (response == "s_10")
|
|
{
|
|
//-- [NOTE]
|
|
if (huffs_guard_condition__defaultCondition (player, npc))
|
|
{
|
|
//-- NPC: He's very upset about a Tusken Rifle. It was an antique, and someone's taken it off the planet. He wants to get it back, but isn't sure how to go about it.
|
|
string_id message = new string_id (c_stringFile, "s_12");
|
|
int numberOfResponses = 0;
|
|
|
|
boolean hasResponse = false;
|
|
|
|
//-- PLAYER: Where have you looked for the rifle?
|
|
boolean hasResponse0 = false;
|
|
if (huffs_guard_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_14");
|
|
|
|
utils.setScriptVar (player, "conversation.huffs_guard.branchId", 4);
|
|
|
|
npcSpeak (player, message);
|
|
npcSetConversationResponses (player, responses);
|
|
}
|
|
else
|
|
{
|
|
utils.removeScriptVar (player, "conversation.huffs_guard.branchId");
|
|
|
|
npcEndConversationWithMessage (player, message);
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
}
|
|
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: Who is Mr. Darklighter?
|
|
if (response == "s_26")
|
|
{
|
|
//-- [NOTE]
|
|
if (huffs_guard_condition__defaultCondition (player, npc))
|
|
{
|
|
//-- NPC: Huff Darklighter? The head of the Darklighter estate? He's only the biggest business magnate on Tatooine. Where have you been?
|
|
string_id message = new string_id (c_stringFile, "s_28");
|
|
int numberOfResponses = 0;
|
|
|
|
boolean hasResponse = false;
|
|
|
|
//-- PLAYER: Never heard of him.
|
|
boolean hasResponse0 = false;
|
|
if (huffs_guard_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_30");
|
|
|
|
utils.setScriptVar (player, "conversation.huffs_guard.branchId", 8);
|
|
|
|
npcSpeak (player, message);
|
|
npcSetConversationResponses (player, responses);
|
|
}
|
|
else
|
|
{
|
|
utils.removeScriptVar (player, "conversation.huffs_guard.branchId");
|
|
|
|
npcEndConversationWithMessage (player, message);
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
}
|
|
|
|
return SCRIPT_DEFAULT;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
int huffs_guard_handleBranch4 (obj_id player, obj_id npc, string_id response)
|
|
{
|
|
//-- [BRANCH NOTE]
|
|
//-- NPC: He's very upset about a Tusken Rifle. It was an antique, and someone's taken it off the planet. He wants to get it back, but isn't sure how to go about it.
|
|
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: Where have you looked for the rifle?
|
|
if (response == "s_14")
|
|
{
|
|
//-- [NOTE]
|
|
if (huffs_guard_condition__defaultCondition (player, npc))
|
|
{
|
|
//-- NPC: We've checked everywhere on Tatooine. Huff tried some of his contacts on Corellia but they were no help. Personally I think it's on Naboo.
|
|
string_id message = new string_id (c_stringFile, "s_16");
|
|
int numberOfResponses = 0;
|
|
|
|
boolean hasResponse = false;
|
|
|
|
//-- PLAYER: What do you know about the rifle?
|
|
boolean hasResponse0 = false;
|
|
if (huffs_guard_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_18");
|
|
|
|
utils.setScriptVar (player, "conversation.huffs_guard.branchId", 5);
|
|
|
|
npcSpeak (player, message);
|
|
npcSetConversationResponses (player, responses);
|
|
}
|
|
else
|
|
{
|
|
utils.removeScriptVar (player, "conversation.huffs_guard.branchId");
|
|
|
|
npcEndConversationWithMessage (player, message);
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
}
|
|
|
|
return SCRIPT_DEFAULT;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
int huffs_guard_handleBranch5 (obj_id player, obj_id npc, string_id response)
|
|
{
|
|
//-- [BRANCH NOTE]
|
|
//-- NPC: We've checked everywhere on Tatooine. Huff tried some of his contacts on Corellia but they were no help. Personally I think it's on Naboo.
|
|
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: What do you know about the rifle?
|
|
if (response == "s_18")
|
|
{
|
|
//-- [NOTE]
|
|
if (huffs_guard_condition__defaultCondition (player, npc))
|
|
{
|
|
//-- NPC: I hear some criminals got hold of it. The criminal element has lots to do with these things, when stuff disappears you know?
|
|
string_id message = new string_id (c_stringFile, "s_20");
|
|
int numberOfResponses = 0;
|
|
|
|
boolean hasResponse = false;
|
|
|
|
//-- PLAYER: Maybe I can find it for you.
|
|
boolean hasResponse0 = false;
|
|
if (huffs_guard_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_23");
|
|
|
|
utils.setScriptVar (player, "conversation.huffs_guard.branchId", 6);
|
|
|
|
npcSpeak (player, message);
|
|
npcSetConversationResponses (player, responses);
|
|
}
|
|
else
|
|
{
|
|
utils.removeScriptVar (player, "conversation.huffs_guard.branchId");
|
|
|
|
npcEndConversationWithMessage (player, message);
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
}
|
|
|
|
return SCRIPT_DEFAULT;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
int huffs_guard_handleBranch6 (obj_id player, obj_id npc, string_id response)
|
|
{
|
|
//-- [BRANCH NOTE]
|
|
//-- NPC: I hear some criminals got hold of it. The criminal element has lots to do with these things, when stuff disappears you know?
|
|
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: Maybe I can find it for you.
|
|
if (response == "s_23")
|
|
{
|
|
//-- [NOTE]
|
|
if (huffs_guard_condition__defaultCondition (player, npc))
|
|
{
|
|
huffs_guard_action_grantHuffQuest (player, npc);
|
|
|
|
//-- NPC: That would be fantastic. If I were you I'd start with Borvo the Hutt, on Naboo. He's sort of like Jabba, but not nearly as mean. He may know where it is.
|
|
string_id message = new string_id (c_stringFile, "s_24");
|
|
utils.removeScriptVar (player, "conversation.huffs_guard.branchId");
|
|
|
|
npcEndConversationWithMessage (player, message);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
}
|
|
|
|
return SCRIPT_DEFAULT;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
int huffs_guard_handleBranch8 (obj_id player, obj_id npc, string_id response)
|
|
{
|
|
//-- [BRANCH NOTE]
|
|
//-- NPC: Huff Darklighter? The head of the Darklighter estate? He's only the biggest business magnate on Tatooine. Where have you been?
|
|
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: Never heard of him.
|
|
if (response == "s_30")
|
|
{
|
|
//-- [NOTE]
|
|
if (huffs_guard_condition__defaultCondition (player, npc))
|
|
{
|
|
//-- NPC: Well, I suggest you take your head out of the sand and look around you.
|
|
string_id message = new string_id (c_stringFile, "s_32");
|
|
int numberOfResponses = 0;
|
|
|
|
boolean hasResponse = false;
|
|
|
|
//-- PLAYER: So, what's he so upset about?
|
|
boolean hasResponse0 = false;
|
|
if (huffs_guard_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_34");
|
|
|
|
utils.setScriptVar (player, "conversation.huffs_guard.branchId", 9);
|
|
|
|
npcSpeak (player, message);
|
|
npcSetConversationResponses (player, responses);
|
|
}
|
|
else
|
|
{
|
|
utils.removeScriptVar (player, "conversation.huffs_guard.branchId");
|
|
|
|
npcEndConversationWithMessage (player, message);
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
}
|
|
|
|
return SCRIPT_DEFAULT;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
int huffs_guard_handleBranch9 (obj_id player, obj_id npc, string_id response)
|
|
{
|
|
//-- [BRANCH NOTE]
|
|
//-- NPC: Well, I suggest you take your head out of the sand and look around you.
|
|
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: So, what's he so upset about?
|
|
if (response == "s_34")
|
|
{
|
|
//-- [NOTE]
|
|
if (huffs_guard_condition__defaultCondition (player, npc))
|
|
{
|
|
//-- NPC: He's very upset about a Tusken Rifle. It was an antique, and someone's taken it off the planet. He wants to get it back, but isn't sure how to go about it.
|
|
string_id message = new string_id (c_stringFile, "s_12");
|
|
int numberOfResponses = 0;
|
|
|
|
boolean hasResponse = false;
|
|
|
|
//-- PLAYER: Where have you looked for the rifle?
|
|
boolean hasResponse0 = false;
|
|
if (huffs_guard_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_14");
|
|
|
|
utils.setScriptVar (player, "conversation.huffs_guard.branchId", 4);
|
|
|
|
npcSpeak (player, message);
|
|
npcSetConversationResponses (player, responses);
|
|
}
|
|
else
|
|
{
|
|
utils.removeScriptVar (player, "conversation.huffs_guard.branchId");
|
|
|
|
npcEndConversationWithMessage (player, message);
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
}
|
|
|
|
return SCRIPT_DEFAULT;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
// ======================================================================
|
|
// User Script Triggers
|
|
// ======================================================================
|
|
|
|
trigger OnInitialize ()
|
|
{
|
|
if ((!isMob (self)) || (isPlayer (self)))
|
|
detachScript(self, "conversation.huffs_guard");
|
|
|
|
setCondition (self, CONDITION_CONVERSABLE);
|
|
setCondition(self, CONDITION_SPACE_INTERESTING);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
trigger OnAttach ()
|
|
{
|
|
setCondition (self, CONDITION_CONVERSABLE);
|
|
setCondition(self, CONDITION_SPACE_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.huffs_guard");
|
|
|
|
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 (huffs_guard_condition_alreadyBroughtRifle (player, npc))
|
|
{
|
|
//-- NPC: Hello, friend. Good work on finding Huff's rifle. You can go talk to Huff now.
|
|
string_id message = new string_id (c_stringFile, "s_4");
|
|
chat.chat (npc, player, message);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//-- [NOTE]
|
|
if (huffs_guard_condition_lookingForRifle (player, npc))
|
|
{
|
|
//-- NPC: I've told you already, you can't get in to see Huff until you bring me his grandfather's rifle. Just hand it to me when you have it.
|
|
string_id message = new string_id (c_stringFile, "s_6");
|
|
chat.chat (npc, player, message);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//-- [NOTE]
|
|
if (huffs_guard_condition__defaultCondition (player, npc))
|
|
{
|
|
//-- NPC: Sorry, no one gets in to see Mr. Darklighter.
|
|
string_id message = new string_id (c_stringFile, "s_8");
|
|
int numberOfResponses = 0;
|
|
|
|
boolean hasResponse = false;
|
|
|
|
//-- PLAYER: How come no one gets in?
|
|
boolean hasResponse0 = false;
|
|
if (huffs_guard_condition__defaultCondition (player, npc))
|
|
{
|
|
++numberOfResponses;
|
|
hasResponse = true;
|
|
hasResponse0 = true;
|
|
}
|
|
|
|
//-- PLAYER: Who is Mr. Darklighter?
|
|
boolean hasResponse1 = false;
|
|
if (huffs_guard_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_10");
|
|
|
|
if (hasResponse1)
|
|
responses [responseIndex++] = new string_id (c_stringFile, "s_26");
|
|
|
|
utils.setScriptVar (player, "conversation.huffs_guard.branchId", 3);
|
|
|
|
npcStartConversation (player, npc, "huffs_guard", 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 != "huffs_guard")
|
|
return SCRIPT_CONTINUE;
|
|
|
|
obj_id npc = self;
|
|
|
|
int branchId = utils.getIntScriptVar (player, "conversation.huffs_guard.branchId");
|
|
|
|
if (branchId == 3 && huffs_guard_handleBranch3 (player, npc, response) == SCRIPT_CONTINUE)
|
|
return SCRIPT_CONTINUE;
|
|
|
|
if (branchId == 4 && huffs_guard_handleBranch4 (player, npc, response) == SCRIPT_CONTINUE)
|
|
return SCRIPT_CONTINUE;
|
|
|
|
if (branchId == 5 && huffs_guard_handleBranch5 (player, npc, response) == SCRIPT_CONTINUE)
|
|
return SCRIPT_CONTINUE;
|
|
|
|
if (branchId == 6 && huffs_guard_handleBranch6 (player, npc, response) == SCRIPT_CONTINUE)
|
|
return SCRIPT_CONTINUE;
|
|
|
|
if (branchId == 8 && huffs_guard_handleBranch8 (player, npc, response) == SCRIPT_CONTINUE)
|
|
return SCRIPT_CONTINUE;
|
|
|
|
if (branchId == 9 && huffs_guard_handleBranch9 (player, npc, response) == SCRIPT_CONTINUE)
|
|
return SCRIPT_CONTINUE;
|
|
|
|
chat.chat (npc, "Error: Fell through all branches and responses for OnNpcConversationResponse.");
|
|
|
|
utils.removeScriptVar (player, "conversation.huffs_guard.branchId");
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
// ======================================================================
|
|
|