// ====================================================================== // // delivery_sickle.script // Copyright 2004, Sony Online Entertainment // All Rights Reserved. // // Created with SwgConversationEditor 1.37 - DO NOT EDIT THIS AUTO-GENERATED FILE! // // ====================================================================== // ====================================================================== // Library Includes // ====================================================================== include library.ai_lib; include library.chat; include library.conversation; include library.groundquests; include library.utils; // ====================================================================== // Script Constants // ====================================================================== string c_stringFile = "conversation/delivery_sickle"; // ====================================================================== // Script Conditions // ====================================================================== boolean delivery_sickle_condition__defaultCondition (obj_id player, obj_id npc) { return true; } // ---------------------------------------------------------------------- boolean delivery_sickle_condition_noAntivirus (obj_id player, obj_id npc) { faceTo(npc, player); return (!groundquests.hasCompletedQuest(player, "outbreak_quest_01_imperial") && !groundquests.hasCompletedQuest(player, "outbreak_quest_01_rebel") && !groundquests.hasCompletedQuest(player, "outbreak_quest_01_neutral")); } // ---------------------------------------------------------------------- boolean delivery_sickle_condition_hasNotFoundBeta (obj_id player, obj_id npc) { return !hasCompletedCollectionSlot(player, "exp_icon_deathtroopers_camp_delta"); } // ---------------------------------------------------------------------- boolean delivery_sickle_condition_neverDelivered (obj_id player, obj_id npc) { faceTo(npc, player); return (!groundquests.isQuestActiveOrComplete(player, "camp_gamma_delivery_01")); } // ---------------------------------------------------------------------- boolean delivery_sickle_condition_hasMeetingTask (obj_id player, obj_id npc) { return groundquests.isTaskActive(player, "camp_gamma_delivery_01", "getBeastGamma"); } // ---------------------------------------------------------------------- boolean delivery_sickle_condition_hasEscortTask (obj_id player, obj_id npc) { return groundquests.isTaskActive(player, "camp_gamma_delivery_01", "escortTaskGamma"); } // ---------------------------------------------------------------------- boolean delivery_sickle_condition_hasDeliveredBefore (obj_id player, obj_id npc) { return groundquests.isQuestActiveOrComplete(player, "camp_gamma_delivery_01"); } // ---------------------------------------------------------------------- boolean delivery_sickle_condition_tooLowLevel (obj_id player, obj_id npc) { return getLevel(player) < 40; } // ====================================================================== // Script Actions // ====================================================================== void delivery_sickle_action_giveQuest (obj_id player, obj_id npc) { faceTo(npc, player); if(groundquests.hasCompletedQuest(player, "camp_gamma_delivery_01")) { delivery_sickle_action_clearDeliveryQuest(player, npc); } groundquests.grantQuest(player, "camp_gamma_delivery_01"); } // ---------------------------------------------------------------------- void delivery_sickle_action_clearDeliveryQuest (obj_id player, obj_id npc) { groundquests.clearQuest(player, "camp_gamma_delivery_01"); } // ====================================================================== // Script %TO Tokens // ====================================================================== // ====================================================================== // Script %DI Tokens // ====================================================================== // ====================================================================== // Script %DF Tokens // ====================================================================== // ====================================================================== // handleBranch Functions // ====================================================================== int delivery_sickle_handleBranch6 (obj_id player, obj_id npc, string_id response) { //-- [BRANCH NOTE] //-- NPC: I need someone good with combat and you look like you want some extra credits! //-- [RESPONSE NOTE] //-- PLAYER: Depends on what you need. if (response == "s_96") { //-- [NOTE] if (delivery_sickle_condition__defaultCondition (player, npc)) { doAnimationAction (npc, "explain"); //-- NPC: I need someone to escort my delivery volunteer to camp beta. I already know you have been there, word gets around. The volunteer knows the way as well so between the two of you no one should get lost. string_id message = new string_id (c_stringFile, "s_97"); int numberOfResponses = 0; boolean hasResponse = false; //-- PLAYER: What are we delivering? boolean hasResponse0 = false; if (delivery_sickle_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_13"); utils.setScriptVar (player, "conversation.delivery_sickle.branchId", 7); npcSpeak (player, message); npcSetConversationResponses (player, responses); } else { utils.removeScriptVar (player, "conversation.delivery_sickle.branchId"); npcEndConversationWithMessage (player, message); } return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } // ---------------------------------------------------------------------- int delivery_sickle_handleBranch7 (obj_id player, obj_id npc, string_id response) { //-- [BRANCH NOTE] //-- NPC: I need someone to escort my delivery volunteer to camp beta. I already know you have been there, word gets around. The volunteer knows the way as well so between the two of you no one should get lost. //-- [RESPONSE NOTE] //-- PLAYER: What are we delivering? if (response == "s_13") { //-- [NOTE] if (delivery_sickle_condition__defaultCondition (player, npc)) { //-- NPC: Medical supplies, food, water, ammunition. What do you think we are delivering? Imperial recruitment posters? Are you interested in helping out? string_id message = new string_id (c_stringFile, "s_17"); int numberOfResponses = 0; boolean hasResponse = false; //-- PLAYER: Sure. I'll help. boolean hasResponse0 = false; if (delivery_sickle_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.delivery_sickle.branchId", 8); npcSpeak (player, message); npcSetConversationResponses (player, responses); } else { utils.removeScriptVar (player, "conversation.delivery_sickle.branchId"); npcEndConversationWithMessage (player, message); } return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } // ---------------------------------------------------------------------- int delivery_sickle_handleBranch8 (obj_id player, obj_id npc, string_id response) { //-- [BRANCH NOTE] //-- NPC: Medical supplies, food, water, ammunition. What do you think we are delivering? Imperial recruitment posters? Are you interested in helping out? //-- [RESPONSE NOTE] //-- PLAYER: Sure. I'll help. if (response == "s_19") { //-- [NOTE] if (delivery_sickle_condition__defaultCondition (player, npc)) { //-- NPC: Oh I almost forgot. You should know that the delivery volunteer is armed with more than weapons. If the volunteer thinks he is about to succomb to the undead he will hit a panic switch and detonate explosives he is carrying. string_id message = new string_id (c_stringFile, "s_21"); int numberOfResponses = 0; boolean hasResponse = false; //-- PLAYER: Uh....why? boolean hasResponse0 = false; if (delivery_sickle_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.delivery_sickle.branchId", 9); npcSpeak (player, message); npcSetConversationResponses (player, responses); } else { utils.removeScriptVar (player, "conversation.delivery_sickle.branchId"); npcEndConversationWithMessage (player, message); } return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } // ---------------------------------------------------------------------- int delivery_sickle_handleBranch9 (obj_id player, obj_id npc, string_id response) { //-- [BRANCH NOTE] //-- NPC: Oh I almost forgot. You should know that the delivery volunteer is armed with more than weapons. If the volunteer thinks he is about to succomb to the undead he will hit a panic switch and detonate explosives he is carrying. //-- [RESPONSE NOTE] //-- PLAYER: Uh....why? if (response == "s_23") { //-- [NOTE] if (delivery_sickle_condition__defaultCondition (player, npc)) { //-- NPC: Why? Because no one wants to come back as one of those things. string_id message = new string_id (c_stringFile, "s_25"); int numberOfResponses = 0; boolean hasResponse = false; //-- PLAYER: Okay...I guess. boolean hasResponse0 = false; if (delivery_sickle_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_27"); utils.setScriptVar (player, "conversation.delivery_sickle.branchId", 10); npcSpeak (player, message); npcSetConversationResponses (player, responses); } else { utils.removeScriptVar (player, "conversation.delivery_sickle.branchId"); npcEndConversationWithMessage (player, message); } return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } // ---------------------------------------------------------------------- int delivery_sickle_handleBranch10 (obj_id player, obj_id npc, string_id response) { //-- [BRANCH NOTE] //-- NPC: Why? Because no one wants to come back as one of those things. //-- [RESPONSE NOTE] //-- PLAYER: Okay...I guess. if (response == "s_27") { //-- [NOTE] if (delivery_sickle_condition__defaultCondition (player, npc)) { delivery_sickle_action_giveQuest (player, npc); //-- NPC: Go to the waypoint in your datapad. I'll send the delivery volunteer as soon as you are there. string_id message = new string_id (c_stringFile, "s_29"); utils.removeScriptVar (player, "conversation.delivery_sickle.branchId"); npcEndConversationWithMessage (player, message); return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } // ---------------------------------------------------------------------- int delivery_sickle_handleBranch12 (obj_id player, obj_id npc, string_id response) { //-- [BRANCH NOTE] //-- NPC: You want to help out with another delivery? Same credit amount if you are interested. //-- [RESPONSE NOTE] //-- PLAYER: Sure. if (response == "s_33") { //-- [NOTE] if (delivery_sickle_condition__defaultCondition (player, npc)) { //-- NPC: Go to the waypoint in your datapad. I'll send the delivery volunteer as soon as you are there. string_id message = new string_id (c_stringFile, "s_35"); utils.removeScriptVar (player, "conversation.delivery_sickle.branchId"); npcEndConversationWithMessage (player, message); return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } // ---------------------------------------------------------------------- // ====================================================================== // User Script Triggers // ====================================================================== trigger OnInitialize () { if ((!isTangible (self)) || (isPlayer (self))) detachScript(self, "conversation.delivery_sickle"); setCondition (self, CONDITION_CONVERSABLE); setCondition (self, CONDITION_INTERESTING); return SCRIPT_CONTINUE; } trigger OnAttach () { setCondition (self, CONDITION_CONVERSABLE); setCondition (self, CONDITION_INTERESTING); 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.delivery_sickle"); 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 (delivery_sickle_condition_noAntivirus (player, npc)) { //-- NPC: You don't have the anti-virus yet?? Get away from me...go see Doctor Cody. She can help you out. string_id message = new string_id (c_stringFile, "s_7"); chat.chat (npc, player, message); return SCRIPT_CONTINUE; } //-- [NOTE] if (delivery_sickle_condition_tooLowLevel (player, npc)) { //-- NPC: I'd ask you to help out but you are a little green behind the ears for anything I have. string_id message = new string_id (c_stringFile, "s_37"); chat.chat (npc, player, message); return SCRIPT_CONTINUE; } //-- [NOTE] if (delivery_sickle_condition_hasNotFoundBeta (player, npc)) { //-- NPC: I hear there is another camp not far from here. If you find it, come back. I have a job you might want. string_id message = new string_id (c_stringFile, "s_10"); chat.chat (npc, player, message); return SCRIPT_CONTINUE; } //-- [NOTE] if (delivery_sickle_condition_hasEscortTask (player, npc)) { delivery_sickle_action_clearDeliveryQuest (player, npc); //-- NPC: I don't know what happened but you managed to lose the delivery volunteer. Come back when you want to try again. string_id message = new string_id (c_stringFile, "s_16"); chat.chat (npc, player, message); return SCRIPT_CONTINUE; } //-- [NOTE] if (delivery_sickle_condition_hasMeetingTask (player, npc)) { //-- NPC: You need to complete the delivery. Go to the waypoint I provided. string_id message = new string_id (c_stringFile, "s_15"); chat.chat (npc, player, message); return SCRIPT_CONTINUE; } //-- [NOTE] if (delivery_sickle_condition_neverDelivered (player, npc)) { doAnimationAction (npc, "thumb_up"); //-- NPC: I need someone good with combat and you look like you want some extra credits! string_id message = new string_id (c_stringFile, "s_73"); int numberOfResponses = 0; boolean hasResponse = false; //-- PLAYER: Depends on what you need. boolean hasResponse0 = false; if (delivery_sickle_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_96"); utils.setScriptVar (player, "conversation.delivery_sickle.branchId", 6); npcStartConversation (player, npc, "delivery_sickle", message, responses); } else { chat.chat (npc, player, message); } return SCRIPT_CONTINUE; } //-- [NOTE] if (delivery_sickle_condition__defaultCondition (player, npc)) { //-- NPC: You want to help out with another delivery? Same credit amount if you are interested. string_id message = new string_id (c_stringFile, "s_31"); int numberOfResponses = 0; boolean hasResponse = false; //-- PLAYER: Sure. boolean hasResponse0 = false; if (delivery_sickle_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_33"); utils.setScriptVar (player, "conversation.delivery_sickle.branchId", 12); npcStartConversation (player, npc, "delivery_sickle", message, responses); } else { chat.chat (npc, player, message); } return SCRIPT_CONTINUE; } //-- [NOTE] if (delivery_sickle_condition__defaultCondition (player, npc)) { //-- NPC: If you are hungry let me know. We have plenty of rations. If you want them hot, you can always leave them out in the sun a while. string_id message = new string_id (c_stringFile, "s_60"); 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 != "delivery_sickle") return SCRIPT_CONTINUE; obj_id npc = self; int branchId = utils.getIntScriptVar (player, "conversation.delivery_sickle.branchId"); if (branchId == 6 && delivery_sickle_handleBranch6 (player, npc, response) == SCRIPT_CONTINUE) return SCRIPT_CONTINUE; if (branchId == 7 && delivery_sickle_handleBranch7 (player, npc, response) == SCRIPT_CONTINUE) return SCRIPT_CONTINUE; if (branchId == 8 && delivery_sickle_handleBranch8 (player, npc, response) == SCRIPT_CONTINUE) return SCRIPT_CONTINUE; if (branchId == 9 && delivery_sickle_handleBranch9 (player, npc, response) == SCRIPT_CONTINUE) return SCRIPT_CONTINUE; if (branchId == 10 && delivery_sickle_handleBranch10 (player, npc, response) == SCRIPT_CONTINUE) return SCRIPT_CONTINUE; if (branchId == 12 && delivery_sickle_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.delivery_sickle.branchId"); return SCRIPT_CONTINUE; } // ======================================================================