// ====================================================================== // // ep3_cheyerooto.script // Copyright 2004, Sony Online Entertainment // All Rights Reserved. // // Created with SwgConversationEditor 1.30 - 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/ep3_cheyerooto"; // ====================================================================== // Script Conditions // ====================================================================== boolean ep3_cheyerooto_condition__defaultCondition (obj_id player, obj_id npc) { return true; } // ---------------------------------------------------------------------- boolean ep3_cheyerooto_condition_isReadyToCompleteWrhisch (obj_id player, obj_id npc) { return groundquests.isTaskActive(player, "ep3_sera_wrhisch_liver", "wrhischReadyToComplete"); } // ---------------------------------------------------------------------- boolean ep3_cheyerooto_condition_hasCompletedWrhischQuest (obj_id player, obj_id npc) { return groundquests.hasCompletedQuest(player, "ep3_sera_wrhisch_liver"); } // ---------------------------------------------------------------------- boolean ep3_cheyerooto_condition_isRootQuestActive (obj_id player, obj_id npc) { return groundquests.isQuestActive(player, "ep3_cheyerooto_5_rrwii_root"); } // ---------------------------------------------------------------------- boolean ep3_cheyerooto_condition_readyToCompleteRrwii (obj_id player, obj_id npc) { return groundquests.isTaskActive(player, "ep3_cheyerooto_5_rrwii_root", "cheyerootoRrwiiComplete"); } // ---------------------------------------------------------------------- boolean ep3_cheyerooto_condition_hasCompletedRrwiiQuest (obj_id player, obj_id npc) { return groundquests.hasCompletedQuest(player, "ep3_cheyerooto_5_rrwii_root"); } // ---------------------------------------------------------------------- boolean ep3_cheyerooto_condition_isWookieeNub (obj_id player, obj_id npc) { return utils.canSpeakWookiee(player, npc); } // ====================================================================== // Script Actions // ====================================================================== void ep3_cheyerooto_action_grantRootGather (obj_id player, obj_id npc) { groundquests.grantQuest(player, "ep3_cheyerooto_5_rrwii_root"); } // ---------------------------------------------------------------------- void ep3_cheyerooto_action_giveWrhischReward (obj_id player, obj_id npc) { groundquests.sendSignal(player, "giveWrhischReward"); } // ---------------------------------------------------------------------- void ep3_cheyerooto_action_giveRrwiiReward (obj_id player, obj_id npc) { groundquests.sendSignal(player, "rrwiiGiveReward"); } // ---------------------------------------------------------------------- void ep3_cheyerooto_action_schoolWookieeNub (obj_id player, obj_id npc) { utils.emoteWookieeConfusion(player, npc); } // ====================================================================== // Script %TO Tokens // ====================================================================== // ====================================================================== // Script %DI Tokens // ====================================================================== // ====================================================================== // Script %DF Tokens // ====================================================================== // ====================================================================== // handleBranch Functions // ====================================================================== int ep3_cheyerooto_handleBranch3 (obj_id player, obj_id npc, string_id response) { //-- [BRANCH NOTE] //-- NPC: Do you have the roots? //-- [RESPONSE NOTE] //-- PLAYER: Yes, I have them here. if (response == "s_514") { //-- [NOTE] if (ep3_cheyerooto_condition__defaultCondition (player, npc)) { ep3_cheyerooto_action_giveRrwiiReward (player, npc); //-- NPC: This is most fortunate. string_id message = new string_id (c_stringFile, "s_516"); int numberOfResponses = 0; boolean hasResponse = false; //-- PLAYER: What can be done with this? boolean hasResponse0 = false; if (ep3_cheyerooto_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_327"); utils.setScriptVar (player, "conversation.ep3_cheyerooto.branchId", 4); npcSpeak (player, message); npcSetConversationResponses (player, responses); } else { utils.removeScriptVar (player, "conversation.ep3_cheyerooto.branchId"); chat.chat (npc, player, message); npcEndConversation (player); } return SCRIPT_CONTINUE; } } //-- [RESPONSE NOTE] //-- PLAYER: Not yet. Where did you say they were located? if (response == "s_518") { //-- [NOTE] if (ep3_cheyerooto_condition__defaultCondition (player, npc)) { //-- NPC: In the hunting grounds. string_id message = new string_id (c_stringFile, "s_520"); utils.removeScriptVar (player, "conversation.ep3_cheyerooto.branchId"); chat.chat (npc, player, message); npcEndConversation (player); return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } // ---------------------------------------------------------------------- int ep3_cheyerooto_handleBranch4 (obj_id player, obj_id npc, string_id response) { //-- [BRANCH NOTE] //-- NPC: This is most fortunate. //-- [RESPONSE NOTE] //-- PLAYER: What can be done with this? if (response == "s_327") { //-- [NOTE] if (ep3_cheyerooto_condition__defaultCondition (player, npc)) { //-- NPC: Now I can begin working on a cure. I thank you for all you have done friend. string_id message = new string_id (c_stringFile, "s_329"); utils.removeScriptVar (player, "conversation.ep3_cheyerooto.branchId"); chat.chat (npc, player, message); npcEndConversation (player); return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } // ---------------------------------------------------------------------- int ep3_cheyerooto_handleBranch7 (obj_id player, obj_id npc, string_id response) { //-- [BRANCH NOTE] //-- NPC: This was one of the last few parts needed for a treatment I have been working on as I'm sure Sera mentioned. Now that it is finished I was wondering if you could assist me further. //-- [RESPONSE NOTE] //-- PLAYER: What would I need to do? if (response == "s_524") { //-- [NOTE] if (ep3_cheyerooto_condition__defaultCondition (player, npc)) { //-- NPC: There is a root called Rrwii, it grows in Etyyy the sacred hunting grounds. The rodians have taken over this area, claiming all game there as their own. I need you to gain entrance to these lands, and collect for me five of this root. string_id message = new string_id (c_stringFile, "s_526"); int numberOfResponses = 0; boolean hasResponse = false; //-- PLAYER: I will get them for you. boolean hasResponse0 = false; if (ep3_cheyerooto_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_528"); utils.setScriptVar (player, "conversation.ep3_cheyerooto.branchId", 8); npcSpeak (player, message); npcSetConversationResponses (player, responses); } else { utils.removeScriptVar (player, "conversation.ep3_cheyerooto.branchId"); chat.chat (npc, player, message); npcEndConversation (player); } return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } // ---------------------------------------------------------------------- int ep3_cheyerooto_handleBranch8 (obj_id player, obj_id npc, string_id response) { //-- [BRANCH NOTE] //-- NPC: There is a root called Rrwii, it grows in Etyyy the sacred hunting grounds. The rodians have taken over this area, claiming all game there as their own. I need you to gain entrance to these lands, and collect for me five of this root. //-- [RESPONSE NOTE] //-- PLAYER: I will get them for you. if (response == "s_528") { //-- [NOTE] if (ep3_cheyerooto_condition__defaultCondition (player, npc)) { ep3_cheyerooto_action_grantRootGather (player, npc); //-- NPC: Thank you again. I will have more once you return with the samples. string_id message = new string_id (c_stringFile, "s_530"); utils.removeScriptVar (player, "conversation.ep3_cheyerooto.branchId"); chat.chat (npc, player, message); npcEndConversation (player); return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } // ---------------------------------------------------------------------- int ep3_cheyerooto_handleBranch10 (obj_id player, obj_id npc, string_id response) { //-- [BRANCH NOTE] //-- NPC: %NU, are you the one Sera contacted me about? //-- [RESPONSE NOTE] //-- PLAYER: I have the liver you requested. if (response == "s_534") { //-- [NOTE] if (ep3_cheyerooto_condition__defaultCondition (player, npc)) { ep3_cheyerooto_action_giveWrhischReward (player, npc); //-- NPC: I appreciate your commitment. Killing this creature could not have been an easy task. string_id message = new string_id (c_stringFile, "s_536"); int numberOfResponses = 0; boolean hasResponse = false; //-- PLAYER: It was all I could do to help. boolean hasResponse0 = false; if (ep3_cheyerooto_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_538"); utils.setScriptVar (player, "conversation.ep3_cheyerooto.branchId", 11); npcSpeak (player, message); npcSetConversationResponses (player, responses); } else { utils.removeScriptVar (player, "conversation.ep3_cheyerooto.branchId"); chat.chat (npc, player, message); npcEndConversation (player); } return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } // ---------------------------------------------------------------------- int ep3_cheyerooto_handleBranch11 (obj_id player, obj_id npc, string_id response) { //-- [BRANCH NOTE] //-- NPC: I appreciate your commitment. Killing this creature could not have been an easy task. //-- [RESPONSE NOTE] //-- PLAYER: It was all I could do to help. if (response == "s_538") { //-- [NOTE] if (ep3_cheyerooto_condition_isWookieeNub (player, npc)) { ep3_cheyerooto_action_schoolWookieeNub (player, npc); //-- NPC: Charakot ka? string_id message = new string_id (c_stringFile, "s_207"); utils.removeScriptVar (player, "conversation.ep3_cheyerooto.branchId"); chat.chat (npc, player, message); npcEndConversation (player); return SCRIPT_CONTINUE; } //-- [NOTE] if (ep3_cheyerooto_condition_hasCompletedRrwiiQuest (player, npc)) { //-- NPC: Thank you for all you have done. Your efforts are doing much to heal this land. string_id message = new string_id (c_stringFile, "s_322"); utils.removeScriptVar (player, "conversation.ep3_cheyerooto.branchId"); chat.chat (npc, player, message); npcEndConversation (player); return SCRIPT_CONTINUE; } //-- [NOTE] if (ep3_cheyerooto_condition_isRootQuestActive (player, npc)) { //-- NPC: Do you have the roots? string_id message = new string_id (c_stringFile, "s_512"); int numberOfResponses = 0; boolean hasResponse = false; //-- PLAYER: Yes, I have them here. boolean hasResponse0 = false; if (ep3_cheyerooto_condition_readyToCompleteRrwii (player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse0 = true; } //-- PLAYER: Not yet. Where did you say they were located? boolean hasResponse1 = false; if (ep3_cheyerooto_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_514"); if (hasResponse1) responses [responseIndex++] = new string_id (c_stringFile, "s_518"); utils.setScriptVar (player, "conversation.ep3_cheyerooto.branchId", 3); npcSpeak (player, message); npcSetConversationResponses (player, responses); } else { utils.removeScriptVar (player, "conversation.ep3_cheyerooto.branchId"); chat.chat (npc, player, message); npcEndConversation (player); } return SCRIPT_CONTINUE; } //-- [NOTE] if (ep3_cheyerooto_condition_hasCompletedWrhischQuest (player, npc)) { //-- NPC: This was one of the last few parts needed for a treatment I have been working on as I'm sure Sera mentioned. Now that it is finished I was wondering if you could assist me further. string_id message = new string_id (c_stringFile, "s_522"); int numberOfResponses = 0; boolean hasResponse = false; //-- PLAYER: What would I need to do? boolean hasResponse0 = false; if (ep3_cheyerooto_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_524"); utils.setScriptVar (player, "conversation.ep3_cheyerooto.branchId", 7); npcSpeak (player, message); npcSetConversationResponses (player, responses); } else { utils.removeScriptVar (player, "conversation.ep3_cheyerooto.branchId"); chat.chat (npc, player, message); npcEndConversation (player); } return SCRIPT_CONTINUE; } //-- [NOTE] if (ep3_cheyerooto_condition_isReadyToCompleteWrhisch (player, npc)) { //-- NPC: %NU, are you the one Sera contacted me about? string_id message = new string_id (c_stringFile, "s_532"); int numberOfResponses = 0; boolean hasResponse = false; //-- PLAYER: I have the liver you requested. boolean hasResponse0 = false; if (ep3_cheyerooto_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_534"); utils.setScriptVar (player, "conversation.ep3_cheyerooto.branchId", 10); prose_package pp = new prose_package (); pp.stringId = message; pp.actor.set (player); pp.target.set (npc); npcSpeak (player, pp); npcSetConversationResponses (player, responses); } else { utils.removeScriptVar (player, "conversation.ep3_cheyerooto.branchId"); prose_package pp = new prose_package (); pp.stringId = message; pp.actor.set (player); pp.target.set (npc); chat.chat (npc, player, pp); npcEndConversation (player); } return SCRIPT_CONTINUE; } //-- [NOTE] if (ep3_cheyerooto_condition__defaultCondition (player, npc)) { //-- NPC: I'm very busy here working on an epidemic. Perhaps you can speak with Sera Jossi, she is a friend of mine down by the river to the north. string_id message = new string_id (c_stringFile, "s_540"); utils.removeScriptVar (player, "conversation.ep3_cheyerooto.branchId"); chat.chat (npc, player, message); npcEndConversation (player); return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } // ---------------------------------------------------------------------- // ====================================================================== // User Script Triggers // ====================================================================== trigger OnInitialize () { if ((!isMob (self)) || (isPlayer (self))) detachScript(self, "conversation.ep3_cheyerooto"); 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.ep3_cheyerooto"); 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 (ep3_cheyerooto_condition_isWookieeNub (player, npc)) { ep3_cheyerooto_action_schoolWookieeNub (player, npc); //-- NPC: Charakot ka? string_id message = new string_id (c_stringFile, "s_207"); chat.chat (npc, player, message); return SCRIPT_CONTINUE; } //-- [NOTE] if (ep3_cheyerooto_condition_hasCompletedRrwiiQuest (player, npc)) { //-- NPC: Thank you for all you have done. Your efforts are doing much to heal this land. string_id message = new string_id (c_stringFile, "s_322"); chat.chat (npc, player, message); return SCRIPT_CONTINUE; } //-- [NOTE] if (ep3_cheyerooto_condition_isRootQuestActive (player, npc)) { //-- NPC: Do you have the roots? string_id message = new string_id (c_stringFile, "s_512"); int numberOfResponses = 0; boolean hasResponse = false; //-- PLAYER: Yes, I have them here. boolean hasResponse0 = false; if (ep3_cheyerooto_condition_readyToCompleteRrwii (player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse0 = true; } //-- PLAYER: Not yet. Where did you say they were located? boolean hasResponse1 = false; if (ep3_cheyerooto_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_514"); if (hasResponse1) responses [responseIndex++] = new string_id (c_stringFile, "s_518"); utils.setScriptVar (player, "conversation.ep3_cheyerooto.branchId", 3); npcStartConversation (player, npc, "ep3_cheyerooto", message, responses); } else { chat.chat (npc, player, message); } return SCRIPT_CONTINUE; } //-- [NOTE] if (ep3_cheyerooto_condition_hasCompletedWrhischQuest (player, npc)) { //-- NPC: This was one of the last few parts needed for a treatment I have been working on as I'm sure Sera mentioned. Now that it is finished I was wondering if you could assist me further. string_id message = new string_id (c_stringFile, "s_522"); int numberOfResponses = 0; boolean hasResponse = false; //-- PLAYER: What would I need to do? boolean hasResponse0 = false; if (ep3_cheyerooto_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_524"); utils.setScriptVar (player, "conversation.ep3_cheyerooto.branchId", 7); npcStartConversation (player, npc, "ep3_cheyerooto", message, responses); } else { chat.chat (npc, player, message); } return SCRIPT_CONTINUE; } //-- [NOTE] if (ep3_cheyerooto_condition_isReadyToCompleteWrhisch (player, npc)) { //-- NPC: %NU, are you the one Sera contacted me about? string_id message = new string_id (c_stringFile, "s_532"); int numberOfResponses = 0; boolean hasResponse = false; //-- PLAYER: I have the liver you requested. boolean hasResponse0 = false; if (ep3_cheyerooto_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_534"); utils.setScriptVar (player, "conversation.ep3_cheyerooto.branchId", 10); prose_package pp = new prose_package (); pp.stringId = message; pp.actor.set (player); pp.target.set (npc); npcStartConversation (player, npc, "ep3_cheyerooto", null, pp, responses); } else { prose_package pp = new prose_package (); pp.stringId = message; pp.actor.set (player); pp.target.set (npc); chat.chat (npc, player, null, null, pp); } return SCRIPT_CONTINUE; } //-- [NOTE] if (ep3_cheyerooto_condition__defaultCondition (player, npc)) { //-- NPC: I'm very busy here working on an epidemic. Perhaps you can speak with Sera Jossi, she is a friend of mine down by the river to the north. string_id message = new string_id (c_stringFile, "s_540"); 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 != "ep3_cheyerooto") return SCRIPT_CONTINUE; obj_id npc = self; int branchId = utils.getIntScriptVar (player, "conversation.ep3_cheyerooto.branchId"); if (branchId == 3 && ep3_cheyerooto_handleBranch3 (player, npc, response) == SCRIPT_CONTINUE) return SCRIPT_CONTINUE; if (branchId == 4 && ep3_cheyerooto_handleBranch4 (player, npc, response) == SCRIPT_CONTINUE) return SCRIPT_CONTINUE; if (branchId == 7 && ep3_cheyerooto_handleBranch7 (player, npc, response) == SCRIPT_CONTINUE) return SCRIPT_CONTINUE; if (branchId == 8 && ep3_cheyerooto_handleBranch8 (player, npc, response) == SCRIPT_CONTINUE) return SCRIPT_CONTINUE; if (branchId == 10 && ep3_cheyerooto_handleBranch10 (player, npc, response) == SCRIPT_CONTINUE) return SCRIPT_CONTINUE; if (branchId == 11 && ep3_cheyerooto_handleBranch11 (player, npc, response) == SCRIPT_CONTINUE) return SCRIPT_CONTINUE; chat.chat (npc, "Error: Fell through all branches and responses for OnNpcConversationResponse."); utils.removeScriptVar (player, "conversation.ep3_cheyerooto.branchId"); return SCRIPT_CONTINUE; } // ======================================================================