mirror of
https://github.com/SWG-Source/dsrc.git
synced 2026-08-01 01:15:59 -04:00
327 lines
9.4 KiB
Plaintext
327 lines
9.4 KiB
Plaintext
// ======================================================================
|
|
//
|
|
// nexus_tusken_starter.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.utils;
|
|
|
|
// ======================================================================
|
|
// Script Constants
|
|
// ======================================================================
|
|
|
|
string c_stringFile = "conversation/nexus_tusken_starter";
|
|
|
|
// ======================================================================
|
|
// Script Conditions
|
|
// ======================================================================
|
|
|
|
boolean nexus_tusken_starter_condition__defaultCondition (obj_id player, obj_id npc)
|
|
{
|
|
return true;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
boolean nexus_tusken_starter_condition_needsQuest (obj_id player, obj_id npc)
|
|
{
|
|
return !groundquests.isQuestActiveOrComplete(player, "found_tusken_encounter");
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
boolean nexus_tusken_starter_condition_onQuest (obj_id player, obj_id npc)
|
|
{
|
|
return groundquests.isQuestActive(player, "feeder_tusken_01");
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
boolean nexus_tusken_starter_condition_finishedQuest (obj_id player, obj_id npc)
|
|
{
|
|
return groundquests.hasCompletedQuest(player, "feeder_tusken_01");
|
|
}
|
|
|
|
// ======================================================================
|
|
// Script Actions
|
|
// ======================================================================
|
|
|
|
void nexus_tusken_starter_action_giveQuest (obj_id player, obj_id npc)
|
|
{
|
|
groundquests.grantQuest(player, "found_tusken_encounter");
|
|
}
|
|
|
|
// ======================================================================
|
|
// Script %TO Tokens
|
|
// ======================================================================
|
|
|
|
// ======================================================================
|
|
// Script %DI Tokens
|
|
// ======================================================================
|
|
|
|
// ======================================================================
|
|
// Script %DF Tokens
|
|
// ======================================================================
|
|
|
|
// ======================================================================
|
|
// handleBranch<n> Functions
|
|
// ======================================================================
|
|
|
|
int nexus_tusken_starter_handleBranch3 (obj_id player, obj_id npc, string_id response)
|
|
{
|
|
//-- [BRANCH NOTE]
|
|
//-- NPC: Please, don't let my appearance fool you. I am no Tusken.
|
|
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: Then why are you dressed as one?
|
|
if (response == "s_7")
|
|
{
|
|
//-- [NOTE]
|
|
if (nexus_tusken_starter_condition__defaultCondition (player, npc))
|
|
{
|
|
//-- NPC: They fascinate me. You know, now that you have brought it up, I have a friend that could use your help.
|
|
string_id message = new string_id (c_stringFile, "s_8");
|
|
int numberOfResponses = 0;
|
|
|
|
boolean hasResponse = false;
|
|
|
|
//-- PLAYER: With what?
|
|
boolean hasResponse0 = false;
|
|
if (nexus_tusken_starter_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.nexus_tusken_starter.branchId", 4);
|
|
|
|
npcSpeak (player, message);
|
|
npcSetConversationResponses (player, responses);
|
|
}
|
|
else
|
|
{
|
|
utils.removeScriptVar (player, "conversation.nexus_tusken_starter.branchId");
|
|
|
|
npcEndConversationWithMessage (player, message);
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
}
|
|
|
|
return SCRIPT_DEFAULT;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
int nexus_tusken_starter_handleBranch4 (obj_id player, obj_id npc, string_id response)
|
|
{
|
|
//-- [BRANCH NOTE]
|
|
//-- NPC: They fascinate me. You know, now that you have brought it up, I have a friend that could use your help.
|
|
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: With what?
|
|
if (response == "s_9")
|
|
{
|
|
//-- [NOTE]
|
|
if (nexus_tusken_starter_condition__defaultCondition (player, npc))
|
|
{
|
|
nexus_tusken_starter_action_giveQuest (player, npc);
|
|
|
|
//-- NPC: He is a scholar of the Tuskens, and needs help recovering some relics. His name is Srimaur. Look for him in Mos Espa.
|
|
string_id message = new string_id (c_stringFile, "s_10");
|
|
utils.removeScriptVar (player, "conversation.nexus_tusken_starter.branchId");
|
|
|
|
npcEndConversationWithMessage (player, message);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
}
|
|
|
|
return SCRIPT_DEFAULT;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
// ======================================================================
|
|
// User Script Triggers
|
|
// ======================================================================
|
|
|
|
trigger OnInitialize ()
|
|
{
|
|
if ((!isTangible (self)) || (isPlayer (self)))
|
|
detachScript(self, "conversation.nexus_tusken_starter");
|
|
|
|
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.nexus_tusken_starter");
|
|
|
|
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 (nexus_tusken_starter_condition_finishedQuest (player, npc))
|
|
{
|
|
//-- NPC: Tuskens invading Mos Espa? Wow, I wish I had been there to see that.
|
|
string_id message = new string_id (c_stringFile, "s_3");
|
|
chat.chat (npc, player, message);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//-- [NOTE]
|
|
if (nexus_tusken_starter_condition_onQuest (player, npc))
|
|
{
|
|
//-- NPC: Shouldn't you be helping Srimaur?
|
|
string_id message = new string_id (c_stringFile, "s_4");
|
|
chat.chat (npc, player, message);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//-- [NOTE]
|
|
if (nexus_tusken_starter_condition_needsQuest (player, npc))
|
|
{
|
|
//-- NPC: Please, don't let my appearance fool you. I am no Tusken.
|
|
string_id message = new string_id (c_stringFile, "s_5");
|
|
int numberOfResponses = 0;
|
|
|
|
boolean hasResponse = false;
|
|
|
|
//-- PLAYER: Then why are you dressed as one?
|
|
boolean hasResponse0 = false;
|
|
if (nexus_tusken_starter_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_7");
|
|
|
|
utils.setScriptVar (player, "conversation.nexus_tusken_starter.branchId", 3);
|
|
|
|
npcStartConversation (player, npc, "nexus_tusken_starter", message, responses);
|
|
}
|
|
else
|
|
{
|
|
chat.chat (npc, player, message);
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//-- [NOTE]
|
|
if (nexus_tusken_starter_condition__defaultCondition (player, npc))
|
|
{
|
|
//-- NPC: Well hello there.
|
|
string_id message = new string_id (c_stringFile, "s_6");
|
|
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 != "nexus_tusken_starter")
|
|
return SCRIPT_CONTINUE;
|
|
|
|
obj_id npc = self;
|
|
|
|
int branchId = utils.getIntScriptVar (player, "conversation.nexus_tusken_starter.branchId");
|
|
|
|
if (branchId == 3 && nexus_tusken_starter_handleBranch3 (player, npc, response) == SCRIPT_CONTINUE)
|
|
return SCRIPT_CONTINUE;
|
|
|
|
if (branchId == 4 && nexus_tusken_starter_handleBranch4 (player, npc, response) == SCRIPT_CONTINUE)
|
|
return SCRIPT_CONTINUE;
|
|
|
|
chat.chat (npc, "Error: Fell through all branches and responses for OnNpcConversationResponse.");
|
|
|
|
utils.removeScriptVar (player, "conversation.nexus_tusken_starter.branchId");
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
// ======================================================================
|
|
|