// ====================================================================== // // legacy_button_damar.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.features; include library.groundquests; include library.space_quest; include library.utils; // ====================================================================== // Script Constants // ====================================================================== string c_stringFile = "conversation/legacy_button_damar"; // ====================================================================== // Script Conditions // ====================================================================== boolean legacy_button_damar_condition__defaultCondition (obj_id player, obj_id npc) { return true; } // ---------------------------------------------------------------------- boolean legacy_button_damar_condition_onButtonImp (obj_id player, obj_id npc) { int questId1 = questGetQuestId("quest/legacy_button_imp_pt2"); int onBody = groundquests.getTaskId(questId1, "legacy_button_imp_e3"); boolean onTask = questIsTaskActive(questId1, onBody, player); return onTask; } // ---------------------------------------------------------------------- boolean legacy_button_damar_condition_onButtonReb (obj_id player, obj_id npc) { int questId1 = questGetQuestId("quest/legacy_button_reb_pt2"); int onBody = groundquests.getTaskId(questId1, "legacy_button_reb_e3"); boolean onTask = questIsTaskActive(questId1, onBody, player); return onTask; } // ---------------------------------------------------------------------- boolean legacy_button_damar_condition_questButtonComplete (obj_id player, obj_id npc) { int questId1 = questGetQuestId("quest/legacy_button_imp_pt2"); int questId2 = questGetQuestId("quest/legacy_button_reb_pt2"); boolean OnTask = questIsQuestComplete(questId1, player)|| questIsQuestComplete(questId2, player); return OnTask; } // ====================================================================== // Script Actions // ====================================================================== void legacy_button_damar_action_signalRebComplete (obj_id player, obj_id npc) { groundquests.sendSignal(player, "legacy_button_reb_launch_e4"); } // ---------------------------------------------------------------------- void legacy_button_damar_action_signalImpComplete (obj_id player, obj_id npc) { groundquests.sendSignal(player, "legacy_button_imp_launch_e4"); groundquests.sendSignal(player, "legacy_button_reb_launch_e4"); } // ---------------------------------------------------------------------- void legacy_button_damar_action_facePlayer (obj_id player, obj_id npc) { faceTo(npc, player); } // ====================================================================== // Script %TO Tokens // ====================================================================== // ====================================================================== // Script %DI Tokens // ====================================================================== // ====================================================================== // Script %DF Tokens // ====================================================================== // ====================================================================== // handleBranch Functions // ====================================================================== int legacy_button_damar_handleBranch2 (obj_id player, obj_id npc, string_id response) { //-- [BRANCH NOTE] //-- NPC: I don't know how you did it, but Barrezz will be happy that you got me out of here. //-- [RESPONSE NOTE] //-- PLAYER: No problem. I need you to process this fast though. if (response == "s_48") { //-- [NOTE] if (legacy_button_damar_condition__defaultCondition (player, npc)) { legacy_button_damar_action_facePlayer (player, npc); //-- NPC: Yes Barrezz said something about this before my ...job offer... from these gun runners. Ok give it to me. string_id message = new string_id (c_stringFile, "s_49"); int numberOfResponses = 0; boolean hasResponse = false; //-- PLAYER: Here you go. boolean hasResponse0 = false; if (legacy_button_damar_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_50"); utils.setScriptVar (player, "conversation.legacy_button_damar.branchId", 3); npcSpeak (player, message); npcSetConversationResponses (player, responses); } else { utils.removeScriptVar (player, "conversation.legacy_button_damar.branchId"); npcEndConversationWithMessage (player, message); } return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } // ---------------------------------------------------------------------- int legacy_button_damar_handleBranch3 (obj_id player, obj_id npc, string_id response) { //-- [BRANCH NOTE] //-- NPC: Yes Barrezz said something about this before my ...job offer... from these gun runners. Ok give it to me. //-- [RESPONSE NOTE] //-- PLAYER: Here you go. if (response == "s_50") { //-- [NOTE] if (legacy_button_damar_condition__defaultCondition (player, npc)) { doAnimationAction (npc, "paper"); legacy_button_damar_action_facePlayer (player, npc); //-- NPC: OK, lets try some filters ....durables..ownership history ... and droids. string_id message = new string_id (c_stringFile, "s_51"); int numberOfResponses = 0; boolean hasResponse = false; //-- PLAYER: Who has it? boolean hasResponse0 = false; if (legacy_button_damar_condition__defaultCondition (player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse0 = true; } //-- PLAYER: They are looking for a droid? boolean hasResponse1 = false; if (legacy_button_damar_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_52"); if (hasResponse1) responses [responseIndex++] = new string_id (c_stringFile, "s_21"); utils.setScriptVar (player, "conversation.legacy_button_damar.branchId", 4); npcSpeak (player, message); npcSetConversationResponses (player, responses); } else { utils.removeScriptVar (player, "conversation.legacy_button_damar.branchId"); npcEndConversationWithMessage (player, message); } return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } // ---------------------------------------------------------------------- int legacy_button_damar_handleBranch4 (obj_id player, obj_id npc, string_id response) { //-- [BRANCH NOTE] //-- NPC: OK, lets try some filters ....durables..ownership history ... and droids. //-- [RESPONSE NOTE] //-- PLAYER: Who has it? if (response == "s_52") { //-- [NOTE] if (legacy_button_damar_condition__defaultCondition (player, npc)) { legacy_button_damar_action_signalImpComplete (player, npc); //-- NPC: A junk dealer named Watto. I'll upload all the info into your datapad and send a copy off to your handler. Now its time for me to leave. string_id message = new string_id (c_stringFile, "s_53"); int numberOfResponses = 0; boolean hasResponse = false; //-- PLAYER: Thanks. boolean hasResponse0 = false; if (legacy_button_damar_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.legacy_button_damar.branchId", 5); npcSpeak (player, message); npcSetConversationResponses (player, responses); } else { utils.removeScriptVar (player, "conversation.legacy_button_damar.branchId"); npcEndConversationWithMessage (player, message); } return SCRIPT_CONTINUE; } } //-- [RESPONSE NOTE] //-- PLAYER: They are looking for a droid? if (response == "s_21") { //-- [NOTE] if (legacy_button_damar_condition__defaultCondition (player, npc)) { //-- NPC: Yes. Didn't you know? Hmmm they must not have fully trusted you if they didn't tell you what they were actually looking for. Apparently this droid is carrying something extremely important. string_id message = new string_id (c_stringFile, "s_22"); int numberOfResponses = 0; boolean hasResponse = false; //-- PLAYER: So who has it? boolean hasResponse0 = false; if (legacy_button_damar_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.legacy_button_damar.branchId", 7); npcSpeak (player, message); npcSetConversationResponses (player, responses); } else { utils.removeScriptVar (player, "conversation.legacy_button_damar.branchId"); npcEndConversationWithMessage (player, message); } return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } // ---------------------------------------------------------------------- int legacy_button_damar_handleBranch5 (obj_id player, obj_id npc, string_id response) { //-- [BRANCH NOTE] //-- NPC: A junk dealer named Watto. I'll upload all the info into your datapad and send a copy off to your handler. Now its time for me to leave. //-- [RESPONSE NOTE] //-- PLAYER: Thanks. if (response == "s_24") { //-- [NOTE] if (legacy_button_damar_condition__defaultCondition (player, npc)) { //-- NPC: You are welcome. string_id message = new string_id (c_stringFile, "s_25"); utils.removeScriptVar (player, "conversation.legacy_button_damar.branchId"); npcEndConversationWithMessage (player, message); return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } // ---------------------------------------------------------------------- int legacy_button_damar_handleBranch7 (obj_id player, obj_id npc, string_id response) { //-- [BRANCH NOTE] //-- NPC: Yes. Didn't you know? Hmmm they must not have fully trusted you if they didn't tell you what they were actually looking for. Apparently this droid is carrying something extremely important. //-- [RESPONSE NOTE] //-- PLAYER: So who has it? if (response == "s_23") { //-- [NOTE] if (legacy_button_damar_condition__defaultCondition (player, npc)) { legacy_button_damar_action_signalImpComplete (player, npc); //-- NPC: A junk dealer named Watto. I'll upload all the info into your datapad and send a copy off to your handler. Now its time for me to leave. string_id message = new string_id (c_stringFile, "s_53"); int numberOfResponses = 0; boolean hasResponse = false; //-- PLAYER: Thanks. boolean hasResponse0 = false; if (legacy_button_damar_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.legacy_button_damar.branchId", 5); npcSpeak (player, message); npcSetConversationResponses (player, responses); } else { utils.removeScriptVar (player, "conversation.legacy_button_damar.branchId"); npcEndConversationWithMessage (player, message); } return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } // ---------------------------------------------------------------------- int legacy_button_damar_handleBranch8 (obj_id player, obj_id npc, string_id response) { //-- [BRANCH NOTE] //-- NPC: I don't know how you did it, but Bastra will be happy that you got me out of here. //-- [RESPONSE NOTE] //-- PLAYER: No problem. I need you to process this fast though. if (response == "s_38") { //-- [NOTE] if (legacy_button_damar_condition__defaultCondition (player, npc)) { //-- NPC: Yes Bastra said something about this before my...job offer... from these gun runners. Ok give it to me. string_id message = new string_id (c_stringFile, "s_39"); int numberOfResponses = 0; boolean hasResponse = false; //-- PLAYER: Here you go. boolean hasResponse0 = false; if (legacy_button_damar_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_40"); utils.setScriptVar (player, "conversation.legacy_button_damar.branchId", 9); npcSpeak (player, message); npcSetConversationResponses (player, responses); } else { utils.removeScriptVar (player, "conversation.legacy_button_damar.branchId"); npcEndConversationWithMessage (player, message); } return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } // ---------------------------------------------------------------------- int legacy_button_damar_handleBranch9 (obj_id player, obj_id npc, string_id response) { //-- [BRANCH NOTE] //-- NPC: Yes Bastra said something about this before my...job offer... from these gun runners. Ok give it to me. //-- [RESPONSE NOTE] //-- PLAYER: Here you go. if (response == "s_40") { //-- [NOTE] if (legacy_button_damar_condition__defaultCondition (player, npc)) { doAnimationAction (npc, "paper"); //-- NPC: OK, lets try some filters ....durables..ownership history ... and droids. string_id message = new string_id (c_stringFile, "s_41"); int numberOfResponses = 0; boolean hasResponse = false; //-- PLAYER: Who has it? boolean hasResponse0 = false; if (legacy_button_damar_condition__defaultCondition (player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse0 = true; } //-- PLAYER: They are looking for a droid? boolean hasResponse1 = false; if (legacy_button_damar_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_26"); if (hasResponse1) responses [responseIndex++] = new string_id (c_stringFile, "s_28"); utils.setScriptVar (player, "conversation.legacy_button_damar.branchId", 10); npcSpeak (player, message); npcSetConversationResponses (player, responses); } else { utils.removeScriptVar (player, "conversation.legacy_button_damar.branchId"); npcEndConversationWithMessage (player, message); } return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } // ---------------------------------------------------------------------- int legacy_button_damar_handleBranch10 (obj_id player, obj_id npc, string_id response) { //-- [BRANCH NOTE] //-- NPC: OK, lets try some filters ....durables..ownership history ... and droids. //-- [RESPONSE NOTE] //-- PLAYER: Who has it? if (response == "s_26") { //-- [NOTE] if (legacy_button_damar_condition__defaultCondition (player, npc)) { legacy_button_damar_action_signalImpComplete (player, npc); //-- NPC: A junk dealer named Watto. I'll upload all the info into your datapad and send a copy off to your handler. Now its time for me to leave. string_id message = new string_id (c_stringFile, "s_53"); int numberOfResponses = 0; boolean hasResponse = false; //-- PLAYER: Thanks. boolean hasResponse0 = false; if (legacy_button_damar_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.legacy_button_damar.branchId", 5); npcSpeak (player, message); npcSetConversationResponses (player, responses); } else { utils.removeScriptVar (player, "conversation.legacy_button_damar.branchId"); npcEndConversationWithMessage (player, message); } return SCRIPT_CONTINUE; } } //-- [RESPONSE NOTE] //-- PLAYER: They are looking for a droid? if (response == "s_28") { //-- [NOTE] if (legacy_button_damar_condition__defaultCondition (player, npc)) { //-- NPC: Yes. Didn't you know? Hmmm they must not have fully trusted you if they didn't tell you what they were actually looking for. Apparently this droid is carrying something extremely important. string_id message = new string_id (c_stringFile, "s_22"); int numberOfResponses = 0; boolean hasResponse = false; //-- PLAYER: So who has it? boolean hasResponse0 = false; if (legacy_button_damar_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.legacy_button_damar.branchId", 7); npcSpeak (player, message); npcSetConversationResponses (player, responses); } else { utils.removeScriptVar (player, "conversation.legacy_button_damar.branchId"); npcEndConversationWithMessage (player, message); } return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } // ---------------------------------------------------------------------- // ====================================================================== // User Script Triggers // ====================================================================== trigger OnInitialize () { if ((!isMob (self)) || (isPlayer (self))) detachScript(self, "conversation.legacy_button_damar"); setCondition (self, CONDITION_CONVERSABLE); setCondition (self, CONDITION_INTERESTING); setInvulnerable (self, true); setName (self, "Jem Lavar"); ai_lib.setDefaultCalmBehavior( self, ai_lib.BEHAVIOR_SENTINEL ); return SCRIPT_CONTINUE; } trigger OnAttach () { setCondition (self, CONDITION_CONVERSABLE); setCondition (self, CONDITION_INTERESTING); setInvulnerable (self, true); setName (self, "Jem Lavar"); ai_lib.setDefaultCalmBehavior( self, ai_lib.BEHAVIOR_SENTINEL ); 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.legacy_button_damar"); 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 (legacy_button_damar_condition_questButtonComplete (player, npc)) { doAnimationAction (npc, "threaten"); legacy_button_damar_action_facePlayer (player, npc); //-- NPC: I have been hearing good things about you from our mutual friend. string_id message = new string_id (c_stringFile, "s_101"); chat.chat (npc, player, message); return SCRIPT_CONTINUE; } //-- [NOTE] if (legacy_button_damar_condition_onButtonImp (player, npc)) { doAnimationAction (npc, "thank"); legacy_button_damar_action_facePlayer (player, npc); //-- NPC: I don't know how you did it, but Barrezz will be happy that you got me out of here. string_id message = new string_id (c_stringFile, "s_145"); int numberOfResponses = 0; boolean hasResponse = false; //-- PLAYER: No problem. I need you to process this fast though. boolean hasResponse0 = false; if (legacy_button_damar_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_48"); utils.setScriptVar (player, "conversation.legacy_button_damar.branchId", 2); npcStartConversation (player, npc, "legacy_button_damar", message, responses); } else { chat.chat (npc, player, message); } return SCRIPT_CONTINUE; } //-- [NOTE] if (legacy_button_damar_condition_onButtonReb (player, npc)) { doAnimationAction (npc, "thank"); legacy_button_damar_action_facePlayer (player, npc); //-- NPC: I don't know how you did it, but Bastra will be happy that you got me out of here. string_id message = new string_id (c_stringFile, "s_144"); int numberOfResponses = 0; boolean hasResponse = false; //-- PLAYER: No problem. I need you to process this fast though. boolean hasResponse0 = false; if (legacy_button_damar_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_38"); utils.setScriptVar (player, "conversation.legacy_button_damar.branchId", 8); npcStartConversation (player, npc, "legacy_button_damar", message, responses); } else { chat.chat (npc, player, message); } return SCRIPT_CONTINUE; } //-- [NOTE] D1 if (legacy_button_damar_condition__defaultCondition (player, npc)) { doAnimationAction (npc, "cough_polite"); legacy_button_damar_action_facePlayer (player, npc); //-- NPC: I don't know how you got here but please leave before anyone sees me with you. Its worth my life if I am caught talking with anyone. string_id message = new string_id (c_stringFile, "s_805"); 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 != "legacy_button_damar") return SCRIPT_CONTINUE; obj_id npc = self; int branchId = utils.getIntScriptVar (player, "conversation.legacy_button_damar.branchId"); if (branchId == 2 && legacy_button_damar_handleBranch2 (player, npc, response) == SCRIPT_CONTINUE) return SCRIPT_CONTINUE; if (branchId == 3 && legacy_button_damar_handleBranch3 (player, npc, response) == SCRIPT_CONTINUE) return SCRIPT_CONTINUE; if (branchId == 4 && legacy_button_damar_handleBranch4 (player, npc, response) == SCRIPT_CONTINUE) return SCRIPT_CONTINUE; if (branchId == 5 && legacy_button_damar_handleBranch5 (player, npc, response) == SCRIPT_CONTINUE) return SCRIPT_CONTINUE; if (branchId == 7 && legacy_button_damar_handleBranch7 (player, npc, response) == SCRIPT_CONTINUE) return SCRIPT_CONTINUE; if (branchId == 8 && legacy_button_damar_handleBranch8 (player, npc, response) == SCRIPT_CONTINUE) return SCRIPT_CONTINUE; if (branchId == 9 && legacy_button_damar_handleBranch9 (player, npc, response) == SCRIPT_CONTINUE) return SCRIPT_CONTINUE; if (branchId == 10 && legacy_button_damar_handleBranch10 (player, npc, response) == SCRIPT_CONTINUE) return SCRIPT_CONTINUE; chat.chat (npc, "Error: Fell through all branches and responses for OnNpcConversationResponse."); utils.removeScriptVar (player, "conversation.legacy_button_damar.branchId"); return SCRIPT_CONTINUE; } // ======================================================================