mirror of
https://github.com/SWG-Source/dsrc.git
synced 2026-07-31 00:15:54 -04:00
562 lines
16 KiB
Plaintext
562 lines
16 KiB
Plaintext
// ======================================================================
|
|
//
|
|
// ep3_quest_template.script
|
|
//
|
|
//
|
|
//
|
|
// Created with SwgConversationEditor 1.29 - 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/ep3_quest_template";
|
|
|
|
// ======================================================================
|
|
// Script Conditions
|
|
// ======================================================================
|
|
|
|
boolean ep3_quest_template_condition__defaultCondition (obj_id player, obj_id npc)
|
|
{
|
|
return true;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
boolean ep3_quest_template_condition_hasCompletedAllQuests (obj_id player, obj_id npc)
|
|
{
|
|
// Returns TRUE of these quests are complete
|
|
return (groundquests.hasCompletedQuest(player, "ep3_neutral_sera_kill_10_wookiee") ||
|
|
groundquests.hasCompletedQuest(player, "ep3_neutral_sera_collect_wrhisch_liver"));
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
boolean ep3_quest_template_condition_hasCompletedQuestOne (obj_id player, obj_id npc)
|
|
{
|
|
// Returns TRUE of this quest is complete
|
|
return (groundquests.hasCompletedQuest(player, "ep3_neutral_sera_collect_wrhisch_liver"));
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
boolean ep3_quest_template_condition_hasCompletedQuestTwo (obj_id player, obj_id npc)
|
|
{
|
|
// Returns TRUE of this quest is complete
|
|
return (groundquests.hasCompletedQuest(player, "ep3_neutral_sera_kill_10_wookiee"));
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
boolean ep3_quest_template_condition_isOnQuestOne (obj_id player, obj_id npc)
|
|
{
|
|
// Returns TRUE if the quest is active on the player
|
|
return (groundquests.isQuestActive(player, "ep3_neutral_sera_collect_wrhisch_liver"));
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
boolean ep3_quest_template_condition_isOnQuestTwo (obj_id player, obj_id npc)
|
|
{
|
|
// Returns TRUE if the quest is active on the player
|
|
return (groundquests.isQuestActive(player, "ep3_neutral_sera_kill_10_wookiee"));
|
|
}
|
|
|
|
// ======================================================================
|
|
// Script Actions
|
|
// ======================================================================
|
|
|
|
void ep3_quest_template_action_grantQuestOne (obj_id player, obj_id npc)
|
|
{
|
|
groundquests.grantQuest(player, "ep3_neutral_sera_collect_wrhisch_liver");
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
void ep3_quest_template_action_grantQuestTwo (obj_id player, obj_id npc)
|
|
{
|
|
groundquests.grantQuest(player, "ep3_neutral_sera_kill_10_wookiee");
|
|
}
|
|
|
|
// ======================================================================
|
|
// Script %TO Tokens
|
|
// ======================================================================
|
|
|
|
// ======================================================================
|
|
// Script %DI Tokens
|
|
// ======================================================================
|
|
|
|
// ======================================================================
|
|
// Script %DF Tokens
|
|
// ======================================================================
|
|
|
|
// ======================================================================
|
|
// handleBranch<n> Functions
|
|
// ======================================================================
|
|
|
|
int ep3_quest_template_handleBranch2 (obj_id player, obj_id npc, string_id response)
|
|
{
|
|
//-- [BRANCH NOTE]
|
|
//-- NPC: You are on my second quest. You're not done yet.
|
|
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: You're right. I'm on my way.
|
|
if (response == "s_253")
|
|
{
|
|
//-- [NOTE]
|
|
if (ep3_quest_template_condition__defaultCondition (player, npc))
|
|
{
|
|
//-- NPC: Thanks!
|
|
string_id message = new string_id (c_stringFile, "s_255");
|
|
utils.removeScriptVar (player, "conversation.ep3_quest_template.branchId");
|
|
|
|
chat.chat (npc, player, message);
|
|
npcEndConversation (player);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
}
|
|
|
|
return SCRIPT_DEFAULT;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
int ep3_quest_template_handleBranch4 (obj_id player, obj_id npc, string_id response)
|
|
{
|
|
//-- [BRANCH NOTE]
|
|
//-- NPC: You have not finished my second quest, but you have finished my first quest. Do you want the second one?
|
|
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: (Affirmative response)
|
|
if (response == "s_244")
|
|
{
|
|
//-- [NOTE]
|
|
if (ep3_quest_template_condition__defaultCondition (player, npc))
|
|
{
|
|
//-- NPC: Great! Then here is my second quest. See you later!
|
|
string_id message = new string_id (c_stringFile, "s_246");
|
|
utils.removeScriptVar (player, "conversation.ep3_quest_template.branchId");
|
|
|
|
chat.chat (npc, player, message);
|
|
npcEndConversation (player);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
}
|
|
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: (Negative response)
|
|
if (response == "s_248")
|
|
{
|
|
//-- [NOTE]
|
|
if (ep3_quest_template_condition__defaultCondition (player, npc))
|
|
{
|
|
//-- NPC: Fine. See you!
|
|
string_id message = new string_id (c_stringFile, "s_250");
|
|
utils.removeScriptVar (player, "conversation.ep3_quest_template.branchId");
|
|
|
|
chat.chat (npc, player, message);
|
|
npcEndConversation (player);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
}
|
|
|
|
return SCRIPT_DEFAULT;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
int ep3_quest_template_handleBranch7 (obj_id player, obj_id npc, string_id response)
|
|
{
|
|
//-- [BRANCH NOTE]
|
|
//-- NPC: You are on my first quest. You're not done yet.
|
|
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: You're right. I'm on my way.
|
|
if (response == "s_240")
|
|
{
|
|
//-- [NOTE]
|
|
if (ep3_quest_template_condition__defaultCondition (player, npc))
|
|
{
|
|
//-- NPC: Thanks!
|
|
string_id message = new string_id (c_stringFile, "s_241");
|
|
utils.removeScriptVar (player, "conversation.ep3_quest_template.branchId");
|
|
|
|
chat.chat (npc, player, message);
|
|
npcEndConversation (player);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
}
|
|
|
|
return SCRIPT_DEFAULT;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
int ep3_quest_template_handleBranch9 (obj_id player, obj_id npc, string_id response)
|
|
{
|
|
//-- [BRANCH NOTE]
|
|
//-- NPC: You have not completed my first quest. Would you like to work for me?
|
|
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: (Affirmative response)
|
|
if (response == "s_235")
|
|
{
|
|
//-- [NOTE]
|
|
if (ep3_quest_template_condition__defaultCondition (player, npc))
|
|
{
|
|
//-- NPC: Great! Then here is my first quest. See you later!
|
|
string_id message = new string_id (c_stringFile, "s_238");
|
|
utils.removeScriptVar (player, "conversation.ep3_quest_template.branchId");
|
|
|
|
chat.chat (npc, player, message);
|
|
npcEndConversation (player);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
}
|
|
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: (Negative response)
|
|
if (response == "s_236")
|
|
{
|
|
//-- [NOTE]
|
|
if (ep3_quest_template_condition__defaultCondition (player, npc))
|
|
{
|
|
//-- NPC: Fine. See you!
|
|
string_id message = new string_id (c_stringFile, "s_237");
|
|
utils.removeScriptVar (player, "conversation.ep3_quest_template.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.ep3_quest_template");
|
|
|
|
setCondition (self, CONDITION_CONVERSABLE);
|
|
setInvulnerable (self, true);
|
|
setName (self, "My Name");
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
trigger OnAttach ()
|
|
{
|
|
setCondition (self, CONDITION_CONVERSABLE);
|
|
setInvulnerable (self, true);
|
|
setName (self, "My Name");
|
|
|
|
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.ep3_quest_template");
|
|
|
|
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 (ep3_quest_template_condition_hasCompletedAllQuests (player, npc))
|
|
{
|
|
//-- NPC: You have completed all of my quests!
|
|
string_id message = new string_id (c_stringFile, "s_256");
|
|
chat.chat (npc, player, message);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//-- [NOTE]
|
|
if (ep3_quest_template_condition_isOnQuestTwo (player, npc))
|
|
{
|
|
//-- NPC: You are on my second quest. You're not done yet.
|
|
string_id message = new string_id (c_stringFile, "s_251");
|
|
int numberOfResponses = 0;
|
|
|
|
boolean hasResponse = false;
|
|
|
|
//-- PLAYER: You're right. I'm on my way.
|
|
boolean hasResponse0 = false;
|
|
if (ep3_quest_template_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_253");
|
|
|
|
utils.setScriptVar (player, "conversation.ep3_quest_template.branchId", 2);
|
|
|
|
npcStartConversation (player, npc, "ep3_quest_template", message, responses);
|
|
}
|
|
else
|
|
{
|
|
chat.chat (npc, player, message);
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//-- [NOTE]
|
|
if (!ep3_quest_template_condition_hasCompletedQuestTwo (player, npc))
|
|
{
|
|
//-- NPC: You have not finished my second quest, but you have finished my first quest. Do you want the second one?
|
|
string_id message = new string_id (c_stringFile, "s_242");
|
|
int numberOfResponses = 0;
|
|
|
|
boolean hasResponse = false;
|
|
|
|
//-- PLAYER: (Affirmative response)
|
|
boolean hasResponse0 = false;
|
|
if (ep3_quest_template_condition__defaultCondition (player, npc))
|
|
{
|
|
++numberOfResponses;
|
|
hasResponse = true;
|
|
hasResponse0 = true;
|
|
}
|
|
|
|
//-- PLAYER: (Negative response)
|
|
boolean hasResponse1 = false;
|
|
if (ep3_quest_template_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_244");
|
|
|
|
if (hasResponse1)
|
|
responses [responseIndex++] = new string_id (c_stringFile, "s_248");
|
|
|
|
utils.setScriptVar (player, "conversation.ep3_quest_template.branchId", 4);
|
|
|
|
npcStartConversation (player, npc, "ep3_quest_template", message, responses);
|
|
}
|
|
else
|
|
{
|
|
chat.chat (npc, player, message);
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//-- [NOTE]
|
|
if (ep3_quest_template_condition_isOnQuestOne (player, npc))
|
|
{
|
|
//-- NPC: You are on my first quest. You're not done yet.
|
|
string_id message = new string_id (c_stringFile, "s_239");
|
|
int numberOfResponses = 0;
|
|
|
|
boolean hasResponse = false;
|
|
|
|
//-- PLAYER: You're right. I'm on my way.
|
|
boolean hasResponse0 = false;
|
|
if (ep3_quest_template_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_240");
|
|
|
|
utils.setScriptVar (player, "conversation.ep3_quest_template.branchId", 7);
|
|
|
|
npcStartConversation (player, npc, "ep3_quest_template", message, responses);
|
|
}
|
|
else
|
|
{
|
|
chat.chat (npc, player, message);
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//-- [NOTE]
|
|
if (!ep3_quest_template_condition_hasCompletedAllQuests (player, npc))
|
|
{
|
|
doAnimationAction (npc, "greet");
|
|
|
|
//-- NPC: You have not completed my first quest. Would you like to work for me?
|
|
string_id message = new string_id (c_stringFile, "s_117");
|
|
int numberOfResponses = 0;
|
|
|
|
boolean hasResponse = false;
|
|
|
|
//-- PLAYER: (Affirmative response)
|
|
boolean hasResponse0 = false;
|
|
if (ep3_quest_template_condition__defaultCondition (player, npc))
|
|
{
|
|
++numberOfResponses;
|
|
hasResponse = true;
|
|
hasResponse0 = true;
|
|
}
|
|
|
|
//-- PLAYER: (Negative response)
|
|
boolean hasResponse1 = false;
|
|
if (ep3_quest_template_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_235");
|
|
|
|
if (hasResponse1)
|
|
responses [responseIndex++] = new string_id (c_stringFile, "s_236");
|
|
|
|
utils.setScriptVar (player, "conversation.ep3_quest_template.branchId", 9);
|
|
|
|
npcStartConversation (player, npc, "ep3_quest_template", message, responses);
|
|
}
|
|
else
|
|
{
|
|
chat.chat (npc, player, message);
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//-- [NOTE]
|
|
if (ep3_quest_template_condition__defaultCondition (player, npc))
|
|
{
|
|
//-- NPC: Default Branch - I have nothing else to say.
|
|
string_id message = new string_id (c_stringFile, "s_234");
|
|
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 != "ep3_quest_template")
|
|
return SCRIPT_CONTINUE;
|
|
|
|
obj_id npc = self;
|
|
|
|
int branchId = utils.getIntScriptVar (player, "conversation.ep3_quest_template.branchId");
|
|
|
|
if (branchId == 2 && ep3_quest_template_handleBranch2 (player, npc, response) == SCRIPT_CONTINUE)
|
|
return SCRIPT_CONTINUE;
|
|
|
|
if (branchId == 4 && ep3_quest_template_handleBranch4 (player, npc, response) == SCRIPT_CONTINUE)
|
|
return SCRIPT_CONTINUE;
|
|
|
|
if (branchId == 7 && ep3_quest_template_handleBranch7 (player, npc, response) == SCRIPT_CONTINUE)
|
|
return SCRIPT_CONTINUE;
|
|
|
|
if (branchId == 9 && ep3_quest_template_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.ep3_quest_template.branchId");
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
// ======================================================================
|
|
|