// ====================================================================== // // talus_dearic_droid.script // // // // Created with SwgConversationEditor 1.36 - DO NOT EDIT THIS AUTO-GENERATED FILE! // // ====================================================================== // ====================================================================== // Library Includes // ====================================================================== include library.ai_lib; include library.chat; include library.groundquests; include library.utils; // ====================================================================== // Script Constants // ====================================================================== string c_stringFile = "conversation/talus_dearic_droid"; // ====================================================================== // Script Conditions // ====================================================================== boolean talus_dearic_droid_condition__defaultCondition (obj_id player, obj_id npc) { return true; } // ---------------------------------------------------------------------- boolean talus_dearic_droid_condition_onDroidPassword (obj_id player, obj_id npc) { return groundquests.isTaskActive(player, "talus_dearic_better_genetics", "better_genetics_retrieve_01_03i"); } // ---------------------------------------------------------------------- boolean talus_dearic_droid_condition_passwordCompleted (obj_id player, obj_id npc) { return groundquests.hasCompletedTask(player, "talus_dearic_better_genetics", "better_genetics_retrieve_01_03i"); } // ====================================================================== // Script Actions // ====================================================================== void talus_dearic_droid_action_signalDroidPassword (obj_id player, obj_id npc) { groundquests.sendSignal(player, "better_genetics_retrieve_01_03i"); } // ====================================================================== // Script %TO Tokens // ====================================================================== // ====================================================================== // Script %DI Tokens // ====================================================================== // ====================================================================== // Script %DF Tokens // ====================================================================== // ====================================================================== // handleBranch Functions // ====================================================================== int talus_dearic_droid_handleBranch2 (obj_id player, obj_id npc, string_id response) { //-- [BRANCH NOTE] //-- NPC: You must leave immediately. //-- [RESPONSE NOTE] //-- PLAYER: I'm here to shut down this facility. if (response == "s_7") { //-- [NOTE] if (talus_dearic_droid_condition__defaultCondition (player, npc)) { doAnimationAction (npc, "shake_head_no"); //-- NPC: I cannot allow that. My master expressly stated I was to protect his work. string_id message = new string_id (c_stringFile, "s_9"); int numberOfResponses = 0; boolean hasResponse = false; //-- PLAYER: Your Master is dead. The experiment is a failure. boolean hasResponse0 = false; if (talus_dearic_droid_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_11"); utils.setScriptVar (player, "conversation.talus_dearic_droid.branchId", 3); npcSpeak (player, message); npcSetConversationResponses (player, responses); } else { utils.removeScriptVar (player, "conversation.talus_dearic_droid.branchId"); npcEndConversationWithMessage (player, message); } return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } // ---------------------------------------------------------------------- int talus_dearic_droid_handleBranch3 (obj_id player, obj_id npc, string_id response) { //-- [BRANCH NOTE] //-- NPC: I cannot allow that. My master expressly stated I was to protect his work. //-- [RESPONSE NOTE] //-- PLAYER: Your Master is dead. The experiment is a failure. if (response == "s_11") { //-- [NOTE] if (talus_dearic_droid_condition__defaultCondition (player, npc)) { doAnimationAction (npc, "cover_mouth"); //-- NPC: That cannot be! Before these creatures came he was just fine. string_id message = new string_id (c_stringFile, "s_13"); int numberOfResponses = 0; boolean hasResponse = false; //-- PLAYER: These creatures killed him. They are going to kill everyone on Talus if you do not help me! boolean hasResponse0 = false; if (talus_dearic_droid_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_15"); utils.setScriptVar (player, "conversation.talus_dearic_droid.branchId", 4); npcSpeak (player, message); npcSetConversationResponses (player, responses); } else { utils.removeScriptVar (player, "conversation.talus_dearic_droid.branchId"); npcEndConversationWithMessage (player, message); } return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } // ---------------------------------------------------------------------- int talus_dearic_droid_handleBranch4 (obj_id player, obj_id npc, string_id response) { //-- [BRANCH NOTE] //-- NPC: That cannot be! Before these creatures came he was just fine. //-- [RESPONSE NOTE] //-- PLAYER: These creatures killed him. They are going to kill everyone on Talus if you do not help me! if (response == "s_15") { //-- [NOTE] if (talus_dearic_droid_condition__defaultCondition (player, npc)) { //-- NPC: Everyone? string_id message = new string_id (c_stringFile, "s_18"); int numberOfResponses = 0; boolean hasResponse = false; //-- PLAYER: Yes, you will be alone. boolean hasResponse0 = false; if (talus_dearic_droid_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_20"); utils.setScriptVar (player, "conversation.talus_dearic_droid.branchId", 5); npcSpeak (player, message); npcSetConversationResponses (player, responses); } else { utils.removeScriptVar (player, "conversation.talus_dearic_droid.branchId"); npcEndConversationWithMessage (player, message); } return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } // ---------------------------------------------------------------------- int talus_dearic_droid_handleBranch5 (obj_id player, obj_id npc, string_id response) { //-- [BRANCH NOTE] //-- NPC: Everyone? //-- [RESPONSE NOTE] //-- PLAYER: Yes, you will be alone. if (response == "s_20") { //-- [NOTE] if (talus_dearic_droid_condition__defaultCondition (player, npc)) { doAnimationAction (npc, "rub_chin_thoughtful"); //-- NPC: I...I do not want that. I don't believe that was master's intent. string_id message = new string_id (c_stringFile, "s_22"); int numberOfResponses = 0; boolean hasResponse = false; //-- PLAYER: Then please give me the password to his terminal. boolean hasResponse0 = false; if (talus_dearic_droid_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_24"); utils.setScriptVar (player, "conversation.talus_dearic_droid.branchId", 6); npcSpeak (player, message); npcSetConversationResponses (player, responses); } else { utils.removeScriptVar (player, "conversation.talus_dearic_droid.branchId"); npcEndConversationWithMessage (player, message); } return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } // ---------------------------------------------------------------------- int talus_dearic_droid_handleBranch6 (obj_id player, obj_id npc, string_id response) { //-- [BRANCH NOTE] //-- NPC: I...I do not want that. I don't believe that was master's intent. //-- [RESPONSE NOTE] //-- PLAYER: Then please give me the password to his terminal. if (response == "s_24") { //-- [NOTE] if (talus_dearic_droid_condition__defaultCondition (player, npc)) { doAnimationAction (npc, "explain"); talus_dearic_droid_action_signalDroidPassword (player, npc); //-- NPC: It is 'zerek species'. string_id message = new string_id (c_stringFile, "s_26"); int numberOfResponses = 0; boolean hasResponse = false; //-- PLAYER: Good work. You've served your master well. boolean hasResponse0 = false; if (talus_dearic_droid_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_28"); utils.setScriptVar (player, "conversation.talus_dearic_droid.branchId", 7); npcSpeak (player, message); npcSetConversationResponses (player, responses); } else { utils.removeScriptVar (player, "conversation.talus_dearic_droid.branchId"); npcEndConversationWithMessage (player, message); } return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } // ---------------------------------------------------------------------- int talus_dearic_droid_handleBranch7 (obj_id player, obj_id npc, string_id response) { //-- [BRANCH NOTE] //-- NPC: It is 'zerek species'. //-- [RESPONSE NOTE] //-- PLAYER: Good work. You've served your master well. if (response == "s_28") { //-- [NOTE] if (talus_dearic_droid_condition__defaultCondition (player, npc)) { doAnimationAction (npc, "nod"); //-- NPC: Indeed. string_id message = new string_id (c_stringFile, "s_30"); utils.removeScriptVar (player, "conversation.talus_dearic_droid.branchId"); npcEndConversationWithMessage (player, message); return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } // ---------------------------------------------------------------------- // ====================================================================== // User Script Triggers // ====================================================================== trigger OnInitialize () { if ((!isTangible (self)) || (isPlayer (self))) detachScript(self, "conversation.talus_dearic_droid"); 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.talus_dearic_droid"); 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 (talus_dearic_droid_condition_passwordCompleted (player, npc)) { doAnimationAction (npc, "explain"); //-- NPC: You have the information. You should use it on master's terminal. string_id message = new string_id (c_stringFile, "s_17"); chat.chat (npc, player, message); return SCRIPT_CONTINUE; } //-- [NOTE] if (talus_dearic_droid_condition_onDroidPassword (player, npc)) { doAnimationAction (npc, "point_accusingly"); //-- NPC: You must leave immediately. string_id message = new string_id (c_stringFile, "s_5"); int numberOfResponses = 0; boolean hasResponse = false; //-- PLAYER: I'm here to shut down this facility. boolean hasResponse0 = false; if (talus_dearic_droid_condition__defaultCondition (player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse0 = true; } if (hasResponse) { int responseIndex = 0; string_id responses [] = new string_id [numberOfResponses]; if (hasResponse0) responses [responseIndex++] = new string_id (c_stringFile, "s_7"); utils.setScriptVar (player, "conversation.talus_dearic_droid.branchId", 2); npcStartConversation (player, npc, "talus_dearic_droid", message, responses); } else { chat.chat (npc, player, message); } return SCRIPT_CONTINUE; } //-- [NOTE] if (talus_dearic_droid_condition__defaultCondition (player, npc)) { doAnimationAction (npc, "stop"); //-- NPC: I have been instructed not to assist intruders. string_id message = new string_id (c_stringFile, "s_32"); 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 != "talus_dearic_droid") return SCRIPT_CONTINUE; obj_id npc = self; int branchId = utils.getIntScriptVar (player, "conversation.talus_dearic_droid.branchId"); if (branchId == 2 && talus_dearic_droid_handleBranch2 (player, npc, response) == SCRIPT_CONTINUE) return SCRIPT_CONTINUE; if (branchId == 3 && talus_dearic_droid_handleBranch3 (player, npc, response) == SCRIPT_CONTINUE) return SCRIPT_CONTINUE; if (branchId == 4 && talus_dearic_droid_handleBranch4 (player, npc, response) == SCRIPT_CONTINUE) return SCRIPT_CONTINUE; if (branchId == 5 && talus_dearic_droid_handleBranch5 (player, npc, response) == SCRIPT_CONTINUE) return SCRIPT_CONTINUE; if (branchId == 6 && talus_dearic_droid_handleBranch6 (player, npc, response) == SCRIPT_CONTINUE) return SCRIPT_CONTINUE; if (branchId == 7 && talus_dearic_droid_handleBranch7 (player, npc, response) == SCRIPT_CONTINUE) return SCRIPT_CONTINUE; chat.chat (npc, "Error: Fell through all branches and responses for OnNpcConversationResponse."); utils.removeScriptVar (player, "conversation.talus_dearic_droid.branchId"); return SCRIPT_CONTINUE; } // ======================================================================