// ====================================================================== // // tusken_giver.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/tusken_giver"; // ====================================================================== // Script Conditions // ====================================================================== boolean tusken_giver_condition__defaultCondition (obj_id player, obj_id npc) { return true; } // ---------------------------------------------------------------------- boolean tusken_giver_condition_startQuest (obj_id player, obj_id npc) { return groundquests.isQuestActiveOrComplete(player, "found_tusken_encounter"); } // ---------------------------------------------------------------------- boolean tusken_giver_condition_onQuest (obj_id player, obj_id npc) { return (groundquests.isTaskActive(player, "feeder_tusken_01", "feeder_tusken_tasks_01") || groundquests.hasCompletedQuest(player, "found_tusken_encounter")); } // ---------------------------------------------------------------------- boolean tusken_giver_condition_lastLeg (obj_id player, obj_id npc) { return groundquests.isTaskActive(player, "feeder_tusken_01", "feeder_tusken_wait_01"); } // ---------------------------------------------------------------------- boolean tusken_giver_condition_doneQuest (obj_id player, obj_id npc) { return (groundquests.hasCompletedQuest(player, "feeder_tusken_01") || groundquests.isTaskActive(player, "feeder_tusken_01", "feeder_tusken_wait_02")); } // ====================================================================== // Script Actions // ====================================================================== void tusken_giver_action_giveQuest (obj_id player, obj_id npc) { groundquests.grantQuest(player, "feeder_tusken_01"); } // ---------------------------------------------------------------------- void tusken_giver_action_giveEventQuest (obj_id player, obj_id npc) { } // ---------------------------------------------------------------------- void tusken_giver_action_finishPointer (obj_id player, obj_id npc) { groundquests.sendSignal(player, "found_tusken_encounter_signal_01"); } // ---------------------------------------------------------------------- void tusken_giver_action_finishQuest (obj_id player, obj_id npc) { groundquests.sendSignal(player, "feeder_tusken_signal_01"); } // ====================================================================== // Script %TO Tokens // ====================================================================== // ====================================================================== // Script %DI Tokens // ====================================================================== // ====================================================================== // Script %DF Tokens // ====================================================================== // ====================================================================== // handleBranch Functions // ====================================================================== int tusken_giver_handleBranch2 (obj_id player, obj_id npc, string_id response) { //-- [BRANCH NOTE] //-- NPC: Do you have the relics? //-- [RESPONSE NOTE] //-- PLAYER: Yes, but there was a problem. if (response == "s_22") { //-- [NOTE] if (tusken_giver_condition__defaultCondition (player, npc)) { tusken_giver_action_finishQuest (player, npc); //-- NPC: What problem? You weren't caught were you? string_id message = new string_id (c_stringFile, "s_23"); int numberOfResponses = 0; boolean hasResponse = false; //-- PLAYER: Well... Yes. We should be okay, right? boolean hasResponse0 = false; if (tusken_giver_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.tusken_giver.branchId", 3); npcSpeak (player, message); npcSetConversationResponses (player, responses); } else { utils.removeScriptVar (player, "conversation.tusken_giver.branchId"); npcEndConversationWithMessage (player, message); } return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } // ---------------------------------------------------------------------- int tusken_giver_handleBranch3 (obj_id player, obj_id npc, string_id response) { //-- [BRANCH NOTE] //-- NPC: What problem? You weren't caught were you? //-- [RESPONSE NOTE] //-- PLAYER: Well... Yes. We should be okay, right? if (response == "s_24") { //-- [NOTE] if (tusken_giver_condition__defaultCondition (player, npc)) { tusken_giver_action_giveEventQuest (player, npc); //-- NPC: Oh dear. This is not good. You should go talk to Kav Goldor, he is our militia commander. The Tuskens may be on their way here now. string_id message = new string_id (c_stringFile, "s_25"); utils.removeScriptVar (player, "conversation.tusken_giver.branchId"); npcEndConversationWithMessage (player, message); return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } // ---------------------------------------------------------------------- int tusken_giver_handleBranch5 (obj_id player, obj_id npc, string_id response) { //-- [BRANCH NOTE] //-- NPC: Did you get the relics? //-- [RESPONSE NOTE] //-- PLAYER: No. if (response == "s_16") { //-- [NOTE] if (tusken_giver_condition__defaultCondition (player, npc)) { //-- NPC: Why are you here? string_id message = new string_id (c_stringFile, "s_17"); int numberOfResponses = 0; boolean hasResponse = false; //-- PLAYER: Resupplies. boolean hasResponse0 = false; if (tusken_giver_condition__defaultCondition (player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse0 = true; } //-- PLAYER: I need the location again. I seem to have lost it. boolean hasResponse1 = false; if (tusken_giver_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_18"); if (hasResponse1) responses [responseIndex++] = new string_id (c_stringFile, "s_26"); utils.setScriptVar (player, "conversation.tusken_giver.branchId", 6); npcSpeak (player, message); npcSetConversationResponses (player, responses); } else { utils.removeScriptVar (player, "conversation.tusken_giver.branchId"); npcEndConversationWithMessage (player, message); } return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } // ---------------------------------------------------------------------- int tusken_giver_handleBranch6 (obj_id player, obj_id npc, string_id response) { //-- [BRANCH NOTE] //-- NPC: Why are you here? //-- [RESPONSE NOTE] //-- PLAYER: Resupplies. if (response == "s_18") { //-- [NOTE] if (tusken_giver_condition__defaultCondition (player, npc)) { //-- NPC: Hurry and get them, then go. I need these items to complete my research. string_id message = new string_id (c_stringFile, "s_20"); utils.removeScriptVar (player, "conversation.tusken_giver.branchId"); npcEndConversationWithMessage (player, message); return SCRIPT_CONTINUE; } } //-- [RESPONSE NOTE] //-- PLAYER: I need the location again. I seem to have lost it. if (response == "s_26") { //-- [NOTE] if (tusken_giver_condition__defaultCondition (player, npc)) { tusken_giver_action_giveQuest (player, npc); //-- NPC: Fine, here you go. Don't disappoint me. string_id message = new string_id (c_stringFile, "s_28"); utils.removeScriptVar (player, "conversation.tusken_giver.branchId"); npcEndConversationWithMessage (player, message); return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } // ---------------------------------------------------------------------- int tusken_giver_handleBranch9 (obj_id player, obj_id npc, string_id response) { //-- [BRANCH NOTE] //-- NPC: You seem like a sturdy one. Can you help me with something? //-- [RESPONSE NOTE] //-- PLAYER: What is it? if (response == "s_32") { //-- [NOTE] if (tusken_giver_condition__defaultCondition (player, npc)) { //-- NPC: I am a scholar of some renown, have you heard of me?... string_id message = new string_id (c_stringFile, "s_34"); int numberOfResponses = 0; boolean hasResponse = false; //-- PLAYER: Get to the point. boolean hasResponse0 = false; if (tusken_giver_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_36"); utils.setScriptVar (player, "conversation.tusken_giver.branchId", 10); npcSpeak (player, message); npcSetConversationResponses (player, responses); } else { utils.removeScriptVar (player, "conversation.tusken_giver.branchId"); npcEndConversationWithMessage (player, message); } return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } // ---------------------------------------------------------------------- int tusken_giver_handleBranch10 (obj_id player, obj_id npc, string_id response) { //-- [BRANCH NOTE] //-- NPC: I am a scholar of some renown, have you heard of me?... //-- [RESPONSE NOTE] //-- PLAYER: Get to the point. if (response == "s_36") { //-- [NOTE] if (tusken_giver_condition__defaultCondition (player, npc)) { //-- NPC: I have been studying the Tuskens for some time now, and I have discovered they have some items, that they seem to feel are quite mystical. I would like to study these items. string_id message = new string_id (c_stringFile, "s_38"); int numberOfResponses = 0; boolean hasResponse = false; //-- PLAYER: And you want me to get them for you? boolean hasResponse0 = false; if (tusken_giver_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.tusken_giver.branchId", 11); npcSpeak (player, message); npcSetConversationResponses (player, responses); } else { utils.removeScriptVar (player, "conversation.tusken_giver.branchId"); npcEndConversationWithMessage (player, message); } return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } // ---------------------------------------------------------------------- int tusken_giver_handleBranch11 (obj_id player, obj_id npc, string_id response) { //-- [BRANCH NOTE] //-- NPC: I have been studying the Tuskens for some time now, and I have discovered they have some items, that they seem to feel are quite mystical. I would like to study these items. //-- [RESPONSE NOTE] //-- PLAYER: And you want me to get them for you? if (response == "s_40") { //-- [NOTE] if (tusken_giver_condition__defaultCondition (player, npc)) { tusken_giver_action_finishPointer (player, npc); //-- NPC: Yes, but please don't get caught. We don't need them knowing who took them. We can find a way to return them later. string_id message = new string_id (c_stringFile, "s_42"); int numberOfResponses = 0; boolean hasResponse = false; //-- PLAYER: I am not worried about some primitive warrior. Where are they? boolean hasResponse0 = false; if (tusken_giver_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_44"); utils.setScriptVar (player, "conversation.tusken_giver.branchId", 12); npcSpeak (player, message); npcSetConversationResponses (player, responses); } else { utils.removeScriptVar (player, "conversation.tusken_giver.branchId"); npcEndConversationWithMessage (player, message); } return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } // ---------------------------------------------------------------------- int tusken_giver_handleBranch12 (obj_id player, obj_id npc, string_id response) { //-- [BRANCH NOTE] //-- NPC: Yes, but please don't get caught. We don't need them knowing who took them. We can find a way to return them later. //-- [RESPONSE NOTE] //-- PLAYER: I am not worried about some primitive warrior. Where are they? if (response == "s_44") { //-- [NOTE] if (tusken_giver_condition__defaultCondition (player, npc)) { tusken_giver_action_giveQuest (player, npc); //-- NPC: They have recently hid them in a cave to the west of Fort Tusken. Here are the coordinates. Please hurry back. string_id message = new string_id (c_stringFile, "s_46"); utils.removeScriptVar (player, "conversation.tusken_giver.branchId"); npcEndConversationWithMessage (player, message); return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } // ---------------------------------------------------------------------- // ====================================================================== // User Script Triggers // ====================================================================== trigger OnInitialize () { if ((!isTangible (self)) || (isPlayer (self))) detachScript(self, "conversation.tusken_giver"); 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.tusken_giver"); 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 (tusken_giver_condition_doneQuest (player, npc)) { //-- NPC: What are you doing here? Go see the Kav Golder. It may already be too late. string_id message = new string_id (c_stringFile, "s_4"); chat.chat (npc, player, message); return SCRIPT_CONTINUE; } //-- [NOTE] if (tusken_giver_condition_lastLeg (player, npc)) { //-- NPC: Do you have the relics? string_id message = new string_id (c_stringFile, "s_6"); int numberOfResponses = 0; boolean hasResponse = false; //-- PLAYER: Yes, but there was a problem. boolean hasResponse0 = false; if (tusken_giver_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_22"); utils.setScriptVar (player, "conversation.tusken_giver.branchId", 2); npcStartConversation (player, npc, "tusken_giver", message, responses); } else { chat.chat (npc, player, message); } return SCRIPT_CONTINUE; } //-- [NOTE] if (tusken_giver_condition_onQuest (player, npc)) { //-- NPC: Did you get the relics? string_id message = new string_id (c_stringFile, "s_12"); int numberOfResponses = 0; boolean hasResponse = false; //-- PLAYER: No. boolean hasResponse0 = false; if (tusken_giver_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_16"); utils.setScriptVar (player, "conversation.tusken_giver.branchId", 5); npcStartConversation (player, npc, "tusken_giver", message, responses); } else { chat.chat (npc, player, message); } return SCRIPT_CONTINUE; } //-- [NOTE] if (tusken_giver_condition_startQuest (player, npc)) { //-- NPC: You seem like a sturdy one. Can you help me with something? string_id message = new string_id (c_stringFile, "s_30"); int numberOfResponses = 0; boolean hasResponse = false; //-- PLAYER: What is it? boolean hasResponse0 = false; if (tusken_giver_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_32"); utils.setScriptVar (player, "conversation.tusken_giver.branchId", 9); npcStartConversation (player, npc, "tusken_giver", message, responses); } else { chat.chat (npc, player, message); } return SCRIPT_CONTINUE; } //-- [NOTE] if (tusken_giver_condition__defaultCondition (player, npc)) { //-- NPC: I am far too busy to be bothered by someone like you. string_id message = new string_id (c_stringFile, "s_48"); 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 != "tusken_giver") return SCRIPT_CONTINUE; obj_id npc = self; int branchId = utils.getIntScriptVar (player, "conversation.tusken_giver.branchId"); if (branchId == 2 && tusken_giver_handleBranch2 (player, npc, response) == SCRIPT_CONTINUE) return SCRIPT_CONTINUE; if (branchId == 3 && tusken_giver_handleBranch3 (player, npc, response) == SCRIPT_CONTINUE) return SCRIPT_CONTINUE; if (branchId == 5 && tusken_giver_handleBranch5 (player, npc, response) == SCRIPT_CONTINUE) return SCRIPT_CONTINUE; if (branchId == 6 && tusken_giver_handleBranch6 (player, npc, response) == SCRIPT_CONTINUE) return SCRIPT_CONTINUE; if (branchId == 9 && tusken_giver_handleBranch9 (player, npc, response) == SCRIPT_CONTINUE) return SCRIPT_CONTINUE; if (branchId == 10 && tusken_giver_handleBranch10 (player, npc, response) == SCRIPT_CONTINUE) return SCRIPT_CONTINUE; if (branchId == 11 && tusken_giver_handleBranch11 (player, npc, response) == SCRIPT_CONTINUE) return SCRIPT_CONTINUE; if (branchId == 12 && tusken_giver_handleBranch12 (player, npc, response) == SCRIPT_CONTINUE) return SCRIPT_CONTINUE; chat.chat (npc, "Error: Fell through all branches and responses for OnNpcConversationResponse."); utils.removeScriptVar (player, "conversation.tusken_giver.branchId"); return SCRIPT_CONTINUE; } // ======================================================================