mirror of
https://github.com/SWG-Source/dsrc.git
synced 2026-08-01 01:15:59 -04:00
461 lines
14 KiB
Plaintext
461 lines
14 KiB
Plaintext
// ======================================================================
|
|
//
|
|
// npe_scout1_guard.script
|
|
//
|
|
//
|
|
//
|
|
// 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.npe;
|
|
include library.utils;
|
|
|
|
// ======================================================================
|
|
// Script Constants
|
|
// ======================================================================
|
|
|
|
string c_stringFile = "conversation/npe_scout1_guard";
|
|
|
|
// ======================================================================
|
|
// Script Conditions
|
|
// ======================================================================
|
|
|
|
boolean npe_scout1_guard_condition__defaultCondition (obj_id player, obj_id npc)
|
|
{
|
|
return true;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
boolean npe_scout1_guard_condition_playerOnQuestStep (obj_id player, obj_id npc)
|
|
{
|
|
return groundquests.isTaskActive(player, "npe_scout_1", "talktoguard");
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
boolean npe_scout1_guard_condition_playerCompletedQuestStep (obj_id player, obj_id npc)
|
|
{
|
|
return groundquests.hasCompletedTask(player, "npe_scout_1", "talktoguard");
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
boolean npe_scout1_guard_condition_playerCompletedQuest (obj_id player, obj_id npc)
|
|
{
|
|
return groundquests.hasCompletedQuest(player, "npe_scout_1");
|
|
}
|
|
|
|
// ======================================================================
|
|
// Script Actions
|
|
// ======================================================================
|
|
|
|
void npe_scout1_guard_action_signalScout1Ambush (obj_id player, obj_id npc)
|
|
{
|
|
groundquests.sendSignal(player, "npe_scout1_signalattack");
|
|
// npe.giveHarvestPopUp(player, npc);
|
|
}
|
|
|
|
// ======================================================================
|
|
// Script %TO Tokens
|
|
// ======================================================================
|
|
|
|
// ======================================================================
|
|
// Script %DI Tokens
|
|
// ======================================================================
|
|
|
|
// ======================================================================
|
|
// Script %DF Tokens
|
|
// ======================================================================
|
|
|
|
// ======================================================================
|
|
// handleBranch<n> Functions
|
|
// ======================================================================
|
|
|
|
int npe_scout1_guard_handleBranch3 (obj_id player, obj_id npc, string_id response)
|
|
{
|
|
//-- [BRANCH NOTE]
|
|
//-- NPC: I hope you don't need much help. I'm not going to be able to hold a blaster.
|
|
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: Raylen sent me. What did this to you?!
|
|
if (response == "s_9")
|
|
{
|
|
//-- [NOTE]
|
|
if (npe_scout1_guard_condition__defaultCondition (player, npc))
|
|
{
|
|
//-- NPC: Creatures in the room behind me. I'm not sure how they got out of their cages, and I don't know what they were...some sort of cat. I managed to crawl out of there and I sealed the cargo bay door behind me.
|
|
string_id message = new string_id (c_stringFile, "s_11");
|
|
int numberOfResponses = 0;
|
|
|
|
boolean hasResponse = false;
|
|
|
|
//-- PLAYER: What can I do to help?
|
|
boolean hasResponse0 = false;
|
|
if (npe_scout1_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.npe_scout1_guard.branchId", 4);
|
|
|
|
npcSpeak (player, message);
|
|
npcSetConversationResponses (player, responses);
|
|
}
|
|
else
|
|
{
|
|
utils.removeScriptVar (player, "conversation.npe_scout1_guard.branchId");
|
|
|
|
npcEndConversationWithMessage (player, message);
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
}
|
|
|
|
return SCRIPT_DEFAULT;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
int npe_scout1_guard_handleBranch4 (obj_id player, obj_id npc, string_id response)
|
|
{
|
|
//-- [BRANCH NOTE]
|
|
//-- NPC: Creatures in the room behind me. I'm not sure how they got out of their cages, and I don't know what they were...some sort of cat. I managed to crawl out of there and I sealed the cargo bay door behind me.
|
|
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: What can I do to help?
|
|
if (response == "s_14")
|
|
{
|
|
//-- [NOTE]
|
|
if (npe_scout1_guard_condition__defaultCondition (player, npc))
|
|
{
|
|
//-- NPC: Raylen needs to know what these...things are. If you can get one of their hides, that will help. He will know what to do.
|
|
string_id message = new string_id (c_stringFile, "s_16");
|
|
int numberOfResponses = 0;
|
|
|
|
boolean hasResponse = false;
|
|
|
|
//-- PLAYER: How do I get a hide?
|
|
boolean hasResponse0 = false;
|
|
if (npe_scout1_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.npe_scout1_guard.branchId", 5);
|
|
|
|
npcSpeak (player, message);
|
|
npcSetConversationResponses (player, responses);
|
|
}
|
|
else
|
|
{
|
|
utils.removeScriptVar (player, "conversation.npe_scout1_guard.branchId");
|
|
|
|
npcEndConversationWithMessage (player, message);
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
}
|
|
|
|
return SCRIPT_DEFAULT;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
int npe_scout1_guard_handleBranch5 (obj_id player, obj_id npc, string_id response)
|
|
{
|
|
//-- [BRANCH NOTE]
|
|
//-- NPC: Raylen needs to know what these...things are. If you can get one of their hides, that will help. He will know what to do.
|
|
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: How do I get a hide?
|
|
if (response == "s_18")
|
|
{
|
|
//-- [NOTE]
|
|
if (npe_scout1_guard_condition__defaultCondition (player, npc))
|
|
{
|
|
npe_scout1_guard_action_signalScout1Ambush (player, npc);
|
|
|
|
//-- NPC: Kill a couple and harvest the hide from their corpses. I have them trapped in the room next to me. Don't forget that you will need at least one intact hide.
|
|
string_id message = new string_id (c_stringFile, "s_20");
|
|
int numberOfResponses = 0;
|
|
|
|
boolean hasResponse = false;
|
|
|
|
//-- PLAYER: I will.
|
|
boolean hasResponse0 = false;
|
|
if (npe_scout1_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.npe_scout1_guard.branchId", 6);
|
|
|
|
npcSpeak (player, message);
|
|
npcSetConversationResponses (player, responses);
|
|
}
|
|
else
|
|
{
|
|
utils.removeScriptVar (player, "conversation.npe_scout1_guard.branchId");
|
|
|
|
npcEndConversationWithMessage (player, message);
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
}
|
|
|
|
return SCRIPT_DEFAULT;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
int npe_scout1_guard_handleBranch6 (obj_id player, obj_id npc, string_id response)
|
|
{
|
|
//-- [BRANCH NOTE]
|
|
//-- NPC: Kill a couple and harvest the hide from their corpses. I have them trapped in the room next to me. Don't forget that you will need at least one intact hide.
|
|
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: I will.
|
|
if (response == "s_23")
|
|
{
|
|
//-- [NOTE]
|
|
if (npe_scout1_guard_condition__defaultCondition (player, npc))
|
|
{
|
|
//-- NPC: Be careful in there. They sound hungry.
|
|
string_id message = new string_id (c_stringFile, "s_24");
|
|
utils.removeScriptVar (player, "conversation.npe_scout1_guard.branchId");
|
|
|
|
npcEndConversationWithMessage (player, message);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
}
|
|
|
|
return SCRIPT_DEFAULT;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
// ======================================================================
|
|
// User Script Triggers
|
|
// ======================================================================
|
|
|
|
trigger OnInitialize ()
|
|
{
|
|
if ((!isMob (self)) || (isPlayer (self)))
|
|
detachScript(self, "conversation.npe_scout1_guard");
|
|
|
|
setCondition (self, CONDITION_CONVERSABLE);
|
|
//setCondition (self, CONDITION_INTERESTING);
|
|
setPosture(self, POSTURE_SITTING);
|
|
setAnimationMood(self, "meditating");
|
|
setInvulnerable (self, true);
|
|
setName (self, "Hurt Guard");
|
|
ai_lib.setDefaultCalmBehavior( self, ai_lib.BEHAVIOR_SENTINEL );
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
trigger OnAttach ()
|
|
{
|
|
setCondition (self, CONDITION_CONVERSABLE);
|
|
//setCondition (self, CONDITION_INTERESTING);
|
|
setPosture(self, POSTURE_SITTING);
|
|
setAnimationMood(self, "meditating");
|
|
setInvulnerable (self, true);
|
|
setName (self, "Hurt Guard");
|
|
ai_lib.setDefaultCalmBehavior( self, ai_lib.BEHAVIOR_SENTINEL );
|
|
|
|
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_scout1_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 (npe_scout1_guard_condition_playerCompletedQuest (player, npc))
|
|
{
|
|
//-- NPC: Thank you for your help. A medic is going to be sent to me soon.
|
|
string_id message = new string_id (c_stringFile, "s_12");
|
|
chat.chat (npc, player, message);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//-- [NOTE]
|
|
if (npe_scout1_guard_condition_playerCompletedQuestStep (player, npc))
|
|
{
|
|
//-- NPC: Please get to Rylen with a harvested hide.
|
|
string_id message = new string_id (c_stringFile, "s_5");
|
|
chat.chat (npc, player, message);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//-- [NOTE]
|
|
if (npe_scout1_guard_condition_playerOnQuestStep (player, npc))
|
|
{
|
|
//-- NPC: I hope you don't need much help. I'm not going to be able to hold a blaster.
|
|
string_id message = new string_id (c_stringFile, "s_7");
|
|
int numberOfResponses = 0;
|
|
|
|
boolean hasResponse = false;
|
|
|
|
//-- PLAYER: Raylen sent me. What did this to you?!
|
|
boolean hasResponse0 = false;
|
|
if (npe_scout1_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_9");
|
|
|
|
utils.setScriptVar (player, "conversation.npe_scout1_guard.branchId", 3);
|
|
|
|
npcStartConversation (player, npc, "npe_scout1_guard", message, responses);
|
|
}
|
|
else
|
|
{
|
|
chat.chat (npc, player, message);
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//-- [NOTE]
|
|
if (npe_scout1_guard_condition__defaultCondition (player, npc))
|
|
{
|
|
//-- NPC: I'm in a bit of pain here. I was attacked in that room. Please find a medic.
|
|
string_id message = new string_id (c_stringFile, "s_26");
|
|
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_scout1_guard")
|
|
return SCRIPT_CONTINUE;
|
|
|
|
obj_id npc = self;
|
|
|
|
int branchId = utils.getIntScriptVar (player, "conversation.npe_scout1_guard.branchId");
|
|
|
|
if (branchId == 3 && npe_scout1_guard_handleBranch3 (player, npc, response) == SCRIPT_CONTINUE)
|
|
return SCRIPT_CONTINUE;
|
|
|
|
if (branchId == 4 && npe_scout1_guard_handleBranch4 (player, npc, response) == SCRIPT_CONTINUE)
|
|
return SCRIPT_CONTINUE;
|
|
|
|
if (branchId == 5 && npe_scout1_guard_handleBranch5 (player, npc, response) == SCRIPT_CONTINUE)
|
|
return SCRIPT_CONTINUE;
|
|
|
|
if (branchId == 6 && npe_scout1_guard_handleBranch6 (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_scout1_guard.branchId");
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
// ======================================================================
|
|
|