mirror of
https://bitbucket.org/seefoe/dsrc.git
synced 2026-07-31 01:15:55 -04:00
1050 lines
31 KiB
Plaintext
1050 lines
31 KiB
Plaintext
// ======================================================================
|
|
//
|
|
// npe_commando.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.space_quest;
|
|
include library.static_item;
|
|
include library.utils;
|
|
|
|
// ======================================================================
|
|
// Script Constants
|
|
// ======================================================================
|
|
|
|
string c_stringFile = "conversation/npe_commando";
|
|
|
|
// ======================================================================
|
|
// Script Conditions
|
|
// ======================================================================
|
|
|
|
boolean npe_commando_condition__defaultCondition (obj_id player, obj_id npc)
|
|
{
|
|
return true;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
boolean npe_commando_condition_wantsCommando (obj_id player, obj_id npc)
|
|
{
|
|
return npe_commando_condition_isCommandoTemplate(player, npc) && groundquests.isQuestActive(player, "npe_pointer_commando_template");
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
boolean npe_commando_condition_isCommandoTemplate (obj_id player, obj_id npc)
|
|
{
|
|
string playerTemplate = getSkillTemplate(player);
|
|
|
|
if(playerTemplate.indexOf("commando") > -1 )
|
|
return true;
|
|
else
|
|
return false;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
boolean npe_commando_condition_fromBrawler (obj_id player, obj_id npc)
|
|
{
|
|
return groundquests.isTaskActive(player, "npe_commando_tracker", "done");
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
boolean npe_commando_condition_finishFinalTask (obj_id player, obj_id npc)
|
|
{
|
|
return groundquests.isTaskActive(player, "npe_commando", "final_return");
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
boolean npe_commando_condition_finishedFirstTask (obj_id player, obj_id npc)
|
|
{
|
|
return groundquests.isTaskActive(player, "npe_commando", "return1");
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
boolean npe_commando_condition_finishedSecondTask (obj_id player, obj_id npc)
|
|
{
|
|
return groundquests.isTaskActive(player, "npe_commando", "return2");
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
boolean npe_commando_condition_isOnTask (obj_id player, obj_id npc)
|
|
{
|
|
return (groundquests.isTaskActive(player, "npe_commando", "elevator_toDroid") ||
|
|
groundquests.isTaskActive(player, "npe_commando", "elevator_toData") ||
|
|
groundquests.isTaskActive(player, "npe_commando", "defuse") ||
|
|
groundquests.isTaskActive(player, "npe_commando", "thugs") ||
|
|
groundquests.isTaskActive(player, "npe_commando", "get_data"));
|
|
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
boolean npe_commando_condition_defusedBomb (obj_id player, obj_id npc)
|
|
{
|
|
return true;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
boolean npe_commando_condition_finishedAll (obj_id player, obj_id npc)
|
|
{
|
|
return groundquests.hasCompletedQuest(player, "npe_commando");
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
boolean npe_commando_condition_hasFinishedInaldraLt (obj_id player, obj_id npc)
|
|
{
|
|
return (//groundquests.hasCompletedQuest(player, "npe_new_artisan_quest")&&
|
|
//groundquests.hasCompletedQuest(player, "npe_entertainer_1")&&
|
|
groundquests.hasCompletedQuest(player, "npe_side_smuggle")&&
|
|
groundquests.hasCompletedQuest(player, "npe_side4")&&
|
|
groundquests.hasCompletedQuest(player, "npe_brawler_4a")&&
|
|
groundquests.hasCompletedQuest(player, "npe_side_hutt_slicers")&&
|
|
groundquests.hasCompletedQuest(player, "npe_scout_1")&&
|
|
groundquests.hasCompletedQuest(player, "npe_side3")&&
|
|
groundquests.hasCompletedQuest(player, "npe_side5")&&
|
|
space_quest.hasWonQuest( player, "escort", "npe_training_3" )&&
|
|
space_quest.hasCompletedQuestRecursive( player, "patrol", "npe_easy_main_4" )&&
|
|
space_quest.hasWonQuest( player, "destroy", "npe_med_main_4" )&&
|
|
space_quest.hasWonQuest( player, "destroy", "npe_hard_main_3" )&&
|
|
groundquests.hasCompletedQuest(player, "npe_side2")&&
|
|
groundquests.hasCompletedQuest(player, "npe_side_jolka")&&
|
|
groundquests.hasCompletedQuest(player, "npe_inaldra_quest") &&
|
|
groundquests.hasCompletedQuest(player, "npe_side_dungeon_soldier") &&
|
|
groundquests.hasCompletedQuest(player, "npe_side_dungeon_dna") &&
|
|
groundquests.hasCompletedQuest(player, "npe_frelka_transition") &&
|
|
(groundquests.hasCompletedQuest(player, "npe_imperial_1") || groundquests.hasCompletedQuest(player, "npe_rebel_2")) );
|
|
}
|
|
|
|
// ======================================================================
|
|
// Script Actions
|
|
// ======================================================================
|
|
|
|
void npe_commando_action_giveInaldraPointer (obj_id player, obj_id npc)
|
|
{
|
|
groundquests.grantQuest(player, "npe_pointer_secretary");
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
void npe_commando_action_giveCommandoQuest (obj_id player, obj_id npc)
|
|
{
|
|
npe.giveGrenadePopUp(player, npc);
|
|
groundquests.grantQuest(player, "npe_commando");
|
|
groundquests.sendSignal(player, "npe_commando_done");
|
|
groundquests.sendSignal(player, "found_commando");
|
|
if(!hasObjVar(player, npe.QUEST_REWORK_VAR))
|
|
setObjVar(player, npe.QUEST_REWORK_VAR, npe.QUEST_ENUMERATION);
|
|
|
|
//groundquests.grantQuest(player, "npe_commando_reward", false);
|
|
boolean hasItem = false;
|
|
obj_id[] playerStuff = getInventoryAndEquipment(player);
|
|
//loop thru players inventory, make sure they dont have the item already.
|
|
for(int i =0; i < playerStuff.length; i++)
|
|
{
|
|
string templateName = static_item.getStaticItemName(playerStuff[i]);
|
|
if(templateName != null)
|
|
{
|
|
if(templateName == "weapon_grenade_fragmentation_01_01")
|
|
{
|
|
hasItem = true;
|
|
newbieTutorialSetToolbarElement(player, 5, playerStuff[i]);
|
|
newbieTutorialHighlightUIElement (player, "/GroundHUD.Toolbar.volume.5", 5.0f);
|
|
}
|
|
}
|
|
}
|
|
if(hasItem == false)
|
|
{
|
|
obj_id grenade = static_item.createNewItemFunction("weapon_grenade_fragmentation_01_01", player);
|
|
newbieTutorialSetToolbarElement(player, 5, grenade);
|
|
obj_id[] items = new obj_id[1];
|
|
items[0] = grenade;
|
|
showLootBox(player, items);
|
|
dictionary dic = new dictionary();
|
|
dic.put("player", player);
|
|
dic.put("location", 5);
|
|
dic.put("time", 5.0f);
|
|
messageTo(player, "makeUiElementAnimate", dic, 0.25f, true);
|
|
}
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
void npe_commando_action_giveFirstSignal (obj_id player, obj_id npc)
|
|
{
|
|
groundquests.sendSignal(player, "npe_grenade_done");
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
void npe_commando_action_giveSecondSignal (obj_id player, obj_id npc)
|
|
{
|
|
groundquests.sendSignal(player, "npe_datapad_done");
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
void npe_commando_action_facePlayer (obj_id player, obj_id npc)
|
|
{
|
|
faceTo(npc, player);
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
void npe_commando_action_giveReward (obj_id player, obj_id npc)
|
|
{
|
|
groundquests.sendSignal(player, "final_return");
|
|
setObjVar(player, "npe.finishedTemplate", 1);
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
void npe_commando_action_giveHanPointer (obj_id player, obj_id npc)
|
|
{
|
|
groundquests.grantQuest(player, "npe_job_pointer_han");
|
|
}
|
|
|
|
// ======================================================================
|
|
// Script %TO Tokens
|
|
// ======================================================================
|
|
|
|
// ======================================================================
|
|
// Script %DI Tokens
|
|
// ======================================================================
|
|
|
|
// ======================================================================
|
|
// Script %DF Tokens
|
|
// ======================================================================
|
|
|
|
// ======================================================================
|
|
// handleBranch<n> Functions
|
|
// ======================================================================
|
|
|
|
int npe_commando_handleBranch2 (obj_id player, obj_id npc, string_id response)
|
|
{
|
|
//-- [BRANCH NOTE]
|
|
//-- NPC: Thanks for all you have done, %TU. You are shaping up nicely. Is there something else you need?
|
|
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: Yes. I'm looking for more work.
|
|
if (response == "s_64")
|
|
{
|
|
//-- [NOTE]
|
|
if (npe_commando_condition__defaultCondition (player, npc))
|
|
{
|
|
npe_commando_action_giveInaldraPointer (player, npc);
|
|
|
|
//-- NPC: Talk to Inaldra's lieutenant in Inaldra's office.
|
|
string_id message = new string_id (c_stringFile, "s_84");
|
|
utils.removeScriptVar (player, "conversation.npe_commando.branchId");
|
|
|
|
npcEndConversationWithMessage (player, message);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
}
|
|
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: I want to leave this station.
|
|
if (response == "s_69")
|
|
{
|
|
//-- [NOTE]
|
|
if (npe_commando_condition__defaultCondition (player, npc))
|
|
{
|
|
npe_commando_action_giveHanPointer (player, npc);
|
|
|
|
//-- NPC: Well, how did you get here? You should probably talk to whoever it was that flew you here. I can't help with that.
|
|
string_id message = new string_id (c_stringFile, "s_88");
|
|
utils.removeScriptVar (player, "conversation.npe_commando.branchId");
|
|
|
|
npcEndConversationWithMessage (player, message);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
}
|
|
|
|
return SCRIPT_DEFAULT;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
int npe_commando_handleBranch5 (obj_id player, obj_id npc, string_id response)
|
|
{
|
|
//-- [BRANCH NOTE]
|
|
//-- NPC: Did you defuse it!?
|
|
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: Piece of cake.
|
|
if (response == "s_46")
|
|
{
|
|
//-- [NOTE]
|
|
if (npe_commando_condition__defaultCondition (player, npc))
|
|
{
|
|
//-- NPC: Astounding! We all owe you our lives.
|
|
string_id message = new string_id (c_stringFile, "s_48");
|
|
int numberOfResponses = 0;
|
|
|
|
boolean hasResponse = false;
|
|
|
|
//-- PLAYER: All in a day's work, sir.
|
|
boolean hasResponse0 = false;
|
|
if (npe_commando_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_67");
|
|
|
|
utils.setScriptVar (player, "conversation.npe_commando.branchId", 6);
|
|
|
|
npcSpeak (player, message);
|
|
npcSetConversationResponses (player, responses);
|
|
}
|
|
else
|
|
{
|
|
utils.removeScriptVar (player, "conversation.npe_commando.branchId");
|
|
|
|
npcEndConversationWithMessage (player, message);
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
}
|
|
|
|
return SCRIPT_DEFAULT;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
int npe_commando_handleBranch6 (obj_id player, obj_id npc, string_id response)
|
|
{
|
|
//-- [BRANCH NOTE]
|
|
//-- NPC: Astounding! We all owe you our lives.
|
|
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: All in a day's work, sir.
|
|
if (response == "s_67")
|
|
{
|
|
//-- [NOTE]
|
|
if (npe_commando_condition__defaultCondition (player, npc))
|
|
{
|
|
npe_commando_action_giveReward (player, npc);
|
|
|
|
//-- NPC: I like your attitude, soldier! While you were gone, this package came in. Looks like it's your uniform. Here, take it. Take this as well...you've earned it.
|
|
string_id message = new string_id (c_stringFile, "s_68");
|
|
int numberOfResponses = 0;
|
|
|
|
boolean hasResponse = false;
|
|
|
|
//-- PLAYER: Thank you.
|
|
boolean hasResponse0 = false;
|
|
if (npe_commando_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_42");
|
|
|
|
utils.setScriptVar (player, "conversation.npe_commando.branchId", 7);
|
|
|
|
npcSpeak (player, message);
|
|
npcSetConversationResponses (player, responses);
|
|
}
|
|
else
|
|
{
|
|
utils.removeScriptVar (player, "conversation.npe_commando.branchId");
|
|
|
|
npcEndConversationWithMessage (player, message);
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
}
|
|
|
|
return SCRIPT_DEFAULT;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
int npe_commando_handleBranch7 (obj_id player, obj_id npc, string_id response)
|
|
{
|
|
//-- [BRANCH NOTE]
|
|
//-- NPC: I like your attitude, soldier! While you were gone, this package came in. Looks like it's your uniform. Here, take it. Take this as well...you've earned it.
|
|
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: Thank you.
|
|
if (response == "s_42")
|
|
{
|
|
//-- [NOTE]
|
|
if (npe_commando_condition__defaultCondition (player, npc))
|
|
{
|
|
npe_commando_action_giveHanPointer (player, npc);
|
|
|
|
//-- NPC: I have nothing else for you to help me with. I hear Han Solo was trying to find you. You should go talk to him.
|
|
string_id message = new string_id (c_stringFile, "s_47");
|
|
utils.removeScriptVar (player, "conversation.npe_commando.branchId");
|
|
|
|
npcEndConversationWithMessage (player, message);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
}
|
|
|
|
return SCRIPT_DEFAULT;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
int npe_commando_handleBranch9 (obj_id player, obj_id npc, string_id response)
|
|
{
|
|
//-- [BRANCH NOTE]
|
|
//-- NPC: Welcome back, soldier. How did you fare on your assignment?
|
|
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: Threat eliminated, sir!
|
|
if (response == "s_36")
|
|
{
|
|
doAnimationAction (player, "salute1");
|
|
|
|
//-- [NOTE]
|
|
if (npe_commando_condition__defaultCondition (player, npc))
|
|
{
|
|
//-- NPC: Well done. The life of a commando is full of fun tactics and loud weapons. I see you know about demolition. No one likes to be on the receiving end of that shot.
|
|
string_id message = new string_id (c_stringFile, "s_43");
|
|
int numberOfResponses = 0;
|
|
|
|
boolean hasResponse = false;
|
|
|
|
//-- PLAYER: Really? I will start to use it more often.
|
|
boolean hasResponse0 = false;
|
|
if (npe_commando_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_45");
|
|
|
|
utils.setScriptVar (player, "conversation.npe_commando.branchId", 10);
|
|
|
|
npcSpeak (player, message);
|
|
npcSetConversationResponses (player, responses);
|
|
}
|
|
else
|
|
{
|
|
utils.removeScriptVar (player, "conversation.npe_commando.branchId");
|
|
|
|
npcEndConversationWithMessage (player, message);
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
}
|
|
|
|
return SCRIPT_DEFAULT;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
int npe_commando_handleBranch10 (obj_id player, obj_id npc, string_id response)
|
|
{
|
|
//-- [BRANCH NOTE]
|
|
//-- NPC: Well done. The life of a commando is full of fun tactics and loud weapons. I see you know about demolition. No one likes to be on the receiving end of that shot.
|
|
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: Really? I will start to use it more often.
|
|
if (response == "s_45")
|
|
{
|
|
//-- [NOTE]
|
|
if (npe_commando_condition__defaultCondition (player, npc))
|
|
{
|
|
//-- NPC: Now, on to business. I have just learned that there was a shipment recently delivered that may be useful to my superiors. I need you to find one named Terry. He has a record of the shipment in his datapad. Recover that datapad by any means necessary. I want no witnesses.
|
|
string_id message = new string_id (c_stringFile, "s_49");
|
|
int numberOfResponses = 0;
|
|
|
|
boolean hasResponse = false;
|
|
|
|
//-- PLAYER: Yes, sir!
|
|
boolean hasResponse0 = false;
|
|
if (npe_commando_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_53");
|
|
|
|
utils.setScriptVar (player, "conversation.npe_commando.branchId", 11);
|
|
|
|
npcSpeak (player, message);
|
|
npcSetConversationResponses (player, responses);
|
|
}
|
|
else
|
|
{
|
|
utils.removeScriptVar (player, "conversation.npe_commando.branchId");
|
|
|
|
npcEndConversationWithMessage (player, message);
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
}
|
|
|
|
return SCRIPT_DEFAULT;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
int npe_commando_handleBranch11 (obj_id player, obj_id npc, string_id response)
|
|
{
|
|
//-- [BRANCH NOTE]
|
|
//-- NPC: Now, on to business. I have just learned that there was a shipment recently delivered that may be useful to my superiors. I need you to find one named Terry. He has a record of the shipment in his datapad. Recover that datapad by any means necessary. I want no witnesses.
|
|
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: Yes, sir!
|
|
if (response == "s_53")
|
|
{
|
|
//-- [NOTE]
|
|
if (npe_commando_condition__defaultCondition (player, npc))
|
|
{
|
|
npe_commando_action_giveFirstSignal (player, npc);
|
|
|
|
//-- NPC: Go now, soldier.
|
|
string_id message = new string_id (c_stringFile, "s_57");
|
|
utils.removeScriptVar (player, "conversation.npe_commando.branchId");
|
|
|
|
npcEndConversationWithMessage (player, message);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
}
|
|
|
|
return SCRIPT_DEFAULT;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
int npe_commando_handleBranch13 (obj_id player, obj_id npc, string_id response)
|
|
{
|
|
//-- [BRANCH NOTE]
|
|
//-- NPC: Are you a new recruit? Stand at attention when speaking to a superior, soldier!
|
|
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: Yes, sir!
|
|
if (response == "s_56")
|
|
{
|
|
//-- [NOTE]
|
|
if (npe_commando_condition__defaultCondition (player, npc))
|
|
{
|
|
//-- NPC: That's better. I'm in a bit of a situation, and could use someone with some know-how.
|
|
string_id message = new string_id (c_stringFile, "s_60");
|
|
int numberOfResponses = 0;
|
|
|
|
boolean hasResponse = false;
|
|
|
|
//-- PLAYER: What kind of situation?
|
|
boolean hasResponse0 = false;
|
|
if (npe_commando_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_63");
|
|
|
|
utils.setScriptVar (player, "conversation.npe_commando.branchId", 14);
|
|
|
|
npcSpeak (player, message);
|
|
npcSetConversationResponses (player, responses);
|
|
}
|
|
else
|
|
{
|
|
utils.removeScriptVar (player, "conversation.npe_commando.branchId");
|
|
|
|
npcEndConversationWithMessage (player, message);
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
}
|
|
|
|
return SCRIPT_DEFAULT;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
int npe_commando_handleBranch14 (obj_id player, obj_id npc, string_id response)
|
|
{
|
|
//-- [BRANCH NOTE]
|
|
//-- NPC: That's better. I'm in a bit of a situation, and could use someone with some know-how.
|
|
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: What kind of situation?
|
|
if (response == "s_63")
|
|
{
|
|
//-- [NOTE]
|
|
if (npe_commando_condition__defaultCondition (player, npc))
|
|
{
|
|
//-- NPC: There is some trouble in the lower levels. Apparently, some Hutts have punched a hole in the station and infiltrated the lower level. They are causing a ruckus. We need someone to make them stop, and I'm getting too old for this kind of thing.
|
|
string_id message = new string_id (c_stringFile, "s_70");
|
|
int numberOfResponses = 0;
|
|
|
|
boolean hasResponse = false;
|
|
|
|
//-- PLAYER: You want me to 'persuade' them to stop?
|
|
boolean hasResponse0 = false;
|
|
if (npe_commando_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_72");
|
|
|
|
utils.setScriptVar (player, "conversation.npe_commando.branchId", 15);
|
|
|
|
npcSpeak (player, message);
|
|
npcSetConversationResponses (player, responses);
|
|
}
|
|
else
|
|
{
|
|
utils.removeScriptVar (player, "conversation.npe_commando.branchId");
|
|
|
|
npcEndConversationWithMessage (player, message);
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
}
|
|
|
|
return SCRIPT_DEFAULT;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
int npe_commando_handleBranch15 (obj_id player, obj_id npc, string_id response)
|
|
{
|
|
//-- [BRANCH NOTE]
|
|
//-- NPC: There is some trouble in the lower levels. Apparently, some Hutts have punched a hole in the station and infiltrated the lower level. They are causing a ruckus. We need someone to make them stop, and I'm getting too old for this kind of thing.
|
|
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: You want me to 'persuade' them to stop?
|
|
if (response == "s_72")
|
|
{
|
|
//-- [NOTE]
|
|
if (npe_commando_condition__defaultCondition (player, npc))
|
|
{
|
|
npe_commando_action_giveCommandoQuest (player, npc);
|
|
|
|
//-- NPC: Exactly. I can't think of a more suitable person for this job. Here are some grenades to reinforce your point. If in the future you need more grenades, look up people skilled in the Trader profession. Lock and load, soldier!
|
|
string_id message = new string_id (c_stringFile, "s_74");
|
|
utils.removeScriptVar (player, "conversation.npe_commando.branchId");
|
|
|
|
npcEndConversationWithMessage (player, message);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
}
|
|
|
|
return SCRIPT_DEFAULT;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
// ======================================================================
|
|
// User Script Triggers
|
|
// ======================================================================
|
|
|
|
trigger OnInitialize ()
|
|
{
|
|
if ((!isMob (self)) || (isPlayer (self)))
|
|
detachScript(self, "conversation.npe_commando");
|
|
|
|
setCondition (self, CONDITION_CONVERSABLE);
|
|
setInvulnerable (self, true);
|
|
ai_lib.setCustomIdleAnimation(self, "npc_imperial");
|
|
setName (self, "Sergeant Snopel (Commando)");
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
trigger OnAttach ()
|
|
{
|
|
setCondition (self, CONDITION_CONVERSABLE);
|
|
setInvulnerable (self, true);
|
|
ai_lib.setCustomIdleAnimation(self, "npc_imperial");
|
|
setName (self, "Sergeant Snopel (Commando)");
|
|
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_commando");
|
|
|
|
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_commando_condition_isOnTask (player, npc))
|
|
{
|
|
npe_commando_action_facePlayer (player, npc);
|
|
|
|
//-- NPC: What are you doing here? Go back and finish your assignment!
|
|
string_id message = new string_id (c_stringFile, "s_31");
|
|
chat.chat (npc, player, message);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//-- [NOTE]
|
|
if (npe_commando_condition_finishedAll (player, npc))
|
|
{
|
|
//-- NPC: Thanks for all you have done, %TU. You are shaping up nicely. Is there something else you need?
|
|
string_id message = new string_id (c_stringFile, "s_65");
|
|
int numberOfResponses = 0;
|
|
|
|
boolean hasResponse = false;
|
|
|
|
//-- PLAYER: Yes. I'm looking for more work.
|
|
boolean hasResponse0 = false;
|
|
if (!npe_commando_condition_hasFinishedInaldraLt (player, npc))
|
|
{
|
|
++numberOfResponses;
|
|
hasResponse = true;
|
|
hasResponse0 = true;
|
|
}
|
|
|
|
//-- PLAYER: I want to leave this station.
|
|
boolean hasResponse1 = false;
|
|
if (npe_commando_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_64");
|
|
|
|
if (hasResponse1)
|
|
responses [responseIndex++] = new string_id (c_stringFile, "s_69");
|
|
|
|
utils.setScriptVar (player, "conversation.npe_commando.branchId", 2);
|
|
|
|
prose_package pp = new prose_package ();
|
|
pp.stringId = message;
|
|
pp.actor.set (player);
|
|
pp.target.set (npc);
|
|
|
|
npcStartConversation (player, npc, "npe_commando", 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_commando_condition_finishFinalTask (player, npc))
|
|
{
|
|
npe_commando_action_facePlayer (player, npc);
|
|
|
|
//-- NPC: Did you defuse it!?
|
|
string_id message = new string_id (c_stringFile, "s_44");
|
|
int numberOfResponses = 0;
|
|
|
|
boolean hasResponse = false;
|
|
|
|
//-- PLAYER: Piece of cake.
|
|
boolean hasResponse0 = false;
|
|
if (npe_commando_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_46");
|
|
|
|
utils.setScriptVar (player, "conversation.npe_commando.branchId", 5);
|
|
|
|
npcStartConversation (player, npc, "npe_commando", message, responses);
|
|
}
|
|
else
|
|
{
|
|
chat.chat (npc, player, message);
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//-- [NOTE]
|
|
if (npe_commando_condition_finishedFirstTask (player, npc))
|
|
{
|
|
npe_commando_action_facePlayer (player, npc);
|
|
|
|
//-- NPC: Welcome back, soldier. How did you fare on your assignment?
|
|
string_id message = new string_id (c_stringFile, "s_34");
|
|
int numberOfResponses = 0;
|
|
|
|
boolean hasResponse = false;
|
|
|
|
//-- PLAYER: Threat eliminated, sir!
|
|
boolean hasResponse0 = false;
|
|
if (npe_commando_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_36");
|
|
|
|
utils.setScriptVar (player, "conversation.npe_commando.branchId", 9);
|
|
|
|
npcStartConversation (player, npc, "npe_commando", message, responses);
|
|
}
|
|
else
|
|
{
|
|
chat.chat (npc, player, message);
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//-- [NOTE]
|
|
if (npe_commando_condition_wantsCommando (player, npc))
|
|
{
|
|
npe_commando_action_facePlayer (player, npc);
|
|
|
|
//-- NPC: Are you a new recruit? Stand at attention when speaking to a superior, soldier!
|
|
string_id message = new string_id (c_stringFile, "s_52");
|
|
int numberOfResponses = 0;
|
|
|
|
boolean hasResponse = false;
|
|
|
|
//-- PLAYER: Yes, sir!
|
|
boolean hasResponse0 = false;
|
|
if (npe_commando_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_56");
|
|
|
|
utils.setScriptVar (player, "conversation.npe_commando.branchId", 13);
|
|
|
|
npcStartConversation (player, npc, "npe_commando", message, responses);
|
|
}
|
|
else
|
|
{
|
|
chat.chat (npc, player, message);
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//-- [NOTE]
|
|
if (npe_commando_condition__defaultCondition (player, npc))
|
|
{
|
|
npe_commando_action_facePlayer (player, npc);
|
|
|
|
//-- NPC: Yes, citizen?
|
|
string_id message = new string_id (c_stringFile, "s_76");
|
|
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_commando")
|
|
return SCRIPT_CONTINUE;
|
|
|
|
obj_id npc = self;
|
|
|
|
int branchId = utils.getIntScriptVar (player, "conversation.npe_commando.branchId");
|
|
|
|
if (branchId == 2 && npe_commando_handleBranch2 (player, npc, response) == SCRIPT_CONTINUE)
|
|
return SCRIPT_CONTINUE;
|
|
|
|
if (branchId == 5 && npe_commando_handleBranch5 (player, npc, response) == SCRIPT_CONTINUE)
|
|
return SCRIPT_CONTINUE;
|
|
|
|
if (branchId == 6 && npe_commando_handleBranch6 (player, npc, response) == SCRIPT_CONTINUE)
|
|
return SCRIPT_CONTINUE;
|
|
|
|
if (branchId == 7 && npe_commando_handleBranch7 (player, npc, response) == SCRIPT_CONTINUE)
|
|
return SCRIPT_CONTINUE;
|
|
|
|
if (branchId == 9 && npe_commando_handleBranch9 (player, npc, response) == SCRIPT_CONTINUE)
|
|
return SCRIPT_CONTINUE;
|
|
|
|
if (branchId == 10 && npe_commando_handleBranch10 (player, npc, response) == SCRIPT_CONTINUE)
|
|
return SCRIPT_CONTINUE;
|
|
|
|
if (branchId == 11 && npe_commando_handleBranch11 (player, npc, response) == SCRIPT_CONTINUE)
|
|
return SCRIPT_CONTINUE;
|
|
|
|
if (branchId == 13 && npe_commando_handleBranch13 (player, npc, response) == SCRIPT_CONTINUE)
|
|
return SCRIPT_CONTINUE;
|
|
|
|
if (branchId == 14 && npe_commando_handleBranch14 (player, npc, response) == SCRIPT_CONTINUE)
|
|
return SCRIPT_CONTINUE;
|
|
|
|
if (branchId == 15 && npe_commando_handleBranch15 (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_commando.branchId");
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
// ======================================================================
|
|
|