mirror of
https://bitbucket.org/seefoe/dsrc.git
synced 2026-07-31 01:15:55 -04:00
634 lines
18 KiB
Plaintext
634 lines
18 KiB
Plaintext
// ======================================================================
|
|
//
|
|
// itp_vader_main.script
|
|
//
|
|
//
|
|
//
|
|
// 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.groundquests;
|
|
include library.space_quest;
|
|
include library.utils;
|
|
|
|
// ======================================================================
|
|
// Script Constants
|
|
// ======================================================================
|
|
|
|
string c_stringFile = "conversation/itp_vader_main";
|
|
|
|
// ======================================================================
|
|
// Script Conditions
|
|
// ======================================================================
|
|
|
|
boolean itp_vader_main_condition__defaultCondition (obj_id player, obj_id npc)
|
|
{
|
|
return true;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
boolean itp_vader_main_condition_itp_vader_01_active (obj_id player, obj_id npc)
|
|
{
|
|
return groundquests.isQuestActive(player, "itp_vader_01");
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
boolean itp_vader_main_condition_itp_vader_01_complete (obj_id player, obj_id npc)
|
|
{
|
|
return groundquests.isTaskActive(player, "itp_vader_01", "itp_vader_01_04") ||
|
|
groundquests.hasCompletedQuest(player, "itp_vader_01");
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
boolean itp_vader_main_condition_itp_vader_02_active (obj_id player, obj_id npc)
|
|
{
|
|
return groundquests.isQuestActive(player, "itp_vader_02");
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
boolean itp_vader_main_condition_itp_vader_03_complete (obj_id player, obj_id npc)
|
|
{
|
|
return groundquests.isTaskActive(player, "itp_vader_03", "itp_vader_03_04") ||
|
|
groundquests.hasCompletedQuest(player, "itp_vader_03");
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
boolean itp_vader_main_condition_itp_vader_03_active (obj_id player, obj_id npc)
|
|
{
|
|
return groundquests.isQuestActive(player, "itp_vader_03");
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
boolean itp_vader_main_condition_itp_vader_02_complete (obj_id player, obj_id npc)
|
|
{
|
|
return groundquests.isTaskActive(player, "itp_vader_02", "itp_vader_02_05") ||
|
|
groundquests.hasCompletedQuest(player, "itp_vader_02");
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
boolean itp_vader_main_condition_completedEmperor (obj_id player, obj_id npc)
|
|
{
|
|
return groundquests.hasCompletedQuest(player, "itp_emperor_03");
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
boolean itp_vader_main_condition_notImperial (obj_id player, obj_id npc)
|
|
{
|
|
string playerFaction = factions.getFaction(player);
|
|
if ( playerFaction == null || !playerFaction.equals("Imperial") )
|
|
{
|
|
return true;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
boolean itp_vader_main_condition_imperial_isOnLeave (obj_id player, obj_id npc)
|
|
{
|
|
return factions.isOnLeave(player);
|
|
}
|
|
|
|
// ======================================================================
|
|
// Script Actions
|
|
// ======================================================================
|
|
|
|
void itp_vader_main_action_itp_vader_01_granted (obj_id player, obj_id npc)
|
|
{
|
|
groundquests.grantQuest(player, "itp_vader_01");
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
void itp_vader_main_action_itp_vader_01_signal (obj_id player, obj_id npc)
|
|
{
|
|
groundquests.sendSignal(player, "itp_vader_01_04");
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
void itp_vader_main_action_itp_vader_03_signal (obj_id player, obj_id npc)
|
|
{
|
|
groundquests.sendSignal(player, "itp_vader_03_04");
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
void itp_vader_main_action_itp_vader_02_signal (obj_id player, obj_id npc)
|
|
{
|
|
groundquests.sendSignal(player, "itp_vader_02_05");
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
void itp_vader_main_action_itp_vader_02_granted (obj_id player, obj_id npc)
|
|
{
|
|
groundquests.grantQuest(player, "itp_vader_02");
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
void itp_vader_main_action_itp_vader_03_granted (obj_id player, obj_id npc)
|
|
{
|
|
groundquests.grantQuest(player, "itp_vader_03");
|
|
}
|
|
|
|
// ======================================================================
|
|
// Script %TO Tokens
|
|
// ======================================================================
|
|
|
|
// ======================================================================
|
|
// Script %DI Tokens
|
|
// ======================================================================
|
|
|
|
// ======================================================================
|
|
// Script %DF Tokens
|
|
// ======================================================================
|
|
|
|
// ======================================================================
|
|
// handleBranch<n> Functions
|
|
// ======================================================================
|
|
|
|
int itp_vader_main_handleBranch6 (obj_id player, obj_id npc, string_id response)
|
|
{
|
|
//-- [BRANCH NOTE]
|
|
//-- NPC: Magus Jocle claimed to find strong emanations of the Force from the Death Star debris. I feel certain that my own presence there have caused this. But I would be foolish not to be certain.
|
|
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: What would you have me to do, Lord Vader?
|
|
if (response == "s_31")
|
|
{
|
|
//-- [NOTE]
|
|
if (itp_vader_main_condition__defaultCondition (player, npc))
|
|
{
|
|
itp_vader_main_action_itp_vader_03_granted (player, npc);
|
|
|
|
//-- NPC: Travel to Dathomir and recover a shard from a Force crystal in the possession of some nightsisters.
|
|
string_id message = new string_id (c_stringFile, "s_33");
|
|
utils.removeScriptVar (player, "conversation.itp_vader_main.branchId");
|
|
|
|
npcEndConversationWithMessage (player, message);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
}
|
|
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: No thank you.
|
|
if (response == "s_35")
|
|
{
|
|
//-- [NOTE]
|
|
if (itp_vader_main_condition__defaultCondition (player, npc))
|
|
{
|
|
//-- NPC: Very well.
|
|
string_id message = new string_id (c_stringFile, "s_37");
|
|
utils.removeScriptVar (player, "conversation.itp_vader_main.branchId");
|
|
|
|
npcEndConversationWithMessage (player, message);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
}
|
|
|
|
return SCRIPT_DEFAULT;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
int itp_vader_main_handleBranch10 (obj_id player, obj_id npc, string_id response)
|
|
{
|
|
//-- [BRANCH NOTE]
|
|
//-- NPC: Travel to Yavin IV and find the Rebel leaders that Ahnyx Pollard claimed would have more information.
|
|
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: Yavin IV? I'm on my way.
|
|
if (response == "s_22")
|
|
{
|
|
//-- [NOTE]
|
|
if (itp_vader_main_condition__defaultCondition (player, npc))
|
|
{
|
|
itp_vader_main_action_itp_vader_02_granted (player, npc);
|
|
|
|
//-- NPC: Rather than being on your way, you are still here. Do not try my patience.
|
|
string_id message = new string_id (c_stringFile, "s_25");
|
|
utils.removeScriptVar (player, "conversation.itp_vader_main.branchId");
|
|
|
|
npcEndConversationWithMessage (player, message);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
}
|
|
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: No thank you.
|
|
if (response == "s_26")
|
|
{
|
|
//-- [NOTE]
|
|
if (itp_vader_main_condition__defaultCondition (player, npc))
|
|
{
|
|
//-- NPC: Very well.
|
|
string_id message = new string_id (c_stringFile, "s_30");
|
|
utils.removeScriptVar (player, "conversation.itp_vader_main.branchId");
|
|
|
|
npcEndConversationWithMessage (player, message);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
}
|
|
|
|
return SCRIPT_DEFAULT;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
int itp_vader_main_handleBranch14 (obj_id player, obj_id npc, string_id response)
|
|
{
|
|
//-- [BRANCH NOTE]
|
|
//-- NPC: I have contracted the services of a special agent to watch for Rebel activity connected to recent events on Tatooine and Yavin IV. That agent has informed him of a Rebel courier that was destined for Naboo.
|
|
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: Yes, Lord Vader.
|
|
if (response == "s_36")
|
|
{
|
|
//-- [NOTE]
|
|
if (itp_vader_main_condition__defaultCondition (player, npc))
|
|
{
|
|
itp_vader_main_action_itp_vader_01_granted (player, npc);
|
|
|
|
//-- NPC: You will find that courier, retrieve whatever he carries, and destroy him.
|
|
string_id message = new string_id (c_stringFile, "s_39");
|
|
utils.removeScriptVar (player, "conversation.itp_vader_main.branchId");
|
|
|
|
npcEndConversationWithMessage (player, message);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
}
|
|
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: No thank you.
|
|
if (response == "s_41")
|
|
{
|
|
//-- [NOTE]
|
|
if (itp_vader_main_condition__defaultCondition (player, npc))
|
|
{
|
|
//-- NPC: Very well.
|
|
string_id message = new string_id (c_stringFile, "s_45");
|
|
utils.removeScriptVar (player, "conversation.itp_vader_main.branchId");
|
|
|
|
npcEndConversationWithMessage (player, message);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
}
|
|
|
|
return SCRIPT_DEFAULT;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
// ======================================================================
|
|
// User Script Triggers
|
|
// ======================================================================
|
|
|
|
trigger OnInitialize ()
|
|
{
|
|
if ((!isMob (self)) || (isPlayer (self)))
|
|
detachScript(self, "conversation.itp_vader_main");
|
|
|
|
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);
|
|
|
|
faceTo( self, player );
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
trigger OnIncapacitated (obj_id killer)
|
|
{
|
|
clearCondition (self, CONDITION_CONVERSABLE);
|
|
detachScript (self, "conversation.itp_vader_main");
|
|
|
|
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 (itp_vader_main_condition_notImperial (player, npc))
|
|
{
|
|
//-- NPC: The function of this base is not of your concern. I would suggest you make yourself scarce.
|
|
string_id message = new string_id (c_stringFile, "s_44");
|
|
chat.chat (npc, player, message);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//-- [NOTE]
|
|
if (!itp_vader_main_condition_completedEmperor (player, npc))
|
|
{
|
|
//-- NPC: I do not recall sending for you.
|
|
string_id message = new string_id (c_stringFile, "s_46");
|
|
chat.chat (npc, player, message);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//-- [NOTE]
|
|
if (itp_vader_main_condition_imperial_isOnLeave (player, npc))
|
|
{
|
|
//-- NPC: I'm afraid I only have orders I have are for those on active duty.
|
|
string_id message = new string_id (c_stringFile, "s_43");
|
|
chat.chat (npc, player, message);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//-- [NOTE]
|
|
if (itp_vader_main_condition_itp_vader_03_complete (player, npc))
|
|
{
|
|
itp_vader_main_action_itp_vader_03_signal (player, npc);
|
|
|
|
//-- NPC: Obi-wan was there, as was another. But who might this other person be. I shall give this much thought. You are dismissed. For now.
|
|
string_id message = new string_id (c_stringFile, "s_9");
|
|
chat.chat (npc, player, message);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//-- [NOTE]
|
|
if (itp_vader_main_condition_itp_vader_03_active (player, npc))
|
|
{
|
|
//-- NPC: You have your mission. I would recommend that you get to it.
|
|
string_id message = new string_id (c_stringFile, "s_29");
|
|
chat.chat (npc, player, message);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//-- [NOTE]
|
|
if (itp_vader_main_condition_itp_vader_02_complete (player, npc))
|
|
{
|
|
itp_vader_main_action_itp_vader_02_signal (player, npc);
|
|
|
|
//-- NPC: Magus Jocle claimed to find strong emanations of the Force from the Death Star debris. I feel certain that my own presence there have caused this. But I would be foolish not to be certain.
|
|
string_id message = new string_id (c_stringFile, "s_28");
|
|
int numberOfResponses = 0;
|
|
|
|
boolean hasResponse = false;
|
|
|
|
//-- PLAYER: What would you have me to do, Lord Vader?
|
|
boolean hasResponse0 = false;
|
|
if (itp_vader_main_condition__defaultCondition (player, npc))
|
|
{
|
|
++numberOfResponses;
|
|
hasResponse = true;
|
|
hasResponse0 = true;
|
|
}
|
|
|
|
//-- PLAYER: No thank you.
|
|
boolean hasResponse1 = false;
|
|
if (itp_vader_main_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_31");
|
|
|
|
if (hasResponse1)
|
|
responses [responseIndex++] = new string_id (c_stringFile, "s_35");
|
|
|
|
utils.setScriptVar (player, "conversation.itp_vader_main.branchId", 6);
|
|
|
|
npcStartConversation (player, npc, "itp_vader_main", message, responses);
|
|
}
|
|
else
|
|
{
|
|
chat.chat (npc, player, message);
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//-- [NOTE]
|
|
if (itp_vader_main_condition_itp_vader_02_active (player, npc))
|
|
{
|
|
//-- NPC: I do not wish to repeat myself, and you do not wish to speak with me again without fulfilling your mission.
|
|
string_id message = new string_id (c_stringFile, "s_16");
|
|
chat.chat (npc, player, message);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//-- [NOTE]
|
|
if (itp_vader_main_condition_itp_vader_01_complete (player, npc))
|
|
{
|
|
itp_vader_main_action_itp_vader_01_signal (player, npc);
|
|
|
|
//-- NPC: Travel to Yavin IV and find the Rebel leaders that Ahnyx Pollard claimed would have more information.
|
|
string_id message = new string_id (c_stringFile, "s_20");
|
|
int numberOfResponses = 0;
|
|
|
|
boolean hasResponse = false;
|
|
|
|
//-- PLAYER: Yavin IV? I'm on my way.
|
|
boolean hasResponse0 = false;
|
|
if (itp_vader_main_condition__defaultCondition (player, npc))
|
|
{
|
|
++numberOfResponses;
|
|
hasResponse = true;
|
|
hasResponse0 = true;
|
|
}
|
|
|
|
//-- PLAYER: No thank you.
|
|
boolean hasResponse1 = false;
|
|
if (itp_vader_main_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_26");
|
|
|
|
utils.setScriptVar (player, "conversation.itp_vader_main.branchId", 10);
|
|
|
|
npcStartConversation (player, npc, "itp_vader_main", message, responses);
|
|
}
|
|
else
|
|
{
|
|
chat.chat (npc, player, message);
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//-- [NOTE]
|
|
if (itp_vader_main_condition_itp_vader_01_active (player, npc))
|
|
{
|
|
//-- NPC: You have matters to which you should be attending. Do not fail me.
|
|
string_id message = new string_id (c_stringFile, "s_32");
|
|
chat.chat (npc, player, message);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//-- [NOTE]
|
|
if (itp_vader_main_condition__defaultCondition (player, npc))
|
|
{
|
|
//-- NPC: I have contracted the services of a special agent to watch for Rebel activity connected to recent events on Tatooine and Yavin IV. That agent has informed him of a Rebel courier that was destined for Naboo.
|
|
string_id message = new string_id (c_stringFile, "s_34");
|
|
int numberOfResponses = 0;
|
|
|
|
boolean hasResponse = false;
|
|
|
|
//-- PLAYER: Yes, Lord Vader.
|
|
boolean hasResponse0 = false;
|
|
if (itp_vader_main_condition__defaultCondition (player, npc))
|
|
{
|
|
++numberOfResponses;
|
|
hasResponse = true;
|
|
hasResponse0 = true;
|
|
}
|
|
|
|
//-- PLAYER: No thank you.
|
|
boolean hasResponse1 = false;
|
|
if (itp_vader_main_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_36");
|
|
|
|
if (hasResponse1)
|
|
responses [responseIndex++] = new string_id (c_stringFile, "s_41");
|
|
|
|
utils.setScriptVar (player, "conversation.itp_vader_main.branchId", 14);
|
|
|
|
npcStartConversation (player, npc, "itp_vader_main", 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 != "itp_vader_main")
|
|
return SCRIPT_CONTINUE;
|
|
|
|
obj_id npc = self;
|
|
|
|
int branchId = utils.getIntScriptVar (player, "conversation.itp_vader_main.branchId");
|
|
|
|
if (branchId == 6 && itp_vader_main_handleBranch6 (player, npc, response) == SCRIPT_CONTINUE)
|
|
return SCRIPT_CONTINUE;
|
|
|
|
if (branchId == 10 && itp_vader_main_handleBranch10 (player, npc, response) == SCRIPT_CONTINUE)
|
|
return SCRIPT_CONTINUE;
|
|
|
|
if (branchId == 14 && itp_vader_main_handleBranch14 (player, npc, response) == SCRIPT_CONTINUE)
|
|
return SCRIPT_CONTINUE;
|
|
|
|
chat.chat (npc, "Error: Fell through all branches and responses for OnNpcConversationResponse.");
|
|
|
|
utils.removeScriptVar (player, "conversation.itp_vader_main.branchId");
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
// ======================================================================
|
|
|