// ====================================================================== // // itp_veers_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/itp_veers_main"; // ====================================================================== // Script Conditions // ====================================================================== boolean itp_veers_main_condition__defaultCondition (obj_id player, obj_id npc) { return true; } // ---------------------------------------------------------------------- boolean itp_veers_main_condition_itp_veers_01_active (obj_id player, obj_id npc) { return groundquests.isQuestActive(player, "itp_veers_01"); } // ---------------------------------------------------------------------- boolean itp_veers_main_condition_itp_veers_01_complete (obj_id player, obj_id npc) { return groundquests.isTaskActive(player, "itp_veers_01", "itp_veers_01_03") || groundquests.hasCompletedQuest(player, "itp_veers_01"); } // ---------------------------------------------------------------------- boolean itp_veers_main_condition_itp_veers_02_active (obj_id player, obj_id npc) { return groundquests.isQuestActive(player, "itp_veers_02"); } // ---------------------------------------------------------------------- boolean itp_veers_main_condition_itp_veers_02_failed (obj_id player, obj_id npc) { return groundquests.isTaskActive(player, "itp_veers_02", "itp_veers_02_04_fail"); } // ---------------------------------------------------------------------- boolean itp_veers_main_condition_itp_veers_02_complete (obj_id player, obj_id npc) { return groundquests.isTaskActive(player, "itp_veers_02", "itp_veers_02_04") || groundquests.hasCompletedQuest(player, "itp_veers_02"); } // ---------------------------------------------------------------------- boolean itp_veers_main_condition_completedThrawn (obj_id player, obj_id npc) { return groundquests.hasCompletedQuest(player, "itp_thrawn_02"); } // ---------------------------------------------------------------------- boolean itp_veers_main_condition_notImperial (obj_id player, obj_id npc) { string playerFaction = factions.getFaction(player); if ( playerFaction == null || !playerFaction.equals("Imperial") ) { return true; } return false; } // ---------------------------------------------------------------------- boolean itp_veers_main_condition_imperial_isOnLeave (obj_id player, obj_id npc) { return factions.isOnLeave(player); } // ====================================================================== // Script Actions // ====================================================================== void itp_veers_main_action_itp_veers_01_granted (obj_id player, obj_id npc) { groundquests.grantQuest(player, "itp_veers_01"); } // ---------------------------------------------------------------------- void itp_veers_main_action_itp_veers_01_signal (obj_id player, obj_id npc) { groundquests.sendSignal(player, "itp_veers_01_03"); } // ---------------------------------------------------------------------- void itp_veers_main_action_itp_veers_02_signal (obj_id player, obj_id npc) { groundquests.sendSignal(player, "itp_veers_02_04"); } // ---------------------------------------------------------------------- void itp_veers_main_action_itp_veers_02_granted (obj_id player, obj_id npc) { if ( groundquests.isQuestActive(player, "itp_veers_02") ) { groundquests.clearQuest(player, "itp_veers_02"); } groundquests.grantQuest(player, "itp_veers_02"); } // ====================================================================== // Script %TO Tokens // ====================================================================== // ====================================================================== // Script %DI Tokens // ====================================================================== // ====================================================================== // Script %DF Tokens // ====================================================================== // ====================================================================== // handleBranch Functions // ====================================================================== int itp_veers_main_handleBranch4 (obj_id player, obj_id npc, string_id response) { //-- [BRANCH NOTE] //-- NPC: It was a trap, and you were caught in it. I would dearly like to make that Rebel officer pay. Maybe they will try the same ploy again if we set it up. Willing to try again? //-- [RESPONSE NOTE] //-- PLAYER: I am. if (response == "s_48") { //-- [NOTE] if (itp_veers_main_condition__defaultCondition (player, npc)) { itp_veers_main_action_itp_veers_02_granted (player, npc); //-- NPC: Good. You know what to do. I expect better results this time. string_id message = new string_id (c_stringFile, "s_51"); utils.removeScriptVar (player, "conversation.itp_veers_main.branchId"); npcEndConversationWithMessage (player, message); return SCRIPT_CONTINUE; } } //-- [RESPONSE NOTE] //-- PLAYER: No thank you. if (response == "s_49") { //-- [NOTE] if (itp_veers_main_condition__defaultCondition (player, npc)) { //-- NPC: Very well. string_id message = new string_id (c_stringFile, "s_50"); utils.removeScriptVar (player, "conversation.itp_veers_main.branchId"); npcEndConversationWithMessage (player, message); return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } // ---------------------------------------------------------------------- int itp_veers_main_handleBranch9 (obj_id player, obj_id npc, string_id response) { //-- [BRANCH NOTE] //-- NPC: A Rebel officer claims to have information for us. Go to Dantooine and investigate. //-- [RESPONSE NOTE] //-- PLAYER: Dantooine? I'm on my way. if (response == "s_22") { //-- [NOTE] if (itp_veers_main_condition__defaultCondition (player, npc)) { itp_veers_main_action_itp_veers_02_granted (player, npc); //-- NPC: Proceed with care. I do not know what you should expect. string_id message = new string_id (c_stringFile, "s_25"); utils.removeScriptVar (player, "conversation.itp_veers_main.branchId"); npcEndConversationWithMessage (player, message); return SCRIPT_CONTINUE; } } //-- [RESPONSE NOTE] //-- PLAYER: No thank you. if (response == "s_26") { //-- [NOTE] if (itp_veers_main_condition__defaultCondition (player, npc)) { //-- NPC: Very well. string_id message = new string_id (c_stringFile, "s_30"); utils.removeScriptVar (player, "conversation.itp_veers_main.branchId"); npcEndConversationWithMessage (player, message); return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } // ---------------------------------------------------------------------- int itp_veers_main_handleBranch13 (obj_id player, obj_id npc, string_id response) { //-- [BRANCH NOTE] //-- NPC: I have a mission for you. Infiltrate a Rebel base on Talus for information about the Rebel destruction of the Death Star. //-- [RESPONSE NOTE] //-- PLAYER: Yes sir. if (response == "s_36") { //-- [NOTE] if (itp_veers_main_condition__defaultCondition (player, npc)) { itp_veers_main_action_itp_veers_01_granted (player, npc); //-- NPC: The Rebels will pay for the loss of so many Imperial lives. string_id message = new string_id (c_stringFile, "s_39"); utils.removeScriptVar (player, "conversation.itp_veers_main.branchId"); npcEndConversationWithMessage (player, message); return SCRIPT_CONTINUE; } } //-- [RESPONSE NOTE] //-- PLAYER: No thank you. if (response == "s_41") { //-- [NOTE] if (itp_veers_main_condition__defaultCondition (player, npc)) { //-- NPC: Very well. string_id message = new string_id (c_stringFile, "s_45"); utils.removeScriptVar (player, "conversation.itp_veers_main.branchId"); npcEndConversationWithMessage (player, message); return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } // ---------------------------------------------------------------------- // ====================================================================== // User Script Triggers // ====================================================================== trigger OnInitialize () { if ((!isMob (self)) || (isPlayer (self))) detachScript(self, "conversation.itp_veers_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.itp_veers_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 (itp_veers_main_condition_notImperial (player, npc)) { //-- NPC: The function of this base is not of your concern. I would suggest you make yourself scarce. string_id message = new string_id (c_stringFile, "s_44"); chat.chat (npc, player, message); return SCRIPT_CONTINUE; } //-- [NOTE] if (!itp_veers_main_condition_completedThrawn (player, npc)) { //-- NPC: I do not have any orders for you, trooper. Try elsewhere in the Captain Thrawn. string_id message = new string_id (c_stringFile, "s_46"); chat.chat (npc, player, message); return SCRIPT_CONTINUE; } //-- [NOTE] if (itp_veers_main_condition_imperial_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 (itp_veers_main_condition_itp_veers_02_failed (player, npc)) { //-- NPC: It was a trap, and you were caught in it. I would dearly like to make that Rebel officer pay. Maybe they will try the same ploy again if we set it up. Willing to try again? string_id message = new string_id (c_stringFile, "s_47"); int numberOfResponses = 0; boolean hasResponse = false; //-- PLAYER: I am. boolean hasResponse0 = false; if (itp_veers_main_condition__defaultCondition (player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse0 = true; } //-- PLAYER: No thank you. boolean hasResponse1 = false; if (itp_veers_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_48"); if (hasResponse1) responses [responseIndex++] = new string_id (c_stringFile, "s_49"); utils.setScriptVar (player, "conversation.itp_veers_main.branchId", 4); npcStartConversation (player, npc, "itp_veers_main", message, responses); } else { chat.chat (npc, player, message); } return SCRIPT_CONTINUE; } //-- [NOTE] if (itp_veers_main_condition_itp_veers_02_complete (player, npc)) { itp_veers_main_action_itp_veers_02_signal (player, npc); //-- NPC: So it was a trap? I should have known. But thanks to you, that Rebel will no longer be a threat. I have even better news. You have been given the honor of an audience with the Emperor. I suggest you don't keep him waiting. string_id message = new string_id (c_stringFile, "s_28"); chat.chat (npc, player, message); return SCRIPT_CONTINUE; } //-- [NOTE] if (itp_veers_main_condition_itp_veers_02_active (player, npc)) { //-- NPC: A Rebel officer claims to have information for us. Go to Dantooine and investigate. Proceed with care. string_id message = new string_id (c_stringFile, "s_16"); chat.chat (npc, player, message); return SCRIPT_CONTINUE; } //-- [NOTE] if (itp_veers_main_condition_itp_veers_01_complete (player, npc)) { itp_veers_main_action_itp_veers_01_signal (player, npc); //-- NPC: A Rebel officer claims to have information for us. Go to Dantooine and investigate. string_id message = new string_id (c_stringFile, "s_20"); int numberOfResponses = 0; boolean hasResponse = false; //-- PLAYER: Dantooine? I'm on my way. boolean hasResponse0 = false; if (itp_veers_main_condition__defaultCondition (player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse0 = true; } //-- PLAYER: No thank you. boolean hasResponse1 = false; if (itp_veers_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.itp_veers_main.branchId", 9); npcStartConversation (player, npc, "itp_veers_main", message, responses); } else { chat.chat (npc, player, message); } return SCRIPT_CONTINUE; } //-- [NOTE] if (itp_veers_main_condition_itp_veers_01_active (player, npc)) { //-- NPC: Infiltrate a Rebel base on Talus for information about the Rebel destruction of the Death Star. string_id message = new string_id (c_stringFile, "s_32"); chat.chat (npc, player, message); return SCRIPT_CONTINUE; } //-- [NOTE] if (itp_veers_main_condition__defaultCondition (player, npc)) { //-- NPC: I have a mission for you. Infiltrate a Rebel base on Talus for information about the Rebel destruction of the Death Star. string_id message = new string_id (c_stringFile, "s_34"); int numberOfResponses = 0; boolean hasResponse = false; //-- PLAYER: Yes sir. boolean hasResponse0 = false; if (itp_veers_main_condition__defaultCondition (player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse0 = true; } //-- PLAYER: No thank you. boolean hasResponse1 = false; if (itp_veers_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.itp_veers_main.branchId", 13); npcStartConversation (player, npc, "itp_veers_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 != "itp_veers_main") return SCRIPT_CONTINUE; obj_id npc = self; int branchId = utils.getIntScriptVar (player, "conversation.itp_veers_main.branchId"); if (branchId == 4 && itp_veers_main_handleBranch4 (player, npc, response) == SCRIPT_CONTINUE) return SCRIPT_CONTINUE; if (branchId == 9 && itp_veers_main_handleBranch9 (player, npc, response) == SCRIPT_CONTINUE) return SCRIPT_CONTINUE; if (branchId == 13 && itp_veers_main_handleBranch13 (player, npc, response) == SCRIPT_CONTINUE) return SCRIPT_CONTINUE; chat.chat (npc, "Error: Fell through all branches and responses for OnNpcConversationResponse."); utils.removeScriptVar (player, "conversation.itp_veers_main.branchId"); return SCRIPT_CONTINUE; } // ======================================================================