mirror of
https://github.com/SWG-Source/dsrc.git
synced 2026-07-31 00:15:54 -04:00
552 lines
16 KiB
Plaintext
552 lines
16 KiB
Plaintext
// ======================================================================
|
|
//
|
|
// npe_main_security.script
|
|
//
|
|
//
|
|
//
|
|
// Created with SwgConversationEditor 1.35 - 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/npe_main_security";
|
|
|
|
// ======================================================================
|
|
// Script Conditions
|
|
// ======================================================================
|
|
|
|
boolean npe_main_security_condition__defaultCondition (obj_id player, obj_id npc)
|
|
{
|
|
return true;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
boolean npe_main_security_condition_onSideQuest5 (obj_id player, obj_id npc)
|
|
{
|
|
return groundquests.isQuestActive(player, "npe_side5");
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
boolean npe_main_security_condition_SideQuest5ReadyForReward (obj_id player, obj_id npc)
|
|
{
|
|
return groundquests.isTaskActive(player, "npe_side5", "returnsignal");
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
boolean npe_main_security_condition_completedMainQuest (obj_id player, obj_id npc)
|
|
{
|
|
return hasObjVar(player, "npe.finishedTemplate");
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
boolean npe_main_security_condition_Side5Complete (obj_id player, obj_id npc)
|
|
{
|
|
return groundquests.hasCompletedQuest(player, "npe_side5");
|
|
}
|
|
|
|
// ======================================================================
|
|
// Script Actions
|
|
// ======================================================================
|
|
|
|
void npe_main_security_action_facePlayer (obj_id player, obj_id npc)
|
|
{
|
|
faceTo(npc, player);
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
void npe_main_security_action_giveSideQuest5 (obj_id player, obj_id npc)
|
|
{
|
|
groundquests.requestGrantQuest(player, "npe_side5");
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
void npe_main_security_action_rewardSide5 (obj_id player, obj_id npc)
|
|
{
|
|
groundquests.sendSignal(player, "npe_side5_givereward");
|
|
}
|
|
|
|
// ======================================================================
|
|
// Script %TO Tokens
|
|
// ======================================================================
|
|
|
|
// ======================================================================
|
|
// Script %DI Tokens
|
|
// ======================================================================
|
|
|
|
// ======================================================================
|
|
// Script %DF Tokens
|
|
// ======================================================================
|
|
|
|
// ======================================================================
|
|
// handleBranch<n> Functions
|
|
// ======================================================================
|
|
|
|
int npe_main_security_handleBranch2 (obj_id player, obj_id npc, string_id response)
|
|
{
|
|
//-- [BRANCH NOTE]
|
|
//-- NPC: How's it going with the Hutt scum?
|
|
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: Done as ordered!
|
|
if (response == "s_64")
|
|
{
|
|
//-- [NOTE]
|
|
if (npe_main_security_condition__defaultCondition (player, npc))
|
|
{
|
|
doAnimationAction (npc, "pound_fist_palm");
|
|
|
|
npe_main_security_action_rewardSide5 (player, npc);
|
|
|
|
//-- NPC: Very good! Take this payment for your troubles. We will beat these pirates back yet!
|
|
string_id message = new string_id (c_stringFile, "s_65");
|
|
utils.removeScriptVar (player, "conversation.npe_main_security.branchId");
|
|
|
|
npcEndConversationWithMessage (player, message);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
}
|
|
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: I'm still working on it.
|
|
if (response == "s_66")
|
|
{
|
|
//-- [NOTE]
|
|
if (npe_main_security_condition__defaultCondition (player, npc))
|
|
{
|
|
//-- NPC: Good luck!
|
|
string_id message = new string_id (c_stringFile, "s_67");
|
|
utils.removeScriptVar (player, "conversation.npe_main_security.branchId");
|
|
|
|
npcEndConversationWithMessage (player, message);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
}
|
|
|
|
return SCRIPT_DEFAULT;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
int npe_main_security_handleBranch5 (obj_id player, obj_id npc, string_id response)
|
|
{
|
|
//-- [BRANCH NOTE]
|
|
//-- NPC: I need your help, %TU.
|
|
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: What's the problem?
|
|
if (response == "s_55")
|
|
{
|
|
//-- [NOTE]
|
|
if (npe_main_security_condition__defaultCondition (player, npc))
|
|
{
|
|
doAnimationAction (npc, "pound_fist_palm");
|
|
|
|
//-- NPC: A number of pirates have taken control of one of the lower cargo holds!
|
|
string_id message = new string_id (c_stringFile, "s_56");
|
|
int numberOfResponses = 0;
|
|
|
|
boolean hasResponse = false;
|
|
|
|
//-- PLAYER: What is the status down there?
|
|
boolean hasResponse0 = false;
|
|
if (npe_main_security_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_57");
|
|
|
|
utils.setScriptVar (player, "conversation.npe_main_security.branchId", 6);
|
|
|
|
npcSpeak (player, message);
|
|
npcSetConversationResponses (player, responses);
|
|
}
|
|
else
|
|
{
|
|
utils.removeScriptVar (player, "conversation.npe_main_security.branchId");
|
|
|
|
npcEndConversationWithMessage (player, message);
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
}
|
|
|
|
return SCRIPT_DEFAULT;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
int npe_main_security_handleBranch6 (obj_id player, obj_id npc, string_id response)
|
|
{
|
|
//-- [BRANCH NOTE]
|
|
//-- NPC: A number of pirates have taken control of one of the lower cargo holds!
|
|
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: What is the status down there?
|
|
if (response == "s_57")
|
|
{
|
|
//-- [NOTE]
|
|
if (npe_main_security_condition__defaultCondition (player, npc))
|
|
{
|
|
//-- NPC: Most of the cargo that was in there had been previously offloaded. They seem content to stay there, but that may not last. We cannot afford to let them run amok down there. Who knows what trouble they may cause? I need you to go down there and thin out their numbers. Kill 10 of them to weaken their morale.
|
|
string_id message = new string_id (c_stringFile, "s_58");
|
|
int numberOfResponses = 0;
|
|
|
|
boolean hasResponse = false;
|
|
|
|
//-- PLAYER: I'll be happy to help you out.
|
|
boolean hasResponse0 = false;
|
|
if (npe_main_security_condition__defaultCondition (player, npc))
|
|
{
|
|
++numberOfResponses;
|
|
hasResponse = true;
|
|
hasResponse0 = true;
|
|
}
|
|
|
|
//-- PLAYER: No thanks. I don't want to turn into a nice big target.
|
|
boolean hasResponse1 = false;
|
|
if (npe_main_security_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_59");
|
|
|
|
if (hasResponse1)
|
|
responses [responseIndex++] = new string_id (c_stringFile, "s_60");
|
|
|
|
utils.setScriptVar (player, "conversation.npe_main_security.branchId", 7);
|
|
|
|
npcSpeak (player, message);
|
|
npcSetConversationResponses (player, responses);
|
|
}
|
|
else
|
|
{
|
|
utils.removeScriptVar (player, "conversation.npe_main_security.branchId");
|
|
|
|
npcEndConversationWithMessage (player, message);
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
}
|
|
|
|
return SCRIPT_DEFAULT;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
int npe_main_security_handleBranch7 (obj_id player, obj_id npc, string_id response)
|
|
{
|
|
//-- [BRANCH NOTE]
|
|
//-- NPC: Most of the cargo that was in there had been previously offloaded. They seem content to stay there, but that may not last. We cannot afford to let them run amok down there. Who knows what trouble they may cause? I need you to go down there and thin out their numbers. Kill 10 of them to weaken their morale.
|
|
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: I'll be happy to help you out.
|
|
if (response == "s_59")
|
|
{
|
|
//-- [NOTE]
|
|
if (npe_main_security_condition__defaultCondition (player, npc))
|
|
{
|
|
npe_main_security_action_giveSideQuest5 (player, npc);
|
|
|
|
//-- NPC: That's the spirit! Head on down there and show them not to mess with us!
|
|
string_id message = new string_id (c_stringFile, "s_62");
|
|
utils.removeScriptVar (player, "conversation.npe_main_security.branchId");
|
|
|
|
npcEndConversationWithMessage (player, message);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
}
|
|
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: No thanks. I don't want to turn into a nice big target.
|
|
if (response == "s_60")
|
|
{
|
|
//-- [NOTE]
|
|
if (npe_main_security_condition__defaultCondition (player, npc))
|
|
{
|
|
//-- NPC: I understand, but you won't be safe if they decide to advance, will you?
|
|
string_id message = new string_id (c_stringFile, "s_61");
|
|
utils.removeScriptVar (player, "conversation.npe_main_security.branchId");
|
|
|
|
npcEndConversationWithMessage (player, message);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
}
|
|
|
|
return SCRIPT_DEFAULT;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
// ======================================================================
|
|
// User Script Triggers
|
|
// ======================================================================
|
|
|
|
trigger OnInitialize ()
|
|
{
|
|
if ((!isMob (self)) || (isPlayer (self)))
|
|
detachScript(self, "conversation.npe_main_security");
|
|
|
|
setCondition (self, CONDITION_CONVERSABLE);
|
|
//setCondition (self, CONDITION_INTERESTING);
|
|
setInvulnerable (self, true);
|
|
setName (self, "Security Director");
|
|
ai_lib.setDefaultCalmBehavior( self, ai_lib.BEHAVIOR_SENTINEL );
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
trigger OnAttach ()
|
|
{
|
|
setCondition (self, CONDITION_CONVERSABLE);
|
|
//setCondition (self, CONDITION_INTERESTING);
|
|
setInvulnerable (self, true);
|
|
ai_lib.setDefaultCalmBehavior( self, ai_lib.BEHAVIOR_SENTINEL );
|
|
setName (self, "Security Director");
|
|
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.npe_main_security");
|
|
|
|
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 (npe_main_security_condition_Side5Complete (player, npc))
|
|
{
|
|
//-- NPC: Thanks for everything!
|
|
string_id message = new string_id (c_stringFile, "s_68");
|
|
chat.chat (npc, player, message);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//-- [NOTE]
|
|
if (npe_main_security_condition_onSideQuest5 (player, npc))
|
|
{
|
|
//-- NPC: How's it going with the Hutt scum?
|
|
string_id message = new string_id (c_stringFile, "s_63");
|
|
int numberOfResponses = 0;
|
|
|
|
boolean hasResponse = false;
|
|
|
|
//-- PLAYER: Done as ordered!
|
|
boolean hasResponse0 = false;
|
|
if (npe_main_security_condition_SideQuest5ReadyForReward (player, npc))
|
|
{
|
|
++numberOfResponses;
|
|
hasResponse = true;
|
|
hasResponse0 = true;
|
|
}
|
|
|
|
//-- PLAYER: I'm still working on it.
|
|
boolean hasResponse1 = false;
|
|
if (!npe_main_security_condition_SideQuest5ReadyForReward (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_64");
|
|
|
|
if (hasResponse1)
|
|
responses [responseIndex++] = new string_id (c_stringFile, "s_66");
|
|
|
|
utils.setScriptVar (player, "conversation.npe_main_security.branchId", 2);
|
|
|
|
npcStartConversation (player, npc, "npe_main_security", message, responses);
|
|
}
|
|
else
|
|
{
|
|
chat.chat (npc, player, message);
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//-- [NOTE]
|
|
if (npe_main_security_condition_completedMainQuest (player, npc))
|
|
{
|
|
npe_main_security_action_facePlayer (player, npc);
|
|
|
|
//-- NPC: I need your help, %TU.
|
|
string_id message = new string_id (c_stringFile, "s_41");
|
|
int numberOfResponses = 0;
|
|
|
|
boolean hasResponse = false;
|
|
|
|
//-- PLAYER: What's the problem?
|
|
boolean hasResponse0 = false;
|
|
if (npe_main_security_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_55");
|
|
|
|
utils.setScriptVar (player, "conversation.npe_main_security.branchId", 5);
|
|
|
|
prose_package pp = new prose_package ();
|
|
pp.stringId = message;
|
|
pp.actor.set (player);
|
|
pp.target.set (npc);
|
|
|
|
npcStartConversation (player, npc, "npe_main_security", null, pp, responses);
|
|
}
|
|
else
|
|
{
|
|
prose_package pp = new prose_package ();
|
|
pp.stringId = message;
|
|
pp.actor.set (player);
|
|
pp.target.set (npc);
|
|
|
|
chat.chat (npc, player, null, null, pp);
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//-- [NOTE]
|
|
if (npe_main_security_condition__defaultCondition (player, npc))
|
|
{
|
|
//-- NPC: There's a situation brewing, but I don't have much information yet. Come back to me later.
|
|
string_id message = new string_id (c_stringFile, "s_54");
|
|
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 != "npe_main_security")
|
|
return SCRIPT_CONTINUE;
|
|
|
|
obj_id npc = self;
|
|
|
|
int branchId = utils.getIntScriptVar (player, "conversation.npe_main_security.branchId");
|
|
|
|
if (branchId == 2 && npe_main_security_handleBranch2 (player, npc, response) == SCRIPT_CONTINUE)
|
|
return SCRIPT_CONTINUE;
|
|
|
|
if (branchId == 5 && npe_main_security_handleBranch5 (player, npc, response) == SCRIPT_CONTINUE)
|
|
return SCRIPT_CONTINUE;
|
|
|
|
if (branchId == 6 && npe_main_security_handleBranch6 (player, npc, response) == SCRIPT_CONTINUE)
|
|
return SCRIPT_CONTINUE;
|
|
|
|
if (branchId == 7 && npe_main_security_handleBranch7 (player, npc, response) == SCRIPT_CONTINUE)
|
|
return SCRIPT_CONTINUE;
|
|
|
|
chat.chat (npc, "Error: Fell through all branches and responses for OnNpcConversationResponse.");
|
|
|
|
utils.removeScriptVar (player, "conversation.npe_main_security.branchId");
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
// ======================================================================
|
|
|