// ====================================================================== // // rtp_dodonna_main.script // // // // Created with SwgConversationEditor 1.36 - DO NOT EDIT THIS AUTO-GENERATED FILE! // // ====================================================================== // ====================================================================== // Library Includes // ====================================================================== include library.ai_lib; include library.chat; include library.factions; include library.groundquests; include library.space_quest; include library.utils; // ====================================================================== // Script Constants // ====================================================================== string c_stringFile = "conversation/rtp_dodonna_main"; // ====================================================================== // Script Conditions // ====================================================================== boolean rtp_dodonna_main_condition__defaultCondition (obj_id player, obj_id npc) { return true; } // ---------------------------------------------------------------------- boolean rtp_dodonna_main_condition_rtp_dodonna_01_active (obj_id player, obj_id npc) { return groundquests.isQuestActive(player, "rtp_dodonna_01"); } // ---------------------------------------------------------------------- boolean rtp_dodonna_main_condition_rtp_dodonna_01_complete (obj_id player, obj_id npc) { return groundquests.isTaskActive(player, "rtp_dodonna_01", "rtp_dodonna_01_02") || groundquests.hasCompletedQuest(player, "rtp_dodonna_01"); } // ---------------------------------------------------------------------- boolean rtp_dodonna_main_condition_rtp_dodonna_02_active (obj_id player, obj_id npc) { return groundquests.isQuestActive(player, "rtp_dodonna_02"); } // ---------------------------------------------------------------------- boolean rtp_dodonna_main_condition_rtp_dodonna_03_complete (obj_id player, obj_id npc) { return groundquests.isTaskActive(player, "rtp_dodonna_03", "rtp_dodonna_03_02") || groundquests.hasCompletedQuest(player, "rtp_dodonna_03"); } // ---------------------------------------------------------------------- boolean rtp_dodonna_main_condition_rtp_dodonna_03_active (obj_id player, obj_id npc) { return groundquests.isQuestActive(player, "rtp_dodonna_03"); } // ---------------------------------------------------------------------- boolean rtp_dodonna_main_condition_rtp_dodonna_02_complete (obj_id player, obj_id npc) { return groundquests.isTaskActive(player, "rtp_dodonna_02", "rtp_dodonna_02_02") || groundquests.hasCompletedQuest(player, "rtp_dodonna_02"); } // ---------------------------------------------------------------------- boolean rtp_dodonna_main_condition_completedMonMothma (obj_id player, obj_id npc) { return groundquests.hasCompletedQuest(player, "rtp_mon_mothma_01"); } // ---------------------------------------------------------------------- boolean rtp_dodonna_main_condition_notRebel (obj_id player, obj_id npc) { string playerFaction = factions.getFaction(player); if ( playerFaction == null || !playerFaction.equals("Rebel") ) { return true; } return false; } // ---------------------------------------------------------------------- boolean rtp_dodonna_main_condition_rebel_isOnLeave (obj_id player, obj_id npc) { return factions.isOnLeave(player); } // ====================================================================== // Script Actions // ====================================================================== void rtp_dodonna_main_action_rtp_dodonna_01_granted (obj_id player, obj_id npc) { groundquests.grantQuest(player, "rtp_dodonna_01"); } // ---------------------------------------------------------------------- void rtp_dodonna_main_action_rtp_dodonna_01_signal (obj_id player, obj_id npc) { groundquests.sendSignal(player, "rtp_dodonna_01_02"); } // ---------------------------------------------------------------------- void rtp_dodonna_main_action_rtp_dodonna_03_signal (obj_id player, obj_id npc) { groundquests.sendSignal(player, "rtp_dodonna_03_02"); } // ---------------------------------------------------------------------- void rtp_dodonna_main_action_rtp_dodonna_02_signal (obj_id player, obj_id npc) { groundquests.sendSignal(player, "rtp_dodonna_02_02"); } // ---------------------------------------------------------------------- void rtp_dodonna_main_action_rtp_dodonna_02_granted (obj_id player, obj_id npc) { groundquests.grantQuest(player, "rtp_dodonna_02"); } // ---------------------------------------------------------------------- void rtp_dodonna_main_action_rtp_dodonna_03_granted (obj_id player, obj_id npc) { groundquests.grantQuest(player, "rtp_dodonna_03"); } // ====================================================================== // Script %TO Tokens // ====================================================================== // ====================================================================== // Script %DI Tokens // ====================================================================== // ====================================================================== // Script %DF Tokens // ====================================================================== // ====================================================================== // handleBranch Functions // ====================================================================== int rtp_dodonna_main_handleBranch6 (obj_id player, obj_id npc, string_id response) { //-- [BRANCH NOTE] //-- NPC: Very good work. At the very least, their TIE bombers will have a harder time finding targets. I have one last assignment for you. We've found a possible location for a new base of operations. I must get word to Admiral Ackbar. //-- [RESPONSE NOTE] //-- PLAYER: I'm ready. if (response == "s_31") { //-- [NOTE] if (rtp_dodonna_main_condition__defaultCondition (player, npc)) { rtp_dodonna_main_action_rtp_dodonna_03_granted (player, npc); //-- NPC: We have no equipment left with which to send a transmission. Instead, I'm having an X-Wing fly to Dantooine with the missive. To help ensure his safety, I need you to draw Imperial troops to a decoy and keep them occupied until the true pilot can get safely away. string_id message = new string_id (c_stringFile, "s_33"); utils.removeScriptVar (player, "conversation.rtp_dodonna_main.branchId"); npcEndConversationWithMessage (player, message); return SCRIPT_CONTINUE; } } //-- [RESPONSE NOTE] //-- PLAYER: No thank you. if (response == "s_35") { //-- [NOTE] if (rtp_dodonna_main_condition__defaultCondition (player, npc)) { //-- NPC: Very well. string_id message = new string_id (c_stringFile, "s_37"); utils.removeScriptVar (player, "conversation.rtp_dodonna_main.branchId"); npcEndConversationWithMessage (player, message); return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } // ---------------------------------------------------------------------- int rtp_dodonna_main_handleBranch10 (obj_id player, obj_id npc, string_id response) { //-- [BRANCH NOTE] //-- NPC: That's one less AT-ST to worry about. I have another assignment for you. A squad of stormtroopers are marking our encampments as targets for TIE bombers. I need that squad neutralized. //-- [RESPONSE NOTE] //-- PLAYER: I'm on it. if (response == "s_22") { //-- [NOTE] if (rtp_dodonna_main_condition__defaultCondition (player, npc)) { rtp_dodonna_main_action_rtp_dodonna_02_granted (player, npc); //-- NPC: Do not delay. Those bombers are hampering our efforts to get personnel and equipment off of Yavin IV. string_id message = new string_id (c_stringFile, "s_25"); utils.removeScriptVar (player, "conversation.rtp_dodonna_main.branchId"); npcEndConversationWithMessage (player, message); return SCRIPT_CONTINUE; } } //-- [RESPONSE NOTE] //-- PLAYER: No thank you. if (response == "s_26") { //-- [NOTE] if (rtp_dodonna_main_condition__defaultCondition (player, npc)) { //-- NPC: Very well. string_id message = new string_id (c_stringFile, "s_30"); utils.removeScriptVar (player, "conversation.rtp_dodonna_main.branchId"); npcEndConversationWithMessage (player, message); return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } // ---------------------------------------------------------------------- int rtp_dodonna_main_handleBranch14 (obj_id player, obj_id npc, string_id response) { //-- [BRANCH NOTE] //-- NPC: Reporting in? Good. An AT-ST was damaged in a battle with our troops. Imperial forces are repairing it for their next assault. Go destroy it before those repairs are complete. //-- [RESPONSE NOTE] //-- PLAYER: I'll take care of it. if (response == "s_36") { //-- [NOTE] if (rtp_dodonna_main_condition__defaultCondition (player, npc)) { rtp_dodonna_main_action_rtp_dodonna_01_granted (player, npc); //-- NPC: Very good. Anything we can do to hinder them will allow more of our people to escape. string_id message = new string_id (c_stringFile, "s_39"); utils.removeScriptVar (player, "conversation.rtp_dodonna_main.branchId"); npcEndConversationWithMessage (player, message); return SCRIPT_CONTINUE; } } //-- [RESPONSE NOTE] //-- PLAYER: No thank you. if (response == "s_41") { //-- [NOTE] if (rtp_dodonna_main_condition__defaultCondition (player, npc)) { //-- NPC: Very well. string_id message = new string_id (c_stringFile, "s_45"); utils.removeScriptVar (player, "conversation.rtp_dodonna_main.branchId"); npcEndConversationWithMessage (player, message); return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } // ---------------------------------------------------------------------- // ====================================================================== // User Script Triggers // ====================================================================== trigger OnInitialize () { if ((!isMob (self)) || (isPlayer (self))) detachScript(self, "conversation.rtp_dodonna_main"); 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); faceTo( self, player ); return SCRIPT_CONTINUE; } trigger OnIncapacitated (obj_id killer) { clearCondition (self, CONDITION_CONVERSABLE); detachScript (self, "conversation.rtp_dodonna_main"); 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 (rtp_dodonna_main_condition_notRebel (player, npc)) { //-- NPC: You do not belong here. I politely suggest that you move on. string_id message = new string_id (c_stringFile, "s_44"); chat.chat (npc, player, message); return SCRIPT_CONTINUE; } //-- [NOTE] if (!rtp_dodonna_main_condition_completedMonMothma (player, npc)) { //-- NPC: I do not have any orders for you, trooper. Have you spoken to Mon Mothma on Dantooine? string_id message = new string_id (c_stringFile, "s_46"); chat.chat (npc, player, message); return SCRIPT_CONTINUE; } //-- [NOTE] if (rtp_dodonna_main_condition_rebel_isOnLeave (player, npc)) { //-- NPC: I'm afraid I only have orders I have are for those on active duty. string_id message = new string_id (c_stringFile, "s_43"); chat.chat (npc, player, message); return SCRIPT_CONTINUE; } //-- [NOTE] if (rtp_dodonna_main_condition_rtp_dodonna_03_complete (player, npc)) { rtp_dodonna_main_action_rtp_dodonna_03_signal (player, npc); //-- NPC: It's in the hands of that X-Wing's pilot now. You did your part and should be commended for it. Thank you. Before you leave Yavin IV, be sure to speak with Luke Skywalker. string_id message = new string_id (c_stringFile, "s_9"); chat.chat (npc, player, message); return SCRIPT_CONTINUE; } //-- [NOTE] if (rtp_dodonna_main_condition_rtp_dodonna_03_active (player, npc)) { //-- NPC: We've found a possible location for a new base of operations. I must get word to Admiral Ackbar, but we have no equipment left with which to send a transmission. Instead, I'm having an X-Wing fly to Dantooine with the missive. To help ensure his safety, I need you to draw Imperial troops to a decoy and keep them occupied until the true pilot can get safely away. string_id message = new string_id (c_stringFile, "s_29"); chat.chat (npc, player, message); return SCRIPT_CONTINUE; } //-- [NOTE] if (rtp_dodonna_main_condition_rtp_dodonna_02_complete (player, npc)) { rtp_dodonna_main_action_rtp_dodonna_02_signal (player, npc); //-- NPC: Very good work. At the very least, their TIE bombers will have a harder time finding targets. I have one last assignment for you. We've found a possible location for a new base of operations. I must get word to Admiral Ackbar. string_id message = new string_id (c_stringFile, "s_28"); int numberOfResponses = 0; boolean hasResponse = false; //-- PLAYER: I'm ready. boolean hasResponse0 = false; if (rtp_dodonna_main_condition__defaultCondition (player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse0 = true; } //-- PLAYER: No thank you. boolean hasResponse1 = false; if (rtp_dodonna_main_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_31"); if (hasResponse1) responses [responseIndex++] = new string_id (c_stringFile, "s_35"); utils.setScriptVar (player, "conversation.rtp_dodonna_main.branchId", 6); npcStartConversation (player, npc, "rtp_dodonna_main", message, responses); } else { chat.chat (npc, player, message); } return SCRIPT_CONTINUE; } //-- [NOTE] if (rtp_dodonna_main_condition_rtp_dodonna_02_active (player, npc)) { //-- NPC: A squad of stormtroopers are marking our encampments as targets for TIE bombers. I need that squad neutralized. string_id message = new string_id (c_stringFile, "s_16"); chat.chat (npc, player, message); return SCRIPT_CONTINUE; } //-- [NOTE] if (rtp_dodonna_main_condition_rtp_dodonna_01_complete (player, npc)) { rtp_dodonna_main_action_rtp_dodonna_01_signal (player, npc); //-- NPC: That's one less AT-ST to worry about. I have another assignment for you. A squad of stormtroopers are marking our encampments as targets for TIE bombers. I need that squad neutralized. string_id message = new string_id (c_stringFile, "s_20"); int numberOfResponses = 0; boolean hasResponse = false; //-- PLAYER: I'm on it. boolean hasResponse0 = false; if (rtp_dodonna_main_condition__defaultCondition (player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse0 = true; } //-- PLAYER: No thank you. boolean hasResponse1 = false; if (rtp_dodonna_main_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_22"); if (hasResponse1) responses [responseIndex++] = new string_id (c_stringFile, "s_26"); utils.setScriptVar (player, "conversation.rtp_dodonna_main.branchId", 10); npcStartConversation (player, npc, "rtp_dodonna_main", message, responses); } else { chat.chat (npc, player, message); } return SCRIPT_CONTINUE; } //-- [NOTE] if (rtp_dodonna_main_condition_rtp_dodonna_01_active (player, npc)) { //-- NPC: An AT-ST was damaged in a battle with our troops. Imperial forces are repairing it for their next assault. Go destroy it before those repairs are complete. string_id message = new string_id (c_stringFile, "s_32"); chat.chat (npc, player, message); return SCRIPT_CONTINUE; } //-- [NOTE] if (rtp_dodonna_main_condition__defaultCondition (player, npc)) { //-- NPC: Reporting in? Good. An AT-ST was damaged in a battle with our troops. Imperial forces are repairing it for their next assault. Go destroy it before those repairs are complete. string_id message = new string_id (c_stringFile, "s_34"); int numberOfResponses = 0; boolean hasResponse = false; //-- PLAYER: I'll take care of it. boolean hasResponse0 = false; if (rtp_dodonna_main_condition__defaultCondition (player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse0 = true; } //-- PLAYER: No thank you. boolean hasResponse1 = false; if (rtp_dodonna_main_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_36"); if (hasResponse1) responses [responseIndex++] = new string_id (c_stringFile, "s_41"); utils.setScriptVar (player, "conversation.rtp_dodonna_main.branchId", 14); npcStartConversation (player, npc, "rtp_dodonna_main", message, responses); } else { 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 != "rtp_dodonna_main") return SCRIPT_CONTINUE; obj_id npc = self; int branchId = utils.getIntScriptVar (player, "conversation.rtp_dodonna_main.branchId"); if (branchId == 6 && rtp_dodonna_main_handleBranch6 (player, npc, response) == SCRIPT_CONTINUE) return SCRIPT_CONTINUE; if (branchId == 10 && rtp_dodonna_main_handleBranch10 (player, npc, response) == SCRIPT_CONTINUE) return SCRIPT_CONTINUE; if (branchId == 14 && rtp_dodonna_main_handleBranch14 (player, npc, response) == SCRIPT_CONTINUE) return SCRIPT_CONTINUE; chat.chat (npc, "Error: Fell through all branches and responses for OnNpcConversationResponse."); utils.removeScriptVar (player, "conversation.rtp_dodonna_main.branchId"); return SCRIPT_CONTINUE; } // ======================================================================