// ====================================================================== // // npe_side2_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_side2_questgiver"; // ====================================================================== // Script Conditions // ====================================================================== boolean npe_side2_questgiver_condition__defaultCondition (obj_id player, obj_id npc) { return true; } // ---------------------------------------------------------------------- boolean npe_side2_questgiver_condition_playerOnQuest (obj_id player, obj_id npc) { return groundquests.isQuestActive(player, "npe_side2"); } // ---------------------------------------------------------------------- boolean npe_side2_questgiver_condition_playerCompletedQuest (obj_id player, obj_id npc) { return groundquests.hasCompletedQuest(player, "npe_side2"); } // ---------------------------------------------------------------------- boolean npe_side2_questgiver_condition_playerReadyForReward (obj_id player, obj_id npc) { return groundquests.isTaskActive(player, "npe_side2", "reward_signal"); } // ---------------------------------------------------------------------- boolean npe_side2_questgiver_condition_playerCompletedMainQuest (obj_id player, obj_id npc) { return hasObjVar(player, "npe.finishedTemplate"); } // ====================================================================== // Script Actions // ====================================================================== void npe_side2_questgiver_action_facePlayer (obj_id player, obj_id npc) { faceTo(npc, player); } // ---------------------------------------------------------------------- void npe_side2_questgiver_action_giveQuest (obj_id player, obj_id npc) { groundquests.requestGrantQuest(player, "npe_side2"); } // ---------------------------------------------------------------------- void npe_side2_questgiver_action_giveReward (obj_id player, obj_id npc) { groundquests.sendSignal(player, "npe_side2_reward"); 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_side2_questgiver_handleBranch2 (obj_id player, obj_id npc, string_id response) { //-- [BRANCH NOTE] //-- NPC: Have you found it yet? //-- [RESPONSE NOTE] //-- PLAYER: Not yet. if (response == "s_15") { //-- [NOTE] if (npe_side2_questgiver_condition__defaultCondition (player, npc)) { //-- NPC: I hope it isn't gone for good. Sometimes I can still hear them. string_id message = new string_id (c_stringFile, "s_18"); utils.removeScriptVar (player, "conversation.npe_side2_questgiver.branchId"); npcEndConversationWithMessage (player, message); return SCRIPT_CONTINUE; } } //-- [RESPONSE NOTE] //-- PLAYER: Yes. It appears to still be working. if (response == "s_16") { //-- [NOTE] if (npe_side2_questgiver_condition__defaultCondition (player, npc)) { //-- NPC: That's better than I could have hoped for! Some of these images are also of people that died in the Clone Wars, and I miss them terribly. This reward seems like far less than you deserve, but it's all I have. string_id message = new string_id (c_stringFile, "s_17"); int numberOfResponses = 0; boolean hasResponse = false; //-- PLAYER: Thank you. May I suggest making copies of your data crystals? boolean hasResponse0 = false; if (npe_side2_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_19"); utils.setScriptVar (player, "conversation.npe_side2_questgiver.branchId", 4); npcSpeak (player, message); npcSetConversationResponses (player, responses); } else { utils.removeScriptVar (player, "conversation.npe_side2_questgiver.branchId"); npcEndConversationWithMessage (player, message); } return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } // ---------------------------------------------------------------------- int npe_side2_questgiver_handleBranch4 (obj_id player, obj_id npc, string_id response) { //-- [BRANCH NOTE] //-- NPC: That's better than I could have hoped for! Some of these images are also of people that died in the Clone Wars, and I miss them terribly. This reward seems like far less than you deserve, but it's all I have. //-- [RESPONSE NOTE] //-- PLAYER: Thank you. May I suggest making copies of your data crystals? if (response == "s_19") { //-- [NOTE] if (npe_side2_questgiver_condition__defaultCondition (player, npc)) { npe_side2_questgiver_action_giveReward (player, npc); //-- NPC: Yes. I'm going to do that now. string_id message = new string_id (c_stringFile, "s_20"); utils.removeScriptVar (player, "conversation.npe_side2_questgiver.branchId"); npcEndConversationWithMessage (player, message); return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } // ---------------------------------------------------------------------- int npe_side2_questgiver_handleBranch6 (obj_id player, obj_id npc, string_id response) { //-- [BRANCH NOTE] //-- NPC: I'm sorry to bother you, but I have nowhere else to turn. //-- [RESPONSE NOTE] //-- PLAYER: What do you need? if (response == "s_23") { //-- [NOTE] if (npe_side2_questgiver_condition__defaultCondition (player, npc)) { //-- NPC: I lost my datapad. I know that it's not especially valuable to anyone else, but it has images that I cannot replace. Please, get it back! string_id message = new string_id (c_stringFile, "s_25"); int numberOfResponses = 0; boolean hasResponse = false; //-- PLAYER: I will help you. boolean hasResponse0 = false; if (npe_side2_questgiver_condition__defaultCondition (player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse0 = true; } //-- PLAYER: Sorry, but I can't do anything about that right now. boolean hasResponse1 = false; if (npe_side2_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_27"); if (hasResponse1) responses [responseIndex++] = new string_id (c_stringFile, "s_35"); utils.setScriptVar (player, "conversation.npe_side2_questgiver.branchId", 7); npcSpeak (player, message); npcSetConversationResponses (player, responses); } else { utils.removeScriptVar (player, "conversation.npe_side2_questgiver.branchId"); npcEndConversationWithMessage (player, message); } return SCRIPT_CONTINUE; } } //-- [RESPONSE NOTE] //-- PLAYER: I don't have time right now. if (response == "s_39") { //-- [NOTE] if (npe_side2_questgiver_condition__defaultCondition (player, npc)) { //-- NPC: I hope I can find someone to help me. string_id message = new string_id (c_stringFile, "s_41"); utils.removeScriptVar (player, "conversation.npe_side2_questgiver.branchId"); npcEndConversationWithMessage (player, message); return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } // ---------------------------------------------------------------------- int npe_side2_questgiver_handleBranch7 (obj_id player, obj_id npc, string_id response) { //-- [BRANCH NOTE] //-- NPC: I lost my datapad. I know that it's not especially valuable to anyone else, but it has images that I cannot replace. Please, get it back! //-- [RESPONSE NOTE] //-- PLAYER: I will help you. if (response == "s_27") { //-- [NOTE] if (npe_side2_questgiver_condition__defaultCondition (player, npc)) { //-- NPC: Thank you! I was downstairs, near the central room. I was running from those crazy droids down there. Maybe one of them picked it up. string_id message = new string_id (c_stringFile, "s_29"); int numberOfResponses = 0; boolean hasResponse = false; //-- PLAYER: I'm on my way. boolean hasResponse0 = false; if (npe_side2_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_31"); utils.setScriptVar (player, "conversation.npe_side2_questgiver.branchId", 8); npcSpeak (player, message); npcSetConversationResponses (player, responses); } else { utils.removeScriptVar (player, "conversation.npe_side2_questgiver.branchId"); npcEndConversationWithMessage (player, message); } return SCRIPT_CONTINUE; } } //-- [RESPONSE NOTE] //-- PLAYER: Sorry, but I can't do anything about that right now. if (response == "s_35") { //-- [NOTE] if (npe_side2_questgiver_condition__defaultCondition (player, npc)) { doAnimationAction (npc, "shake_head_disgust"); //-- NPC: That's okay. It's just memories. string_id message = new string_id (c_stringFile, "s_37"); utils.removeScriptVar (player, "conversation.npe_side2_questgiver.branchId"); npcEndConversationWithMessage (player, message); return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } // ---------------------------------------------------------------------- int npe_side2_questgiver_handleBranch8 (obj_id player, obj_id npc, string_id response) { //-- [BRANCH NOTE] //-- NPC: Thank you! I was downstairs, near the central room. I was running from those crazy droids down there. Maybe one of them picked it up. //-- [RESPONSE NOTE] //-- PLAYER: I'm on my way. if (response == "s_31") { //-- [NOTE] if (npe_side2_questgiver_condition__defaultCondition (player, npc)) { npe_side2_questgiver_action_giveQuest (player, npc); //-- NPC: I'm very grateful. string_id message = new string_id (c_stringFile, "s_33"); utils.removeScriptVar (player, "conversation.npe_side2_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_side2_questgiver"); setCondition (self, CONDITION_CONVERSABLE); //setCondition (self, CONDITION_INTERESTING); setInvulnerable (self, true); setName (self, "Deavyn Gils"); 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, "Deavyn Gils"); 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_side2_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_side2_questgiver_condition_playerCompletedQuest (player, npc)) { npe_side2_questgiver_action_facePlayer (player, npc); //-- NPC: Thank you again! string_id message = new string_id (c_stringFile, "s_21"); chat.chat (npc, player, message); return SCRIPT_CONTINUE; } //-- [NOTE] if (npe_side2_questgiver_condition_playerOnQuest (player, npc)) { npe_side2_questgiver_action_facePlayer (player, npc); //-- NPC: Have you found it yet? string_id message = new string_id (c_stringFile, "s_14"); int numberOfResponses = 0; boolean hasResponse = false; //-- PLAYER: Not yet. boolean hasResponse0 = false; if (!npe_side2_questgiver_condition_playerReadyForReward (player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse0 = true; } //-- PLAYER: Yes. It appears to still be working. boolean hasResponse1 = false; if (npe_side2_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_side2_questgiver.branchId", 2); npcStartConversation (player, npc, "npe_side2_questgiver", message, responses); } else { chat.chat (npc, player, message); } return SCRIPT_CONTINUE; } //-- [NOTE] if (npe_side2_questgiver_condition_playerCompletedMainQuest (player, npc)) { npe_side2_questgiver_action_facePlayer (player, npc); //-- NPC: I'm sorry to bother you, but I have nowhere else to turn. string_id message = new string_id (c_stringFile, "s_13"); int numberOfResponses = 0; boolean hasResponse = false; //-- PLAYER: What do you need? boolean hasResponse0 = false; if (npe_side2_questgiver_condition__defaultCondition (player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse0 = true; } //-- PLAYER: I don't have time right now. boolean hasResponse1 = false; if (npe_side2_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_23"); if (hasResponse1) responses [responseIndex++] = new string_id (c_stringFile, "s_39"); utils.setScriptVar (player, "conversation.npe_side2_questgiver.branchId", 6); npcStartConversation (player, npc, "npe_side2_questgiver", message, responses); } else { chat.chat (npc, player, message); } return SCRIPT_CONTINUE; } //-- [NOTE] if (npe_side2_questgiver_condition__defaultCondition (player, npc)) { npe_side2_questgiver_action_facePlayer (player, npc); //-- NPC: I need someone with solid skills. Please come back when you have completed your training. string_id message = new string_id (c_stringFile, "s_44"); 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_side2_questgiver") return SCRIPT_CONTINUE; obj_id npc = self; int branchId = utils.getIntScriptVar (player, "conversation.npe_side2_questgiver.branchId"); if (branchId == 2 && npe_side2_questgiver_handleBranch2 (player, npc, response) == SCRIPT_CONTINUE) return SCRIPT_CONTINUE; if (branchId == 4 && npe_side2_questgiver_handleBranch4 (player, npc, response) == SCRIPT_CONTINUE) return SCRIPT_CONTINUE; if (branchId == 6 && npe_side2_questgiver_handleBranch6 (player, npc, response) == SCRIPT_CONTINUE) return SCRIPT_CONTINUE; if (branchId == 7 && npe_side2_questgiver_handleBranch7 (player, npc, response) == SCRIPT_CONTINUE) return SCRIPT_CONTINUE; if (branchId == 8 && npe_side2_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_side2_questgiver.branchId"); return SCRIPT_CONTINUE; } // ======================================================================