// ====================================================================== // // gt643_stormtrooper.script // Copyright 2004, Sony Online Entertainment // All Rights Reserved. // // Created with SwgConversationEditor 1.37 - DO NOT EDIT THIS AUTO-GENERATED FILE! // // ====================================================================== // ====================================================================== // Library Includes // ====================================================================== include library.ai_lib; include library.chat; include library.conversation; include library.groundquests; include library.utils; // ====================================================================== // Script Constants // ====================================================================== string c_stringFile = "conversation/gt643_stormtrooper"; // ====================================================================== // Script Conditions // ====================================================================== boolean gt643_stormtrooper_condition__defaultCondition (obj_id player, obj_id npc) { return true; } // ---------------------------------------------------------------------- boolean gt643_stormtrooper_condition_gotShuttleParts (obj_id player, obj_id npc) { return groundquests.hasCompletedQuest(player, "outbreak_quest_shuttle_parts"); } // ---------------------------------------------------------------------- boolean gt643_stormtrooper_condition_rescuedAllSurvivors (obj_id player, obj_id npc) { return groundquests.hasCompletedQuest(player, "outbreak_quest_rescue_04"); } // ---------------------------------------------------------------------- boolean gt643_stormtrooper_condition_isNew (obj_id player, obj_id npc) { faceTo(npc, player); return groundquests.isQuestActive(player, "outbreak_quest_02_imperial") || groundquests.isQuestActive(player, "outbreak_quest_02_rebel") || groundquests.isQuestActive(player, "outbreak_quest_02_neutral"); } // ---------------------------------------------------------------------- boolean gt643_stormtrooper_condition_isShuttleParts (obj_id player, obj_id npc) { return groundquests.isQuestActive(player, "outbreak_quest_shuttle_parts"); } // ---------------------------------------------------------------------- boolean gt643_stormtrooper_condition_isRescuing (obj_id player, obj_id npc) { return groundquests.isQuestActive(player, "outbreak_quest_rescue_04") || groundquests.isQuestActive(player, "outbreak_quest_rescue_03") || groundquests.isQuestActive(player, "outbreak_quest_rescue_02") || groundquests.isQuestActive(player, "outbreak_quest_rescue_01"); } // ---------------------------------------------------------------------- boolean gt643_stormtrooper_condition_hasRadio (obj_id player, obj_id npc) { return groundquests.isTaskActive(player, "outbreak_radio_delivery_03", "findEpsilonContact"); } // ====================================================================== // Script Actions // ====================================================================== // ====================================================================== // Script %TO Tokens // ====================================================================== // ====================================================================== // Script %DI Tokens // ====================================================================== // ====================================================================== // Script %DF Tokens // ====================================================================== // ====================================================================== // handleBranch Functions // ====================================================================== int gt643_stormtrooper_handleBranch2 (obj_id player, obj_id npc, string_id response) { //-- [BRANCH NOTE] //-- NPC: Is it true you retrieved the shuttle parts we need to make that bucket of bolts fly? //-- [RESPONSE NOTE] //-- PLAYER: Well I, uh... if (response == "s_19") { //-- [NOTE] if (gt643_stormtrooper_condition__defaultCondition (player, npc)) { //-- NPC: Look, I've served with these guys...these guys are important to me. They probably won't tell you how we'd all lost hope...but we had until you arrived. string_id message = new string_id (c_stringFile, "s_20"); int numberOfResponses = 0; boolean hasResponse = false; //-- PLAYER: We aren't out of this yet. boolean hasResponse0 = false; if (gt643_stormtrooper_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_21"); utils.setScriptVar (player, "conversation.gt643_stormtrooper.branchId", 3); npcSpeak (player, message); npcSetConversationResponses (player, responses); } else { utils.removeScriptVar (player, "conversation.gt643_stormtrooper.branchId"); npcEndConversationWithMessage (player, message); } return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } // ---------------------------------------------------------------------- int gt643_stormtrooper_handleBranch3 (obj_id player, obj_id npc, string_id response) { //-- [BRANCH NOTE] //-- NPC: Look, I've served with these guys...these guys are important to me. They probably won't tell you how we'd all lost hope...but we had until you arrived. //-- [RESPONSE NOTE] //-- PLAYER: We aren't out of this yet. if (response == "s_21") { //-- [NOTE] if (gt643_stormtrooper_condition__defaultCondition (player, npc)) { //-- NPC: No...you are right. I need to keep my bearing. Goo..good luck, %TU. We are all depending on you. string_id message = new string_id (c_stringFile, "s_22"); utils.removeScriptVar (player, "conversation.gt643_stormtrooper.branchId"); prose_package pp = new prose_package (); pp.stringId = message; pp.actor.set (player); pp.target.set (npc); npcEndConversationWithMessage (player, pp); return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } // ---------------------------------------------------------------------- int gt643_stormtrooper_handleBranch5 (obj_id player, obj_id npc, string_id response) { //-- [BRANCH NOTE] //-- NPC: Hey, %TU, I wanted to let you know there is a wager regrading your future success. //-- [RESPONSE NOTE] //-- PLAYER: Oh? if (response == "s_45") { //-- [NOTE] if (gt643_stormtrooper_condition__defaultCondition (player, npc)) { //-- NPC: Yeah, a few think you''ll be coming back as a walking scab as a result of looking for shuttle parts. ..but I have all my credits on you. Thought you should know. string_id message = new string_id (c_stringFile, "s_46"); utils.removeScriptVar (player, "conversation.gt643_stormtrooper.branchId"); npcEndConversationWithMessage (player, message); return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } // ---------------------------------------------------------------------- int gt643_stormtrooper_handleBranch7 (obj_id player, obj_id npc, string_id response) { //-- [BRANCH NOTE] //-- NPC: Well...not too bad, %TU. I took a lot of courage to rescue those survivors. Would have been a shame if you'd come back undead or something. //-- [RESPONSE NOTE] //-- PLAYER: Uh...thanks? if (response == "s_23") { //-- [NOTE] if (gt643_stormtrooper_condition__defaultCondition (player, npc)) { //-- NPC: See ya around. string_id message = new string_id (c_stringFile, "s_24"); utils.removeScriptVar (player, "conversation.gt643_stormtrooper.branchId"); npcEndConversationWithMessage (player, message); return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } // ---------------------------------------------------------------------- int gt643_stormtrooper_handleBranch10 (obj_id player, obj_id npc, string_id response) { //-- [BRANCH NOTE] //-- NPC: I hope you are reinforcements. //-- [RESPONSE NOTE] //-- PLAYER: No, but I'm here to help. if (response == "s_96") { //-- [NOTE] if (gt643_stormtrooper_condition__defaultCondition (player, npc)) { doAnimationAction (npc, "shoo"); //-- NPC: Good to hear. Speak to HX-138. She's in charge. string_id message = new string_id (c_stringFile, "s_97"); int numberOfResponses = 0; boolean hasResponse = false; //-- PLAYER: She? boolean hasResponse0 = false; if (gt643_stormtrooper_condition__defaultCondition (player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse0 = true; } //-- PLAYER: I will thanks. boolean hasResponse1 = false; if (gt643_stormtrooper_condition__defaultCondition (player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse1 = true; } //-- PLAYER: How are you guys alive. boolean hasResponse2 = false; if (gt643_stormtrooper_condition__defaultCondition (player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse2 = true; } if (hasResponse) { int responseIndex = 0; string_id responses [] = new string_id [numberOfResponses]; if (hasResponse0) responses [responseIndex++] = new string_id (c_stringFile, "s_27"); if (hasResponse1) responses [responseIndex++] = new string_id (c_stringFile, "s_31"); if (hasResponse2) responses [responseIndex++] = new string_id (c_stringFile, "s_35"); utils.setScriptVar (player, "conversation.gt643_stormtrooper.branchId", 11); npcSpeak (player, message); npcSetConversationResponses (player, responses); } else { utils.removeScriptVar (player, "conversation.gt643_stormtrooper.branchId"); npcEndConversationWithMessage (player, message); } return SCRIPT_CONTINUE; } } //-- [RESPONSE NOTE] //-- PLAYER: I'm a Rebel. You going to shoot me? if (response == "s_41") { //-- [NOTE] if (gt643_stormtrooper_condition__defaultCondition (player, npc)) { doAnimationAction (npc, "poke"); //-- NPC: I don't care if you are a wild Rancor looking for refuge. If you are willing to help hold the line, I've got your back. Get it? string_id message = new string_id (c_stringFile, "s_47"); int numberOfResponses = 0; boolean hasResponse = false; //-- PLAYER: Got it. I'm here to help. boolean hasResponse0 = false; if (gt643_stormtrooper_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_49"); utils.setScriptVar (player, "conversation.gt643_stormtrooper.branchId", 15); npcSpeak (player, message); npcSetConversationResponses (player, responses); } else { utils.removeScriptVar (player, "conversation.gt643_stormtrooper.branchId"); npcEndConversationWithMessage (player, message); } return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } // ---------------------------------------------------------------------- int gt643_stormtrooper_handleBranch11 (obj_id player, obj_id npc, string_id response) { //-- [BRANCH NOTE] //-- NPC: Good to hear. Speak to HX-138. She's in charge. //-- [RESPONSE NOTE] //-- PLAYER: She? if (response == "s_27") { //-- [NOTE] if (gt643_stormtrooper_condition__defaultCondition (player, npc)) { doAnimationAction (npc, "laugh_cackle"); //-- NPC: Got a problem with that? I dare you to bring it up with her. Haha. string_id message = new string_id (c_stringFile, "s_29"); utils.removeScriptVar (player, "conversation.gt643_stormtrooper.branchId"); npcEndConversationWithMessage (player, message); return SCRIPT_CONTINUE; } } //-- [RESPONSE NOTE] //-- PLAYER: I will thanks. if (response == "s_31") { //-- [NOTE] if (gt643_stormtrooper_condition__defaultCondition (player, npc)) { doAnimationAction (npc, "shake_head_disgust"); //-- NPC: If you feel like being on guard duty, I'd love to catch some rest. string_id message = new string_id (c_stringFile, "s_33"); utils.removeScriptVar (player, "conversation.gt643_stormtrooper.branchId"); npcEndConversationWithMessage (player, message); return SCRIPT_CONTINUE; } } //-- [RESPONSE NOTE] //-- PLAYER: How are you guys alive. if (response == "s_35") { //-- [NOTE] if (gt643_stormtrooper_condition__defaultCondition (player, npc)) { //-- NPC: I don't know. HX-138 says we were all chosen. Frankly, I don't care anymore. You should speak to her if you want to know more. string_id message = new string_id (c_stringFile, "s_37"); int numberOfResponses = 0; boolean hasResponse = false; //-- PLAYER: Her? boolean hasResponse0 = false; if (gt643_stormtrooper_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_39"); utils.setScriptVar (player, "conversation.gt643_stormtrooper.branchId", 14); npcSpeak (player, message); npcSetConversationResponses (player, responses); } else { utils.removeScriptVar (player, "conversation.gt643_stormtrooper.branchId"); npcEndConversationWithMessage (player, message); } return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } // ---------------------------------------------------------------------- int gt643_stormtrooper_handleBranch14 (obj_id player, obj_id npc, string_id response) { //-- [BRANCH NOTE] //-- NPC: I don't know. HX-138 says we were all chosen. Frankly, I don't care anymore. You should speak to her if you want to know more. //-- [RESPONSE NOTE] //-- PLAYER: Her? if (response == "s_39") { //-- [NOTE] if (gt643_stormtrooper_condition__defaultCondition (player, npc)) { doAnimationAction (npc, "laugh_cackle"); //-- NPC: Got a problem with that? I dare you to bring it up with her. Haha. string_id message = new string_id (c_stringFile, "s_29"); utils.removeScriptVar (player, "conversation.gt643_stormtrooper.branchId"); npcEndConversationWithMessage (player, message); return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } // ---------------------------------------------------------------------- int gt643_stormtrooper_handleBranch15 (obj_id player, obj_id npc, string_id response) { //-- [BRANCH NOTE] //-- NPC: I don't care if you are a wild Rancor looking for refuge. If you are willing to help hold the line, I've got your back. Get it? //-- [RESPONSE NOTE] //-- PLAYER: Got it. I'm here to help. if (response == "s_49") { //-- [NOTE] if (gt643_stormtrooper_condition__defaultCondition (player, npc)) { doAnimationAction (npc, "shoo"); //-- NPC: Good to hear. Speak to HX-138. She's in charge. string_id message = new string_id (c_stringFile, "s_97"); int numberOfResponses = 0; boolean hasResponse = false; //-- PLAYER: She? boolean hasResponse0 = false; if (gt643_stormtrooper_condition__defaultCondition (player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse0 = true; } //-- PLAYER: I will thanks. boolean hasResponse1 = false; if (gt643_stormtrooper_condition__defaultCondition (player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse1 = true; } //-- PLAYER: How are you guys alive. boolean hasResponse2 = false; if (gt643_stormtrooper_condition__defaultCondition (player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse2 = true; } if (hasResponse) { int responseIndex = 0; string_id responses [] = new string_id [numberOfResponses]; if (hasResponse0) responses [responseIndex++] = new string_id (c_stringFile, "s_27"); if (hasResponse1) responses [responseIndex++] = new string_id (c_stringFile, "s_31"); if (hasResponse2) responses [responseIndex++] = new string_id (c_stringFile, "s_35"); utils.setScriptVar (player, "conversation.gt643_stormtrooper.branchId", 11); npcSpeak (player, message); npcSetConversationResponses (player, responses); } else { utils.removeScriptVar (player, "conversation.gt643_stormtrooper.branchId"); npcEndConversationWithMessage (player, message); } return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } // ---------------------------------------------------------------------- // ====================================================================== // User Script Triggers // ====================================================================== trigger OnInitialize () { if ((!isTangible (self)) || (isPlayer (self))) detachScript(self, "conversation.gt643_stormtrooper"); 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.gt643_stormtrooper"); 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 (gt643_stormtrooper_condition_hasRadio (player, npc)) { //-- NPC: Yeah...you can deliver that radio to Sogan...about time he earned his keep. string_id message = new string_id (c_stringFile, "s_51"); chat.chat (npc, player, message); return SCRIPT_CONTINUE; } //-- [NOTE] if (gt643_stormtrooper_condition_gotShuttleParts (player, npc)) { //-- NPC: Is it true you retrieved the shuttle parts we need to make that bucket of bolts fly? string_id message = new string_id (c_stringFile, "s_17"); int numberOfResponses = 0; boolean hasResponse = false; //-- PLAYER: Well I, uh... boolean hasResponse0 = false; if (gt643_stormtrooper_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_19"); utils.setScriptVar (player, "conversation.gt643_stormtrooper.branchId", 2); npcStartConversation (player, npc, "gt643_stormtrooper", message, responses); } else { chat.chat (npc, player, message); } return SCRIPT_CONTINUE; } //-- [NOTE] if (gt643_stormtrooper_condition_isShuttleParts (player, npc)) { //-- NPC: Hey, %TU, I wanted to let you know there is a wager regrading your future success. string_id message = new string_id (c_stringFile, "s_44"); int numberOfResponses = 0; boolean hasResponse = false; //-- PLAYER: Oh? boolean hasResponse0 = false; if (gt643_stormtrooper_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.gt643_stormtrooper.branchId", 5); prose_package pp = new prose_package (); pp.stringId = message; pp.actor.set (player); pp.target.set (npc); npcStartConversation (player, npc, "gt643_stormtrooper", 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 (gt643_stormtrooper_condition_rescuedAllSurvivors (player, npc)) { //-- NPC: Well...not too bad, %TU. I took a lot of courage to rescue those survivors. Would have been a shame if you'd come back undead or something. string_id message = new string_id (c_stringFile, "s_18"); int numberOfResponses = 0; boolean hasResponse = false; //-- PLAYER: Uh...thanks? boolean hasResponse0 = false; if (gt643_stormtrooper_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.gt643_stormtrooper.branchId", 7); prose_package pp = new prose_package (); pp.stringId = message; pp.actor.set (player); pp.target.set (npc); npcStartConversation (player, npc, "gt643_stormtrooper", 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 (gt643_stormtrooper_condition_isRescuing (player, npc)) { //-- NPC: I was asked to rescue these civilians...pffft. I have to hand it to you, %TU, you got guts. Good luck, I'll be here to back you up if you come in hot. Do us all a favor and don't come back if you...you know, get infected. string_id message = new string_id (c_stringFile, "s_43"); 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 (gt643_stormtrooper_condition_isNew (player, npc)) { doAnimationAction (player, "laugh"); //-- NPC: I hope you are reinforcements. string_id message = new string_id (c_stringFile, "s_73"); int numberOfResponses = 0; boolean hasResponse = false; //-- PLAYER: No, but I'm here to help. boolean hasResponse0 = false; if (gt643_stormtrooper_condition__defaultCondition (player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse0 = true; } //-- PLAYER: I'm a Rebel. You going to shoot me? boolean hasResponse1 = false; if (gt643_stormtrooper_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_96"); if (hasResponse1) responses [responseIndex++] = new string_id (c_stringFile, "s_41"); utils.setScriptVar (player, "conversation.gt643_stormtrooper.branchId", 10); npcStartConversation (player, npc, "gt643_stormtrooper", message, responses); } else { chat.chat (npc, player, message); } return SCRIPT_CONTINUE; } //-- [NOTE] if (gt643_stormtrooper_condition__defaultCondition (player, npc)) { //-- NPC: You can find medical assistance behind the hasty walls. Good luck. string_id message = new string_id (c_stringFile, "s_60"); 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 != "gt643_stormtrooper") return SCRIPT_CONTINUE; obj_id npc = self; int branchId = utils.getIntScriptVar (player, "conversation.gt643_stormtrooper.branchId"); if (branchId == 2 && gt643_stormtrooper_handleBranch2 (player, npc, response) == SCRIPT_CONTINUE) return SCRIPT_CONTINUE; if (branchId == 3 && gt643_stormtrooper_handleBranch3 (player, npc, response) == SCRIPT_CONTINUE) return SCRIPT_CONTINUE; if (branchId == 5 && gt643_stormtrooper_handleBranch5 (player, npc, response) == SCRIPT_CONTINUE) return SCRIPT_CONTINUE; if (branchId == 7 && gt643_stormtrooper_handleBranch7 (player, npc, response) == SCRIPT_CONTINUE) return SCRIPT_CONTINUE; if (branchId == 10 && gt643_stormtrooper_handleBranch10 (player, npc, response) == SCRIPT_CONTINUE) return SCRIPT_CONTINUE; if (branchId == 11 && gt643_stormtrooper_handleBranch11 (player, npc, response) == SCRIPT_CONTINUE) return SCRIPT_CONTINUE; if (branchId == 14 && gt643_stormtrooper_handleBranch14 (player, npc, response) == SCRIPT_CONTINUE) return SCRIPT_CONTINUE; if (branchId == 15 && gt643_stormtrooper_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.gt643_stormtrooper.branchId"); return SCRIPT_CONTINUE; } // ======================================================================