mirror of
https://github.com/SWG-Source/dsrc.git
synced 2026-07-31 00:15:54 -04:00
392 lines
11 KiB
Plaintext
392 lines
11 KiB
Plaintext
// ======================================================================
|
|
//
|
|
// emp_day_vader.script
|
|
// Copyright 2004, Sony Online Entertainment
|
|
// All Rights Reserved.
|
|
//
|
|
// Created with SwgConversationEditor 1.30 - 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/emp_day_vader";
|
|
|
|
// ======================================================================
|
|
// Script Conditions
|
|
// ======================================================================
|
|
|
|
boolean emp_day_vader_condition__defaultCondition (obj_id player, obj_id npc)
|
|
{
|
|
return true;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
boolean emp_day_vader_condition_hasTask7 (obj_id player, obj_id npc)
|
|
{
|
|
int questId = questGetQuestId("quest/emp_day_imperial");
|
|
int task7 = groundquests.getTaskId(questId, "toVader");
|
|
return questIsTaskActive(questId, task7, player);
|
|
}
|
|
|
|
// ======================================================================
|
|
// Script Actions
|
|
// ======================================================================
|
|
|
|
void emp_day_vader_action_signal7 (obj_id player, obj_id npc)
|
|
{
|
|
groundquests.sendSignal(player, "to_vader");
|
|
sendSystemMessage(player, new string_id("event/empire_day", "sys_msg_return"));
|
|
}
|
|
|
|
// ======================================================================
|
|
// Script %TO Tokens
|
|
// ======================================================================
|
|
|
|
// ======================================================================
|
|
// Script %DI Tokens
|
|
// ======================================================================
|
|
|
|
// ======================================================================
|
|
// Script %DF Tokens
|
|
// ======================================================================
|
|
|
|
// ======================================================================
|
|
// handleBranch<n> Functions
|
|
// ======================================================================
|
|
|
|
int emp_day_vader_handleBranch1 (obj_id player, obj_id npc, string_id response)
|
|
{
|
|
//-- [BRANCH NOTE]
|
|
//-- NPC: Is that the report on the captured Jedi?
|
|
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: Yes, Lord Vader.
|
|
if (response == "s_1024")
|
|
{
|
|
//-- [NOTE]
|
|
if (emp_day_vader_condition__defaultCondition (player, npc))
|
|
{
|
|
//-- NPC: Very well...you are not part of this command, are you?
|
|
string_id message = new string_id (c_stringFile, "s_1026");
|
|
int numberOfResponses = 0;
|
|
|
|
boolean hasResponse = false;
|
|
|
|
//-- PLAYER: I'm just delivering historical data on the Jedi Council.
|
|
boolean hasResponse0 = false;
|
|
if (emp_day_vader_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_1028");
|
|
|
|
utils.setScriptVar (player, "conversation.emp_day_vader.branchId", 2);
|
|
|
|
npcSpeak (player, message);
|
|
npcSetConversationResponses (player, responses);
|
|
}
|
|
else
|
|
{
|
|
utils.removeScriptVar (player, "conversation.emp_day_vader.branchId");
|
|
|
|
chat.chat (npc, player, message);
|
|
npcEndConversation (player);
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
}
|
|
|
|
return SCRIPT_DEFAULT;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
int emp_day_vader_handleBranch2 (obj_id player, obj_id npc, string_id response)
|
|
{
|
|
//-- [BRANCH NOTE]
|
|
//-- NPC: Very well...you are not part of this command, are you?
|
|
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: I'm just delivering historical data on the Jedi Council.
|
|
if (response == "s_1028")
|
|
{
|
|
//-- [NOTE]
|
|
if (emp_day_vader_condition__defaultCondition (player, npc))
|
|
{
|
|
//-- NPC: Tell me, why did you join the Empire?
|
|
string_id message = new string_id (c_stringFile, "s_1030");
|
|
int numberOfResponses = 0;
|
|
|
|
boolean hasResponse = false;
|
|
|
|
//-- PLAYER: I believe in the galactic order and the rule of law.
|
|
boolean hasResponse0 = false;
|
|
if (emp_day_vader_condition__defaultCondition (player, npc))
|
|
{
|
|
++numberOfResponses;
|
|
hasResponse = true;
|
|
hasResponse0 = true;
|
|
}
|
|
|
|
//-- PLAYER: The Rebellion is responsible for the death of my parents.
|
|
boolean hasResponse1 = false;
|
|
if (emp_day_vader_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_1032");
|
|
|
|
if (hasResponse1)
|
|
responses [responseIndex++] = new string_id (c_stringFile, "s_1036");
|
|
|
|
utils.setScriptVar (player, "conversation.emp_day_vader.branchId", 3);
|
|
|
|
npcSpeak (player, message);
|
|
npcSetConversationResponses (player, responses);
|
|
}
|
|
else
|
|
{
|
|
utils.removeScriptVar (player, "conversation.emp_day_vader.branchId");
|
|
|
|
chat.chat (npc, player, message);
|
|
npcEndConversation (player);
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
}
|
|
|
|
return SCRIPT_DEFAULT;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
int emp_day_vader_handleBranch3 (obj_id player, obj_id npc, string_id response)
|
|
{
|
|
//-- [BRANCH NOTE]
|
|
//-- NPC: Tell me, why did you join the Empire?
|
|
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: I believe in the galactic order and the rule of law.
|
|
if (response == "s_1032")
|
|
{
|
|
emp_day_vader_action_signal7 (player, npc);
|
|
|
|
//-- [NOTE]
|
|
if (emp_day_vader_condition__defaultCondition (player, npc))
|
|
{
|
|
//-- NPC: The Empire relies on loyalists such as you to bring that law and order to the galaxy. Do not fail. Now leave me. I must study these documents more closely before I continue my interrogation.
|
|
string_id message = new string_id (c_stringFile, "s_1034");
|
|
utils.removeScriptVar (player, "conversation.emp_day_vader.branchId");
|
|
|
|
chat.chat (npc, player, message);
|
|
npcEndConversation (player);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
}
|
|
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: The Rebellion is responsible for the death of my parents.
|
|
if (response == "s_1036")
|
|
{
|
|
emp_day_vader_action_signal7 (player, npc);
|
|
|
|
//-- [NOTE]
|
|
if (emp_day_vader_condition__defaultCondition (player, npc))
|
|
{
|
|
//-- NPC: Such stories are more commonplace than most would admit. But soon the Rebellion will be no more because of loyal soldiers such as yourself. Leave me. I must study these documents more closely before I continue my interrogation.
|
|
string_id message = new string_id (c_stringFile, "s_1038");
|
|
utils.removeScriptVar (player, "conversation.emp_day_vader.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.emp_day_vader");
|
|
|
|
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.emp_day_vader");
|
|
|
|
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 (emp_day_vader_condition_hasTask7 (player, npc))
|
|
{
|
|
//-- NPC: Is that the report on the captured Jedi?
|
|
string_id message = new string_id (c_stringFile, "s_1022");
|
|
int numberOfResponses = 0;
|
|
|
|
boolean hasResponse = false;
|
|
|
|
//-- PLAYER: Yes, Lord Vader.
|
|
boolean hasResponse0 = false;
|
|
if (emp_day_vader_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_1024");
|
|
|
|
utils.setScriptVar (player, "conversation.emp_day_vader.branchId", 1);
|
|
|
|
npcStartConversation (player, npc, "emp_day_vader", message, responses);
|
|
}
|
|
else
|
|
{
|
|
chat.chat (npc, player, message);
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//-- [NOTE]
|
|
if (emp_day_vader_condition__defaultCondition (player, npc))
|
|
{
|
|
//-- NPC: Leave me.
|
|
string_id message = new string_id (c_stringFile, "s_1040");
|
|
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 != "emp_day_vader")
|
|
return SCRIPT_CONTINUE;
|
|
|
|
obj_id npc = self;
|
|
|
|
int branchId = utils.getIntScriptVar (player, "conversation.emp_day_vader.branchId");
|
|
|
|
if (branchId == 1 && emp_day_vader_handleBranch1 (player, npc, response) == SCRIPT_CONTINUE)
|
|
return SCRIPT_CONTINUE;
|
|
|
|
if (branchId == 2 && emp_day_vader_handleBranch2 (player, npc, response) == SCRIPT_CONTINUE)
|
|
return SCRIPT_CONTINUE;
|
|
|
|
if (branchId == 3 && emp_day_vader_handleBranch3 (player, npc, response) == SCRIPT_CONTINUE)
|
|
return SCRIPT_CONTINUE;
|
|
|
|
chat.chat (npc, "Error: Fell through all branches and responses for OnNpcConversationResponse.");
|
|
|
|
utils.removeScriptVar (player, "conversation.emp_day_vader.branchId");
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
// ======================================================================
|
|
|