// ====================================================================== // // heraldlok.script // // // // Created with SwgConversationEditor 1.36 - DO NOT EDIT THIS AUTO-GENERATED FILE! // // ====================================================================== // ====================================================================== // Library Includes // ====================================================================== include library.ai_lib; include library.chat; include library.utils; // ====================================================================== // Script Constants // ====================================================================== string c_stringFile = "conversation/heraldlok"; // ====================================================================== // Script Conditions // ====================================================================== boolean heraldlok_condition__defaultCondition (obj_id player, obj_id npc) { return true; } // ---------------------------------------------------------------------- boolean heraldlok_condition_hasKimogilaTownWaypoint (obj_id player, obj_id npc) { location kimogilaLoc = new location(-70, 0, 2600); string kimogilaName = "Kimogila Town"; obj_id[] playerWaypoints = getWaypointsInDatapad(player); if ( playerWaypoints != null && playerWaypoints.length > 0 ) { for ( int i = 0; i < playerWaypoints.length; i++ ) { string waypointName = getWaypointName(playerWaypoints[i]); location waypointLoc = getWaypointLocation(playerWaypoints[i]); if ( waypointName.equals(kimogilaName) || waypointLoc == kimogilaLoc ) { return true; } } } return false; } // ---------------------------------------------------------------------- boolean heraldlok_condition_hasCanyonCorsairWaypoint (obj_id player, obj_id npc) { location corsairLoc = new location(-3692, 0, -3800); string corsairName = "Canyon Corsair Stronghold"; obj_id[] playerWaypoints = getWaypointsInDatapad(player); if ( playerWaypoints != null && playerWaypoints.length > 0 ) { for ( int i = 0; i < playerWaypoints.length; i++ ) { string waypointName = getWaypointName(playerWaypoints[i]); location waypointLoc = getWaypointLocation(playerWaypoints[i]); if ( waypointName.equals(corsairName) || waypointLoc == corsairLoc ) { return true; } } } return false; } // ---------------------------------------------------------------------- boolean heraldlok_condition_hasBothWaypoints (obj_id player, obj_id npc) { return (heraldlok_condition_hasKimogilaTownWaypoint(player, npc) && heraldlok_condition_hasCanyonCorsairWaypoint(player, npc)); } // ====================================================================== // Script Actions // ====================================================================== void heraldlok_action_waypoint1 (obj_id player, obj_id npc) { location kimogila = new location(-70, 0, 2600); obj_id waypoint = createWaypointInDatapad(player, kimogila); setWaypointName(waypoint, "Kimogila Town"); setWaypointColor( waypoint, "blue" ); setWaypointVisible( waypoint, true ); setWaypointActive( waypoint, true ); doAnimationAction(npc, "shrug_shoulders"); } // ---------------------------------------------------------------------- void heraldlok_action_waypoint2 (obj_id player, obj_id npc) { location corsair = new location(-3692, 0, -3800); obj_id waypoint = createWaypointInDatapad(player, corsair); setWaypointName(waypoint, "Canyon Corsair Stronghold"); setWaypointColor( waypoint, "blue" ); setWaypointVisible( waypoint, true ); setWaypointActive( waypoint, true ); } // ---------------------------------------------------------------------- void heraldlok_action_waypoint3 (obj_id player, obj_id npc) { location bloodrazor = new location(3508, 0, 2084); obj_id waypoint = createWaypointInDatapad(player, bloodrazor); setWaypointName(waypoint, "Downed Bloodrazor Smuggling Ship"); setWaypointColor( waypoint, "blue" ); setWaypointVisible( waypoint, true ); setWaypointActive( waypoint, true ); } // ---------------------------------------------------------------------- void heraldlok_action_waypoint4 (obj_id player, obj_id npc) { location droid = new location(3172, 0, -4772); obj_id waypoint = createWaypointInDatapad(player, droid); setWaypointName(waypoint, "Droid Engineer's Cave"); setWaypointColor( waypoint, "blue" ); setWaypointVisible( waypoint, true ); setWaypointActive( waypoint, true ); } // ====================================================================== // Script %TO Tokens // ====================================================================== // ====================================================================== // Script %DI Tokens // ====================================================================== // ====================================================================== // Script %DF Tokens // ====================================================================== // ====================================================================== // handleBranch Functions // ====================================================================== int heraldlok_handleBranch1 (obj_id player, obj_id npc, string_id response) { //-- [BRANCH NOTE] //-- NPC: You do not seem to be a part of the Empire. Ha! As if I care what affiliation you have. I left the Alliance years ago, but... I left with a bit of information regarding the location of certain points of interest. Are you interested in what I have to say? //-- [RESPONSE NOTE] //-- PLAYER: Yes, I am. if (response == "s_36a4e374") { //-- [NOTE] if (heraldlok_condition__defaultCondition (player, npc)) { //-- NPC: I knew you were hungry for information. Which location do you want to hear about? I have information regarding the 'Kimogila Town', and 'Canyon Corsair Stronghold'. They are all interesting places, I assure you. string_id message = new string_id (c_stringFile, "s_ff7f26e1"); int numberOfResponses = 0; boolean hasResponse = false; //-- PLAYER: Kimogila Town. boolean hasResponse0 = false; if (!heraldlok_condition_hasKimogilaTownWaypoint (player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse0 = true; } //-- PLAYER: Canyon Corsair Stronghold. boolean hasResponse1 = false; if (!heraldlok_condition_hasCanyonCorsairWaypoint (player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse1 = true; } //-- PLAYER: Why are you telling me this information? boolean hasResponse2 = false; if (heraldlok_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_95bfd0f3"); if (hasResponse1) responses [responseIndex++] = new string_id (c_stringFile, "s_434a59e6"); if (hasResponse2) responses [responseIndex++] = new string_id (c_stringFile, "s_5e804346"); utils.setScriptVar (player, "conversation.heraldlok.branchId", 2); npcSpeak (player, message); npcSetConversationResponses (player, responses); } else { utils.removeScriptVar (player, "conversation.heraldlok.branchId"); npcEndConversationWithMessage (player, message); } return SCRIPT_CONTINUE; } } //-- [RESPONSE NOTE] //-- PLAYER: No, not really. if (response == "s_c5a66e82") { //-- [NOTE] if (heraldlok_condition__defaultCondition (player, npc)) { //-- NPC: Suit yourself. I'll wait for someone else. My information is worth alot of credits to many people. string_id message = new string_id (c_stringFile, "s_6336e957"); utils.removeScriptVar (player, "conversation.heraldlok.branchId"); npcEndConversationWithMessage (player, message); return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } // ---------------------------------------------------------------------- int heraldlok_handleBranch2 (obj_id player, obj_id npc, string_id response) { //-- [BRANCH NOTE] //-- NPC: I knew you were hungry for information. Which location do you want to hear about? I have information regarding the 'Kimogila Town', and 'Canyon Corsair Stronghold'. They are all interesting places, I assure you. //-- [RESPONSE NOTE] //-- PLAYER: Kimogila Town. if (response == "s_95bfd0f3") { //-- [NOTE] if (heraldlok_condition__defaultCondition (player, npc)) { heraldlok_action_waypoint1 (player, npc); //-- NPC: You'd be daft if you wanted to go there. Nonetheless, it's your life, not mine. I can give you the general location of the place, but the exact location was corrupted in my database. I'll download the information into your datapad, but that's all I can do. string_id message = new string_id (c_stringFile, "s_a5343515"); utils.removeScriptVar (player, "conversation.heraldlok.branchId"); npcEndConversationWithMessage (player, message); return SCRIPT_CONTINUE; } } //-- [RESPONSE NOTE] //-- PLAYER: Canyon Corsair Stronghold. if (response == "s_434a59e6") { //-- [NOTE] if (heraldlok_condition__defaultCondition (player, npc)) { heraldlok_action_waypoint2 (player, npc); //-- NPC: I hope you have several friends with you. Now, granted, I haven't really been to any of these places, but... I've heard things. Enough of my babble. I'll download the general location into your datapad. It's not exact, but close enough. string_id message = new string_id (c_stringFile, "s_be60eda6"); utils.removeScriptVar (player, "conversation.heraldlok.branchId"); npcEndConversationWithMessage (player, message); return SCRIPT_CONTINUE; } } //-- [RESPONSE NOTE] //-- PLAYER: Why are you telling me this information? if (response == "s_5e804346") { //-- [NOTE] if (heraldlok_condition__defaultCondition (player, npc)) { //-- NPC: I used to be a part of the Rebel Alliance Spy Network, but I decided that my skills were needed elsewhere. I collected information for them regarding the activity on Lok. Obviously, they didn't like the fact that their systems were easy to hack. I left on account of 'unresolved differances'. Err--why am I telling you this? string_id message = new string_id (c_stringFile, "s_e933930f"); int numberOfResponses = 0; boolean hasResponse = false; //-- PLAYER: I, uh, really need to go. boolean hasResponse0 = false; if (heraldlok_condition__defaultCondition (player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse0 = true; } //-- PLAYER: How about those locations again? boolean hasResponse1 = false; if (!heraldlok_condition_hasBothWaypoints (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_a8387526"); if (hasResponse1) responses [responseIndex++] = new string_id (c_stringFile, "s_119ff40f"); utils.setScriptVar (player, "conversation.heraldlok.branchId", 5); npcSpeak (player, message); npcSetConversationResponses (player, responses); } else { utils.removeScriptVar (player, "conversation.heraldlok.branchId"); npcEndConversationWithMessage (player, message); } return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } // ---------------------------------------------------------------------- int heraldlok_handleBranch5 (obj_id player, obj_id npc, string_id response) { //-- [BRANCH NOTE] //-- NPC: I used to be a part of the Rebel Alliance Spy Network, but I decided that my skills were needed elsewhere. I collected information for them regarding the activity on Lok. Obviously, they didn't like the fact that their systems were easy to hack. I left on account of 'unresolved differances'. Err--why am I telling you this? //-- [RESPONSE NOTE] //-- PLAYER: I, uh, really need to go. if (response == "s_a8387526") { //-- [NOTE] if (heraldlok_condition__defaultCondition (player, npc)) { //-- NPC: Okay. Good bye! string_id message = new string_id (c_stringFile, "s_7117043f"); utils.removeScriptVar (player, "conversation.heraldlok.branchId"); npcEndConversationWithMessage (player, message); return SCRIPT_CONTINUE; } } //-- [RESPONSE NOTE] //-- PLAYER: How about those locations again? if (response == "s_119ff40f") { //-- [NOTE] if (heraldlok_condition__defaultCondition (player, npc)) { //-- NPC: Oh, so now you want to hear about them. Fine. Which do you want to hear about? I have information regarding the 'Kimogila Town', and 'Canyon Corsair Stronghold'. string_id message = new string_id (c_stringFile, "s_57d2d366"); int numberOfResponses = 0; boolean hasResponse = false; //-- PLAYER: Kimogila Town. boolean hasResponse0 = false; if (!heraldlok_condition_hasKimogilaTownWaypoint (player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse0 = true; } //-- PLAYER: Canyon Corsair Stronghold. boolean hasResponse1 = false; if (!heraldlok_condition_hasCanyonCorsairWaypoint (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_16"); if (hasResponse1) responses [responseIndex++] = new string_id (c_stringFile, "s_20"); utils.setScriptVar (player, "conversation.heraldlok.branchId", 7); npcSpeak (player, message); npcSetConversationResponses (player, responses); } else { utils.removeScriptVar (player, "conversation.heraldlok.branchId"); npcEndConversationWithMessage (player, message); } return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } // ---------------------------------------------------------------------- int heraldlok_handleBranch7 (obj_id player, obj_id npc, string_id response) { //-- [BRANCH NOTE] //-- NPC: Oh, so now you want to hear about them. Fine. Which do you want to hear about? I have information regarding the 'Kimogila Town', and 'Canyon Corsair Stronghold'. //-- [RESPONSE NOTE] //-- PLAYER: Kimogila Town. if (response == "s_16") { //-- [NOTE] if (heraldlok_condition__defaultCondition (player, npc)) { heraldlok_action_waypoint1 (player, npc); //-- NPC: You'd be daft if you wanted to go there. Nonetheless, it's your life, not mine. I can give you the general location of the place, but the exact location was corrupted in my database. I'll download the information into your datapad, but that's all I can do. string_id message = new string_id (c_stringFile, "s_18"); utils.removeScriptVar (player, "conversation.heraldlok.branchId"); npcEndConversationWithMessage (player, message); return SCRIPT_CONTINUE; } } //-- [RESPONSE NOTE] //-- PLAYER: Canyon Corsair Stronghold. if (response == "s_20") { //-- [NOTE] if (heraldlok_condition__defaultCondition (player, npc)) { heraldlok_action_waypoint2 (player, npc); //-- NPC: I hope you have several friends with you. Now, granted, I haven't really been to any of these places, but... I've heard things. Enough of my babble. I'll download the general location into your datapad. It's not exact, but close enough. string_id message = new string_id (c_stringFile, "s_22"); utils.removeScriptVar (player, "conversation.heraldlok.branchId"); npcEndConversationWithMessage (player, message); return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } // ---------------------------------------------------------------------- // ====================================================================== // User Script Triggers // ====================================================================== trigger OnInitialize () { if ((!isTangible (self)) || (isPlayer (self))) detachScript(self, "conversation.heraldlok"); 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.heraldlok"); 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 (heraldlok_condition__defaultCondition (player, npc)) { //-- NPC: You do not seem to be a part of the Empire. Ha! As if I care what affiliation you have. I left the Alliance years ago, but... I left with a bit of information regarding the location of certain points of interest. Are you interested in what I have to say? string_id message = new string_id (c_stringFile, "s_599fe081"); int numberOfResponses = 0; boolean hasResponse = false; //-- PLAYER: Yes, I am. boolean hasResponse0 = false; if (heraldlok_condition__defaultCondition (player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse0 = true; } //-- PLAYER: No, not really. boolean hasResponse1 = false; if (heraldlok_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_36a4e374"); if (hasResponse1) responses [responseIndex++] = new string_id (c_stringFile, "s_c5a66e82"); utils.setScriptVar (player, "conversation.heraldlok.branchId", 1); npcStartConversation (player, npc, "heraldlok", message, responses); } else { 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 != "heraldlok") return SCRIPT_CONTINUE; obj_id npc = self; int branchId = utils.getIntScriptVar (player, "conversation.heraldlok.branchId"); if (branchId == 1 && heraldlok_handleBranch1 (player, npc, response) == SCRIPT_CONTINUE) return SCRIPT_CONTINUE; if (branchId == 2 && heraldlok_handleBranch2 (player, npc, response) == SCRIPT_CONTINUE) return SCRIPT_CONTINUE; if (branchId == 5 && heraldlok_handleBranch5 (player, npc, response) == SCRIPT_CONTINUE) return SCRIPT_CONTINUE; if (branchId == 7 && heraldlok_handleBranch7 (player, npc, response) == SCRIPT_CONTINUE) return SCRIPT_CONTINUE; chat.chat (npc, "Error: Fell through all branches and responses for OnNpcConversationResponse."); utils.removeScriptVar (player, "conversation.heraldlok.branchId"); return SCRIPT_CONTINUE; } // ======================================================================