// ====================================================================== // // npe_side4_questgiver.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.npe; include library.utils; // ====================================================================== // Script Constants // ====================================================================== string c_stringFile = "conversation/npe_side4_questgiver"; // ====================================================================== // Script Conditions // ====================================================================== boolean npe_side4_questgiver_condition__defaultCondition (obj_id player, obj_id npc) { return true; } // ---------------------------------------------------------------------- boolean npe_side4_questgiver_condition_playerOnQuest (obj_id player, obj_id npc) { return groundquests.isQuestActive(player, "npe_side4"); } // ---------------------------------------------------------------------- boolean npe_side4_questgiver_condition_playerCompletedQuest (obj_id player, obj_id npc) { return groundquests.hasCompletedQuest(player, "npe_side4"); } // ---------------------------------------------------------------------- boolean npe_side4_questgiver_condition_playerReadyForReward (obj_id player, obj_id npc) { return groundquests.isTaskActive(player, "npe_side4", "donewithquest"); } // ---------------------------------------------------------------------- boolean npe_side4_questgiver_condition_playerCompletedMainQuest (obj_id player, obj_id npc) { return hasObjVar(player, "npe.finishedTemplate"); } // ====================================================================== // Script Actions // ====================================================================== void npe_side4_questgiver_action_facePlayer (obj_id player, obj_id npc) { faceTo(npc, player); } // ---------------------------------------------------------------------- void npe_side4_questgiver_action_giveQuest (obj_id player, obj_id npc) { groundquests.requestGrantQuest(player, "npe_side4"); } // ---------------------------------------------------------------------- void npe_side4_questgiver_action_giveReward (obj_id player, obj_id npc) { groundquests.sendSignal(player, "npe_side4_done"); npe.sendDelayed3poPopup(player, 3, 11, "sound/c3po_29.snd", "npe", "pop_credits", "npe.credits"); } // ====================================================================== // Script %TO Tokens // ====================================================================== // ====================================================================== // Script %DI Tokens // ====================================================================== // ====================================================================== // Script %DF Tokens // ====================================================================== // ====================================================================== // handleBranch Functions // ====================================================================== int npe_side4_questgiver_handleBranch2 (obj_id player, obj_id npc, string_id response) { //-- [BRANCH NOTE] //-- NPC: Are you done? //-- [RESPONSE NOTE] //-- PLAYER: Not yet. I still have more to do. if (response == "s_15") { //-- [NOTE] if (npe_side4_questgiver_condition__defaultCondition (player, npc)) { //-- NPC: Okay. I'll be waiting for you. string_id message = new string_id (c_stringFile, "s_18"); utils.removeScriptVar (player, "conversation.npe_side4_questgiver.branchId"); npcEndConversationWithMessage (player, message); return SCRIPT_CONTINUE; } } //-- [RESPONSE NOTE] //-- PLAYER: Yes. Here are your feathers and teeth. if (response == "s_16") { //-- [NOTE] if (npe_side4_questgiver_condition__defaultCondition (player, npc)) { npe_side4_questgiver_action_giveReward (player, npc); //-- NPC: Excellent, excellent! Here is your payment. These will look so good next to my sand panther claw and my krayt dragon skull. string_id message = new string_id (c_stringFile, "s_17"); utils.removeScriptVar (player, "conversation.npe_side4_questgiver.branchId"); npcEndConversationWithMessage (player, message); return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } // ---------------------------------------------------------------------- int npe_side4_questgiver_handleBranch5 (obj_id player, obj_id npc, string_id response) { //-- [BRANCH NOTE] //-- NPC: You have been hunting here, haven't you? //-- [RESPONSE NOTE] //-- PLAYER: I have been doing odd jobs here and there. if (response == "s_22") { //-- [NOTE] if (npe_side4_questgiver_condition__defaultCondition (player, npc)) { //-- NPC: I'm interested in procuring some items from the beasties up in the Atrium. I'm willing to pay well for them. string_id message = new string_id (c_stringFile, "s_24"); int numberOfResponses = 0; boolean hasResponse = false; //-- PLAYER: Why don't you go up and hunt them yourself? boolean hasResponse0 = false; if (npe_side4_questgiver_condition__defaultCondition (player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse0 = true; } //-- PLAYER: I'd be happy to do your hunting for you. boolean hasResponse1 = false; if (npe_side4_questgiver_condition__defaultCondition (player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse1 = true; } //-- PLAYER: No. You need to do your own hunting. boolean hasResponse2 = false; if (npe_side4_questgiver_condition__defaultCondition (player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse2 = 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_38"); if (hasResponse2) responses [responseIndex++] = new string_id (c_stringFile, "s_51"); utils.setScriptVar (player, "conversation.npe_side4_questgiver.branchId", 6); npcSpeak (player, message); npcSetConversationResponses (player, responses); } else { utils.removeScriptVar (player, "conversation.npe_side4_questgiver.branchId"); npcEndConversationWithMessage (player, message); } return SCRIPT_CONTINUE; } } //-- [RESPONSE NOTE] //-- PLAYER: I don't like to hunt, actually. if (response == "s_48") { //-- [NOTE] if (npe_side4_questgiver_condition__defaultCondition (player, npc)) { //-- NPC: Ah, my mistake. string_id message = new string_id (c_stringFile, "s_50"); utils.removeScriptVar (player, "conversation.npe_side4_questgiver.branchId"); npcEndConversationWithMessage (player, message); return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } // ---------------------------------------------------------------------- int npe_side4_questgiver_handleBranch6 (obj_id player, obj_id npc, string_id response) { //-- [BRANCH NOTE] //-- NPC: I'm interested in procuring some items from the beasties up in the Atrium. I'm willing to pay well for them. //-- [RESPONSE NOTE] //-- PLAYER: Why don't you go up and hunt them yourself? if (response == "s_26") { //-- [NOTE] if (npe_side4_questgiver_condition__defaultCondition (player, npc)) { //-- NPC: Well...Inaldra doesn't really want me up there hunting. She says that I will...damage something. I'm a little clumsy with a blaster. string_id message = new string_id (c_stringFile, "s_28"); int numberOfResponses = 0; boolean hasResponse = false; //-- PLAYER: Clumsy? That's bad. So, what am I to do? boolean hasResponse0 = false; if (npe_side4_questgiver_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_30"); utils.setScriptVar (player, "conversation.npe_side4_questgiver.branchId", 7); npcSpeak (player, message); npcSetConversationResponses (player, responses); } else { utils.removeScriptVar (player, "conversation.npe_side4_questgiver.branchId"); npcEndConversationWithMessage (player, message); } return SCRIPT_CONTINUE; } } //-- [RESPONSE NOTE] //-- PLAYER: I'd be happy to do your hunting for you. if (response == "s_38") { //-- [NOTE] if (npe_side4_questgiver_condition__defaultCondition (player, npc)) { doAnimationAction (npc, "applause_excited"); npe_side4_questgiver_action_giveQuest (player, npc); //-- NPC: Head up to the Atrium and hunt the flits there. Bring back four of their feathers for me. Then, when you have those, get seven lizard teeth. I'm making a necklace for my wife, and that will help me a lot. string_id message = new string_id (c_stringFile, "s_40"); int numberOfResponses = 0; boolean hasResponse = false; //-- PLAYER: I'll head there now. boolean hasResponse0 = false; if (npe_side4_questgiver_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_35"); utils.setScriptVar (player, "conversation.npe_side4_questgiver.branchId", 8); npcSpeak (player, message); npcSetConversationResponses (player, responses); } else { utils.removeScriptVar (player, "conversation.npe_side4_questgiver.branchId"); npcEndConversationWithMessage (player, message); } return SCRIPT_CONTINUE; } } //-- [RESPONSE NOTE] //-- PLAYER: No. You need to do your own hunting. if (response == "s_51") { //-- [NOTE] if (npe_side4_questgiver_condition__defaultCondition (player, npc)) { doAnimationAction (npc, "shrug_shoulders"); //-- NPC: Whatever. You're the one turning down extra money. string_id message = new string_id (c_stringFile, "s_52"); utils.removeScriptVar (player, "conversation.npe_side4_questgiver.branchId"); npcEndConversationWithMessage (player, message); return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } // ---------------------------------------------------------------------- int npe_side4_questgiver_handleBranch7 (obj_id player, obj_id npc, string_id response) { //-- [BRANCH NOTE] //-- NPC: Well...Inaldra doesn't really want me up there hunting. She says that I will...damage something. I'm a little clumsy with a blaster. //-- [RESPONSE NOTE] //-- PLAYER: Clumsy? That's bad. So, what am I to do? if (response == "s_30") { //-- [NOTE] if (npe_side4_questgiver_condition__defaultCondition (player, npc)) { doAnimationAction (npc, "applause_excited"); npe_side4_questgiver_action_giveQuest (player, npc); //-- NPC: Head up to the Atrium and hunt the flits there. Bring back four of their feathers for me. Then, when you have those, get seven lizard teeth. I'm making a necklace for my wife, and that will help me a lot. string_id message = new string_id (c_stringFile, "s_40"); int numberOfResponses = 0; boolean hasResponse = false; //-- PLAYER: I'll head there now. boolean hasResponse0 = false; if (npe_side4_questgiver_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_35"); utils.setScriptVar (player, "conversation.npe_side4_questgiver.branchId", 8); npcSpeak (player, message); npcSetConversationResponses (player, responses); } else { utils.removeScriptVar (player, "conversation.npe_side4_questgiver.branchId"); npcEndConversationWithMessage (player, message); } return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } // ---------------------------------------------------------------------- int npe_side4_questgiver_handleBranch8 (obj_id player, obj_id npc, string_id response) { //-- [BRANCH NOTE] //-- NPC: Head up to the Atrium and hunt the flits there. Bring back four of their feathers for me. Then, when you have those, get seven lizard teeth. I'm making a necklace for my wife, and that will help me a lot. //-- [RESPONSE NOTE] //-- PLAYER: I'll head there now. if (response == "s_35") { //-- [NOTE] if (npe_side4_questgiver_condition__defaultCondition (player, npc)) { doAnimationAction (npc, "thank"); //-- NPC: Thanks! string_id message = new string_id (c_stringFile, "s_36"); utils.removeScriptVar (player, "conversation.npe_side4_questgiver.branchId"); npcEndConversationWithMessage (player, message); return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } // ---------------------------------------------------------------------- // ====================================================================== // User Script Triggers // ====================================================================== trigger OnInitialize () { if ((!isMob (self)) || (isPlayer (self))) detachScript(self, "conversation.npe_side4_questgiver"); setCondition (self, CONDITION_CONVERSABLE); //setCondition (self, CONDITION_INTERESTING); setInvulnerable (self, true); setName (self, "Wyle Artis"); 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, "Wyle Artis"); 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.npe_side4_questgiver"); 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 (npe_side4_questgiver_condition_playerCompletedQuest (player, npc)) { npe_side4_questgiver_action_facePlayer (player, npc); //-- NPC: Thank you again! My wife loves tooth necklaces. string_id message = new string_id (c_stringFile, "s_21"); chat.chat (npc, player, message); return SCRIPT_CONTINUE; } //-- [NOTE] if (npe_side4_questgiver_condition_playerOnQuest (player, npc)) { npe_side4_questgiver_action_facePlayer (player, npc); //-- NPC: Are you done? string_id message = new string_id (c_stringFile, "s_14"); int numberOfResponses = 0; boolean hasResponse = false; //-- PLAYER: Not yet. I still have more to do. boolean hasResponse0 = false; if (!npe_side4_questgiver_condition_playerReadyForReward (player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse0 = true; } //-- PLAYER: Yes. Here are your feathers and teeth. boolean hasResponse1 = false; if (npe_side4_questgiver_condition_playerReadyForReward (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_15"); if (hasResponse1) responses [responseIndex++] = new string_id (c_stringFile, "s_16"); utils.setScriptVar (player, "conversation.npe_side4_questgiver.branchId", 2); npcStartConversation (player, npc, "npe_side4_questgiver", message, responses); } else { chat.chat (npc, player, message); } return SCRIPT_CONTINUE; } //-- [NOTE] if (npe_side4_questgiver_condition_playerCompletedMainQuest (player, npc)) { npe_side4_questgiver_action_facePlayer (player, npc); //-- NPC: You have been hunting here, haven't you? string_id message = new string_id (c_stringFile, "s_12"); int numberOfResponses = 0; boolean hasResponse = false; //-- PLAYER: I have been doing odd jobs here and there. boolean hasResponse0 = false; if (npe_side4_questgiver_condition__defaultCondition (player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse0 = true; } //-- PLAYER: I don't like to hunt, actually. boolean hasResponse1 = false; if (npe_side4_questgiver_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_48"); utils.setScriptVar (player, "conversation.npe_side4_questgiver.branchId", 5); npcStartConversation (player, npc, "npe_side4_questgiver", message, responses); } else { chat.chat (npc, player, message); } return SCRIPT_CONTINUE; } //-- [NOTE] if (npe_side4_questgiver_condition__defaultCondition (player, npc)) { npe_side4_questgiver_action_facePlayer (player, npc); //-- NPC: I'm willing to pay for experience. When you have completed your training, come back and talk to me. string_id message = new string_id (c_stringFile, "s_42"); 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 != "npe_side4_questgiver") return SCRIPT_CONTINUE; obj_id npc = self; int branchId = utils.getIntScriptVar (player, "conversation.npe_side4_questgiver.branchId"); if (branchId == 2 && npe_side4_questgiver_handleBranch2 (player, npc, response) == SCRIPT_CONTINUE) return SCRIPT_CONTINUE; if (branchId == 5 && npe_side4_questgiver_handleBranch5 (player, npc, response) == SCRIPT_CONTINUE) return SCRIPT_CONTINUE; if (branchId == 6 && npe_side4_questgiver_handleBranch6 (player, npc, response) == SCRIPT_CONTINUE) return SCRIPT_CONTINUE; if (branchId == 7 && npe_side4_questgiver_handleBranch7 (player, npc, response) == SCRIPT_CONTINUE) return SCRIPT_CONTINUE; if (branchId == 8 && npe_side4_questgiver_handleBranch8 (player, npc, response) == SCRIPT_CONTINUE) return SCRIPT_CONTINUE; chat.chat (npc, "Error: Fell through all branches and responses for OnNpcConversationResponse."); utils.removeScriptVar (player, "conversation.npe_side4_questgiver.branchId"); return SCRIPT_CONTINUE; } // ======================================================================