mirror of
https://github.com/SWG-Source/dsrc.git
synced 2026-07-31 00:15:54 -04:00
397 lines
11 KiB
Plaintext
397 lines
11 KiB
Plaintext
// ======================================================================
|
|
//
|
|
// npe_main_cargo.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_cargo";
|
|
|
|
// ======================================================================
|
|
// Script Conditions
|
|
// ======================================================================
|
|
|
|
boolean npe_main_cargo_condition__defaultCondition (obj_id player, obj_id npc)
|
|
{
|
|
return true;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
boolean npe_main_cargo_condition_onCorrectStep (obj_id player, obj_id npc)
|
|
{
|
|
return groundquests.isTaskActive(player, "npe_new_main_quest", "getparts");
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
boolean npe_main_cargo_condition_completedMainLineQuestStep (obj_id player, obj_id npc)
|
|
{
|
|
return groundquests.hasCompletedTask(player, "npe_main_quest", "talktocargo");
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
boolean npe_main_cargo_condition_completedbothAssignments (obj_id player, obj_id npc)
|
|
{
|
|
return groundquests.hasCompletedQuest(player, "npe_medic");
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
boolean npe_main_cargo_condition_completedneitherAssignment (obj_id player, obj_id npc)
|
|
{
|
|
return ( groundquests.isQuestActive(player, "npe_medic")|| groundquests.isQuestActive(player, "npe_pointer_medic") );
|
|
}
|
|
|
|
// ======================================================================
|
|
// Script Actions
|
|
// ======================================================================
|
|
|
|
void npe_main_cargo_action_facePlayer (obj_id player, obj_id npc)
|
|
{
|
|
faceTo(npc, player);
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
void npe_main_cargo_action_signalMainLineStepComplete (obj_id player, obj_id npc)
|
|
{
|
|
groundquests.sendSignal(player, "npe_new_main_quest_mech");
|
|
|
|
}
|
|
|
|
// ======================================================================
|
|
// Script %TO Tokens
|
|
// ======================================================================
|
|
|
|
// ======================================================================
|
|
// Script %DI Tokens
|
|
// ======================================================================
|
|
|
|
// ======================================================================
|
|
// Script %DF Tokens
|
|
// ======================================================================
|
|
|
|
// ======================================================================
|
|
// handleBranch<n> Functions
|
|
// ======================================================================
|
|
|
|
int npe_main_cargo_handleBranch1 (obj_id player, obj_id npc, string_id response)
|
|
{
|
|
//-- [BRANCH NOTE]
|
|
//-- NPC: Can I help you?
|
|
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: I have a list of ship parts that I need to fix a YT-1300.
|
|
if (response == "s_35")
|
|
{
|
|
//-- [NOTE]
|
|
if (npe_main_cargo_condition__defaultCondition (player, npc))
|
|
{
|
|
//-- NPC: I should be able to sell them to you. It's a YT-1300, you say? You wouldn't happen to be talking about the Millennium Falcon, would you?
|
|
string_id message = new string_id (c_stringFile, "s_36");
|
|
int numberOfResponses = 0;
|
|
|
|
boolean hasResponse = false;
|
|
|
|
//-- PLAYER: Yes.
|
|
boolean hasResponse0 = false;
|
|
if (npe_main_cargo_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_37");
|
|
|
|
utils.setScriptVar (player, "conversation.npe_main_cargo.branchId", 2);
|
|
|
|
npcSpeak (player, message);
|
|
npcSetConversationResponses (player, responses);
|
|
}
|
|
else
|
|
{
|
|
utils.removeScriptVar (player, "conversation.npe_main_cargo.branchId");
|
|
|
|
npcEndConversationWithMessage (player, message);
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
}
|
|
|
|
return SCRIPT_DEFAULT;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
int npe_main_cargo_handleBranch2 (obj_id player, obj_id npc, string_id response)
|
|
{
|
|
//-- [BRANCH NOTE]
|
|
//-- NPC: I should be able to sell them to you. It's a YT-1300, you say? You wouldn't happen to be talking about the Millennium Falcon, would you?
|
|
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: Yes.
|
|
if (response == "s_37")
|
|
{
|
|
//-- [NOTE]
|
|
if (npe_main_cargo_condition__defaultCondition (player, npc))
|
|
{
|
|
doAnimationAction (npc, "dismiss");
|
|
|
|
//-- NPC: Then your money isn't any good here. I won't supply you with anything.
|
|
string_id message = new string_id (c_stringFile, "s_39");
|
|
int numberOfResponses = 0;
|
|
|
|
boolean hasResponse = false;
|
|
|
|
//-- PLAYER: Then how am I supposed to get off this station?
|
|
boolean hasResponse0 = false;
|
|
if (npe_main_cargo_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_40");
|
|
|
|
utils.setScriptVar (player, "conversation.npe_main_cargo.branchId", 3);
|
|
|
|
npcSpeak (player, message);
|
|
npcSetConversationResponses (player, responses);
|
|
}
|
|
else
|
|
{
|
|
utils.removeScriptVar (player, "conversation.npe_main_cargo.branchId");
|
|
|
|
npcEndConversationWithMessage (player, message);
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
}
|
|
|
|
return SCRIPT_DEFAULT;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
int npe_main_cargo_handleBranch3 (obj_id player, obj_id npc, string_id response)
|
|
{
|
|
//-- [BRANCH NOTE]
|
|
//-- NPC: Then your money isn't any good here. I won't supply you with anything.
|
|
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: Then how am I supposed to get off this station?
|
|
if (response == "s_40")
|
|
{
|
|
//-- [NOTE]
|
|
if (npe_main_cargo_condition__defaultCondition (player, npc))
|
|
{
|
|
doAnimationAction (npc, "shoo");
|
|
|
|
npe_main_cargo_action_signalMainLineStepComplete (player, npc);
|
|
|
|
//-- NPC: That's not my problem. Go bother someone in the Cantina or something.
|
|
string_id message = new string_id (c_stringFile, "s_41");
|
|
utils.removeScriptVar (player, "conversation.npe_main_cargo.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_cargo");
|
|
|
|
setCondition (self, CONDITION_CONVERSABLE);
|
|
//setCondition (self, CONDITION_INTERESTING);
|
|
setInvulnerable (self, true);
|
|
setName (self, "Head Mechanic");
|
|
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, "Head Mechanic");
|
|
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_cargo");
|
|
|
|
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_cargo_condition_onCorrectStep (player, npc))
|
|
{
|
|
npe_main_cargo_action_facePlayer (player, npc);
|
|
|
|
//-- NPC: Can I help you?
|
|
string_id message = new string_id (c_stringFile, "s_33");
|
|
int numberOfResponses = 0;
|
|
|
|
boolean hasResponse = false;
|
|
|
|
//-- PLAYER: I have a list of ship parts that I need to fix a YT-1300.
|
|
boolean hasResponse0 = false;
|
|
if (npe_main_cargo_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_35");
|
|
|
|
utils.setScriptVar (player, "conversation.npe_main_cargo.branchId", 1);
|
|
|
|
npcStartConversation (player, npc, "npe_main_cargo", message, responses);
|
|
}
|
|
else
|
|
{
|
|
chat.chat (npc, player, message);
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//-- [NOTE]
|
|
if (npe_main_cargo_condition__defaultCondition (player, npc))
|
|
{
|
|
npe_main_cargo_action_facePlayer (player, npc);
|
|
|
|
//-- NPC: How am I ever going to get this into the inventory?
|
|
string_id message = new string_id (c_stringFile, "s_38");
|
|
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_cargo")
|
|
return SCRIPT_CONTINUE;
|
|
|
|
obj_id npc = self;
|
|
|
|
int branchId = utils.getIntScriptVar (player, "conversation.npe_main_cargo.branchId");
|
|
|
|
if (branchId == 1 && npe_main_cargo_handleBranch1 (player, npc, response) == SCRIPT_CONTINUE)
|
|
return SCRIPT_CONTINUE;
|
|
|
|
if (branchId == 2 && npe_main_cargo_handleBranch2 (player, npc, response) == SCRIPT_CONTINUE)
|
|
return SCRIPT_CONTINUE;
|
|
|
|
if (branchId == 3 && npe_main_cargo_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.npe_main_cargo.branchId");
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
// ======================================================================
|
|
|