// ====================================================================== // // dera_darklighter.script // Copyright 2004, Sony Online Entertainment // All Rights Reserved. // // 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/dera_darklighter"; // ====================================================================== // Script Conditions // ====================================================================== boolean dera_darklighter_condition__defaultCondition (obj_id player, obj_id npc) { return true; } // ---------------------------------------------------------------------- boolean dera_darklighter_condition_startWithDera (obj_id player, obj_id npc) { return groundquests.isTaskActive(player, "huff_darklighter_dera", "speakToDera"); } // ---------------------------------------------------------------------- boolean dera_darklighter_condition_workingWithDera (obj_id player, obj_id npc) { return groundquests.isTaskActive(player, "huff_darklighter_dera", "eliminateVileTuskens"); } // ---------------------------------------------------------------------- boolean dera_darklighter_condition_returningToDera (obj_id player, obj_id npc) { return groundquests.isTaskActive(player, "huff_darklighter_dera", "returnToDera"); } // ---------------------------------------------------------------------- boolean dera_darklighter_condition_doneWithDera (obj_id player, obj_id npc) { return groundquests.hasCompletedTask(player, "huff_darklighter_dera", "returnToDera"); } // ====================================================================== // Script Actions // ====================================================================== void dera_darklighter_action_signal_startDera (obj_id player, obj_id npc) { groundquests.sendSignal(player, "speakToDera"); } // ---------------------------------------------------------------------- void dera_darklighter_action_signal_endDera (obj_id player, obj_id npc) { groundquests.sendSignal(player, "returnToDera"); } // ====================================================================== // Script %TO Tokens // ====================================================================== // ====================================================================== // Script %DI Tokens // ====================================================================== // ====================================================================== // Script %DF Tokens // ====================================================================== // ====================================================================== // handleBranch Functions // ====================================================================== int dera_darklighter_handleBranch4 (obj_id player, obj_id npc, string_id response) { //-- [BRANCH NOTE] //-- NPC: Huff sent you to check on me? He needs to learn that I can take care of myself. But since you're here, I can use your help. //-- [RESPONSE NOTE] //-- PLAYER: What is it you would like me to do? if (response == "s_37") { //-- [NOTE] if (dera_darklighter_condition__defaultCondition (player, npc)) { dera_darklighter_action_signal_startDera (player, npc); //-- NPC: The Tusken Raiders in that cave over yonder are a threat to this area. I need you to deal with them. And by that, I mean eliminate them. string_id message = new string_id (c_stringFile, "s_38"); utils.removeScriptVar (player, "conversation.dera_darklighter.branchId"); npcEndConversationWithMessage (player, message); return SCRIPT_CONTINUE; } } //-- [RESPONSE NOTE] //-- PLAYER: No thanks. I'm not interested. if (response == "s_39") { //-- [NOTE] if (dera_darklighter_condition__defaultCondition (player, npc)) { //-- NPC: Well then why did you come all the way out here? Shoo now...go away. string_id message = new string_id (c_stringFile, "s_40"); utils.removeScriptVar (player, "conversation.dera_darklighter.branchId"); npcEndConversationWithMessage (player, message); return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } // ---------------------------------------------------------------------- // ====================================================================== // User Script Triggers // ====================================================================== trigger OnInitialize () { if ((!isMob (self)) || (isPlayer (self))) detachScript(self, "conversation.dera_darklighter"); 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.dera_darklighter"); 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 (dera_darklighter_condition_doneWithDera (player, npc)) { //-- NPC: Those Tusken Raiders are still a threat, but the chaos you've sown will buy me time to find a more permanent solution. Thank you. string_id message = new string_id (c_stringFile, "s_35"); chat.chat (npc, player, message); return SCRIPT_CONTINUE; } //-- [NOTE] if (dera_darklighter_condition_returningToDera (player, npc)) { dera_darklighter_action_signal_endDera (player, npc); //-- NPC: Well done. That should at least slow them down until I can get a larger fighting force to go in and end them once and for all. string_id message = new string_id (c_stringFile, "s_36"); chat.chat (npc, player, message); return SCRIPT_CONTINUE; } //-- [NOTE] if (dera_darklighter_condition_workingWithDera (player, npc)) { //-- NPC: Go on. Those Tusken Raiders won't be killing themselves. At least, I don't think they will. string_id message = new string_id (c_stringFile, "s_4"); chat.chat (npc, player, message); return SCRIPT_CONTINUE; } //-- [NOTE] if (dera_darklighter_condition_startWithDera (player, npc)) { doAnimationAction (npc, "shake_head_disgust"); //-- NPC: Huff sent you to check on me? He needs to learn that I can take care of myself. But since you're here, I can use your help. string_id message = new string_id (c_stringFile, "s_6"); int numberOfResponses = 0; boolean hasResponse = false; //-- PLAYER: What is it you would like me to do? boolean hasResponse0 = false; if (dera_darklighter_condition__defaultCondition (player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse0 = true; } //-- PLAYER: No thanks. I'm not interested. boolean hasResponse1 = false; if (dera_darklighter_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_37"); if (hasResponse1) responses [responseIndex++] = new string_id (c_stringFile, "s_39"); utils.setScriptVar (player, "conversation.dera_darklighter.branchId", 4); npcStartConversation (player, npc, "dera_darklighter", message, responses); } else { chat.chat (npc, player, message); } return SCRIPT_CONTINUE; } //-- [NOTE] if (dera_darklighter_condition__defaultCondition (player, npc)) { //-- NPC: The Tusken Raiders in that cave are up to no good, and seem even more vile and ruthless than normal Tusken Raiders. string_id message = new string_id (c_stringFile, "s_8"); 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 != "dera_darklighter") return SCRIPT_CONTINUE; obj_id npc = self; int branchId = utils.getIntScriptVar (player, "conversation.dera_darklighter.branchId"); if (branchId == 4 && dera_darklighter_handleBranch4 (player, npc, response) == SCRIPT_CONTINUE) return SCRIPT_CONTINUE; chat.chat (npc, "Error: Fell through all branches and responses for OnNpcConversationResponse."); utils.removeScriptVar (player, "conversation.dera_darklighter.branchId"); return SCRIPT_CONTINUE; } // ======================================================================