// ====================================================================== // // nexus_ig88_starter.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/nexus_ig88_starter"; // ====================================================================== // Script Conditions // ====================================================================== boolean nexus_ig88_starter_condition__defaultCondition (obj_id player, obj_id npc) { return true; } // ---------------------------------------------------------------------- boolean nexus_ig88_starter_condition_needsQuest (obj_id player, obj_id npc) { return !groundquests.isQuestActiveOrComplete(player, "feeder_ig88_01"); } // ---------------------------------------------------------------------- boolean nexus_ig88_starter_condition_onQuest (obj_id player, obj_id npc) { return (groundquests.isQuestActive(player, "feeder_ig88_01") || groundquests.isQuestActive(player, "found_ig88_encounter")); } // ---------------------------------------------------------------------- boolean nexus_ig88_starter_condition_finishedQuest (obj_id player, obj_id npc) { return groundquests.hasCompletedQuest(player, "found_ig88_encounter"); } // ====================================================================== // Script Actions // ====================================================================== void nexus_ig88_starter_action_giveQuest (obj_id player, obj_id npc) { groundquests.grantQuest(player, "feeder_ig88_01"); } // ====================================================================== // Script %TO Tokens // ====================================================================== // ====================================================================== // Script %DI Tokens // ====================================================================== // ====================================================================== // Script %DF Tokens // ====================================================================== // ====================================================================== // handleBranch Functions // ====================================================================== int nexus_ig88_starter_handleBranch3 (obj_id player, obj_id npc, string_id response) { //-- [BRANCH NOTE] //-- NPC: Greetings. I represent the great pirate lord Nym. He has asked for the assistance of able adventurers, such as yourself. //-- [RESPONSE NOTE] //-- PLAYER: What does Nym require? if (response == "s_7") { //-- [NOTE] if (nexus_ig88_starter_condition__defaultCondition (player, npc)) { //-- NPC: This is very sensitive information. The Droid IG-88 has taken over a very sensitive factory location of my masters. IG-88 is attempting to replicate himself. My master needs him removed before he draws unwanted attention. Are you up to this task? string_id message = new string_id (c_stringFile, "s_8"); int numberOfResponses = 0; boolean hasResponse = false; //-- PLAYER: No problem. Just point the way. boolean hasResponse0 = false; if (nexus_ig88_starter_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_9"); utils.setScriptVar (player, "conversation.nexus_ig88_starter.branchId", 4); npcSpeak (player, message); npcSetConversationResponses (player, responses); } else { utils.removeScriptVar (player, "conversation.nexus_ig88_starter.branchId"); npcEndConversationWithMessage (player, message); } return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } // ---------------------------------------------------------------------- int nexus_ig88_starter_handleBranch4 (obj_id player, obj_id npc, string_id response) { //-- [BRANCH NOTE] //-- NPC: This is very sensitive information. The Droid IG-88 has taken over a very sensitive factory location of my masters. IG-88 is attempting to replicate himself. My master needs him removed before he draws unwanted attention. Are you up to this task? //-- [RESPONSE NOTE] //-- PLAYER: No problem. Just point the way. if (response == "s_9") { //-- [NOTE] if (nexus_ig88_starter_condition__defaultCondition (player, npc)) { nexus_ig88_starter_action_giveQuest (player, npc); //-- NPC: Excellent. My master will be contacting you shortly. string_id message = new string_id (c_stringFile, "s_10"); utils.removeScriptVar (player, "conversation.nexus_ig88_starter.branchId"); npcEndConversationWithMessage (player, message); return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } // ---------------------------------------------------------------------- // ====================================================================== // User Script Triggers // ====================================================================== trigger OnInitialize () { if ((!isTangible (self)) || (isPlayer (self))) detachScript(self, "conversation.nexus_ig88_starter"); 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.nexus_ig88_starter"); 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 (nexus_ig88_starter_condition_finishedQuest (player, npc)) { //-- NPC: Excellent work. My master was very pleased. string_id message = new string_id (c_stringFile, "s_3"); chat.chat (npc, player, message); return SCRIPT_CONTINUE; } //-- [NOTE] if (nexus_ig88_starter_condition_onQuest (player, npc)) { //-- NPC: Do hurry, my master needs this issue resolved soon. string_id message = new string_id (c_stringFile, "s_4"); chat.chat (npc, player, message); return SCRIPT_CONTINUE; } //-- [NOTE] if (nexus_ig88_starter_condition_needsQuest (player, npc)) { //-- NPC: Greetings. I represent the great pirate lord Nym. He has asked for the assistance of able adventurers, such as yourself. string_id message = new string_id (c_stringFile, "s_5"); int numberOfResponses = 0; boolean hasResponse = false; //-- PLAYER: What does Nym require? boolean hasResponse0 = false; if (nexus_ig88_starter_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_7"); utils.setScriptVar (player, "conversation.nexus_ig88_starter.branchId", 3); npcStartConversation (player, npc, "nexus_ig88_starter", message, responses); } else { chat.chat (npc, player, message); } return SCRIPT_CONTINUE; } //-- [NOTE] if (nexus_ig88_starter_condition__defaultCondition (player, npc)) { //-- NPC: Greetings. string_id message = new string_id (c_stringFile, "s_6"); 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 != "nexus_ig88_starter") return SCRIPT_CONTINUE; obj_id npc = self; int branchId = utils.getIntScriptVar (player, "conversation.nexus_ig88_starter.branchId"); if (branchId == 3 && nexus_ig88_starter_handleBranch3 (player, npc, response) == SCRIPT_CONTINUE) return SCRIPT_CONTINUE; if (branchId == 4 && nexus_ig88_starter_handleBranch4 (player, npc, response) == SCRIPT_CONTINUE) return SCRIPT_CONTINUE; chat.chat (npc, "Error: Fell through all branches and responses for OnNpcConversationResponse."); utils.removeScriptVar (player, "conversation.nexus_ig88_starter.branchId"); return SCRIPT_CONTINUE; } // ======================================================================