// ====================================================================== // // c_ddroid_amarent.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.factions; include library.groundquests; include library.money; include library.utils; // ====================================================================== // Script Constants // ====================================================================== string c_stringFile = "conversation/c_ddroid_amarent"; // ====================================================================== // Script Conditions // ====================================================================== boolean c_ddroid_amarent_condition__defaultCondition (obj_id player, obj_id npc) { return true; } // ---------------------------------------------------------------------- boolean c_ddroid_amarent_condition_isImperialOfc (obj_id player, obj_id npc) { string whichFaction = factions.getDeclaredFaction(player); if (whichFaction==null) return false; if (whichFaction == "Imperial") { int rank = pvpGetCurrentGcwRank(player); if (rank > 1) { return true; } } return false; } // ---------------------------------------------------------------------- boolean c_ddroid_amarent_condition_playeronquest (obj_id player, obj_id npc) { int questId = questGetQuestId("quest/c_darndroid1"); return questIsTaskActive(questId, 3, player) || questIsTaskActive(questId, 4, player); } // ---------------------------------------------------------------------- boolean c_ddroid_amarent_condition_playerlostwaypoint (obj_id player, obj_id npc) { int questId = questGetQuestId("quest/c_darndroid1"); return questIsTaskActive(questId, 4, player); } // ---------------------------------------------------------------------- boolean c_ddroid_amarent_condition_queststuck (obj_id player, obj_id npc) { int questId = questGetQuestId("quest/c_darndroid1"); int canintimidate = groundquests.getTaskId(questId, "canintimidate"); int canbribe = groundquests.getTaskId(questId, "canbribe"); int reward = groundquests.getTaskId(questId, "reward"); return (questIsTaskActive(questId, canintimidate, player) || questIsTaskActive(questId, canbribe, player))&& questIsTaskComplete(questId, reward, player); } // ---------------------------------------------------------------------- boolean c_ddroid_amarent_condition_hasBribeFunds (obj_id player, obj_id npc) { return money.hasFunds(player, money.MT_TOTAL, 1000); } // ====================================================================== // Script Actions // ====================================================================== void c_ddroid_amarent_action_intimidateAmarent (obj_id player, obj_id npc) { groundquests.sendSignal(player, "c_darndroid1_intimidate"); } // ---------------------------------------------------------------------- void c_ddroid_amarent_action_bribeAmarent (obj_id player, obj_id npc) { groundquests.sendSignal(player, "c_darndroid1_bribe"); money.requestPayment(player, npc, 1000, "pass_fail", null, true); } // ---------------------------------------------------------------------- void c_ddroid_amarent_action_amarentGivesInfo (obj_id player, obj_id npc) { groundquests.sendSignal(player, "c_darndroid1_amarent"); /* obj_id top=getTopMostContainer(player); location loc = getLocation(top); loc.x = -2380; loc.y = 0; loc.z = 2031; loc.area = "talus"; obj_id waypoint = createWaypointInDatapad(player, loc); setObjVar(player, "quest.general.quest/c_darndroid1.taluscrash", waypoint); setWaypointName(waypoint, "Talus Crash Site"); setWaypointActive(waypoint, true); */ obj_id waypoint1 = getObjIdObjVar(player, "quest.general.quest/c_darndroid1.amarent"); if (waypoint1 != null) { destroyWaypointInDatapad(waypoint1, player); } removeObjVar(player, "quest.general.quest/c_darndroid1.amarent"); } // ---------------------------------------------------------------------- void c_ddroid_amarent_action_givewaypoint (obj_id player, obj_id npc) { obj_id waypoint1 = getObjIdObjVar(player, "quest.general.quest/c_darndroid1.taluscrash"); if (waypoint1 != null) { destroyWaypointInDatapad(waypoint1, player); } removeObjVar(player, "quest.general.quest/c_darndroid1.taluscrash"); obj_id top=getTopMostContainer(player); location loc = getLocation(top); loc.x = -2368; loc.y = 23; loc.z = 2043; loc.area = "talus"; obj_id waypoint = createWaypointInDatapad(player, loc); setObjVar(player, "quest.general.quest/c_darndroid1.taluscrash", waypoint); setWaypointName(waypoint, "Talus Crash Site"); setWaypointActive(waypoint, true); } // ---------------------------------------------------------------------- void c_ddroid_amarent_action_faceplayer (obj_id player, obj_id npc) { faceTo(npc, player); } // ---------------------------------------------------------------------- void c_ddroid_amarent_action_completequestFix (obj_id player, obj_id npc) { int questId = questGetQuestId("quest/c_darndroid1"); completeQuest(player, questId); obj_id waypoint1 = getObjIdObjVar(player, "quest.general.quest/c_darndroid1.taluscrash"); if (waypoint1 != null) { destroyWaypointInDatapad(waypoint1, player); } removeObjVar(player, "quest.general.quest/c_darndroid1.taluscrash"); obj_id waypoint2 = getObjIdObjVar(player, "quest.general.quest/c_darndroid1.amarent"); if (waypoint2 != null) { destroyWaypointInDatapad(waypoint2, player); } removeObjVar(player, "quest.general.quest/c_darndroid1.amarent"); } // ====================================================================== // Script %TO Tokens // ====================================================================== // ====================================================================== // Script %DI Tokens // ====================================================================== // ====================================================================== // Script %DF Tokens // ====================================================================== // ====================================================================== // handleBranch Functions // ====================================================================== int c_ddroid_amarent_handleBranch1 (obj_id player, obj_id npc, string_id response) { //-- [BRANCH NOTE] //-- NPC: I'm sorry, but I'm really busy. What do you need? //-- [RESPONSE NOTE] //-- PLAYER: Selan Ellison sent me. if (response == "s_281") { //-- [NOTE] if (c_ddroid_amarent_condition__defaultCondition (player, npc)) { //-- NPC: Ah Selan. I hope she is doing well. I don't see her near enough. I have a moment, but as I said, I really am busy. string_id message = new string_id (c_stringFile, "s_283"); int numberOfResponses = 0; boolean hasResponse = false; //-- PLAYER: I'm sure you can make time for someone of my influence. boolean hasResponse0 = false; if (c_ddroid_amarent_condition_isImperialOfc (player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse0 = true; } //-- PLAYER: I need information about a ship that may be lost. boolean hasResponse1 = false; if (!c_ddroid_amarent_condition_isImperialOfc (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_285"); if (hasResponse1) responses [responseIndex++] = new string_id (c_stringFile, "s_301"); utils.setScriptVar (player, "conversation.c_ddroid_amarent.branchId", 2); npcSpeak (player, message); npcSetConversationResponses (player, responses); } else { utils.removeScriptVar (player, "conversation.c_ddroid_amarent.branchId"); npcEndConversationWithMessage (player, message); } return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } // ---------------------------------------------------------------------- int c_ddroid_amarent_handleBranch2 (obj_id player, obj_id npc, string_id response) { //-- [BRANCH NOTE] //-- NPC: Ah Selan. I hope she is doing well. I don't see her near enough. I have a moment, but as I said, I really am busy. //-- [RESPONSE NOTE] //-- PLAYER: I'm sure you can make time for someone of my influence. if (response == "s_285") { //-- [NOTE] if (c_ddroid_amarent_condition__defaultCondition (player, npc)) { doAnimationAction (npc, "salute1"); //-- NPC: Oh! Excuse me sir. Forgive my insolence. Things have just been really busy here. string_id message = new string_id (c_stringFile, "s_287"); int numberOfResponses = 0; boolean hasResponse = false; //-- PLAYER: I'm sure they are. You are forgiven. I need to know about a ship that is missing. boolean hasResponse0 = false; if (c_ddroid_amarent_condition__defaultCondition (player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse0 = true; } //-- PLAYER: There is no excuse for impertinence! I need information on a missing ship, now. boolean hasResponse1 = false; if (c_ddroid_amarent_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_289"); if (hasResponse1) responses [responseIndex++] = new string_id (c_stringFile, "s_293"); utils.setScriptVar (player, "conversation.c_ddroid_amarent.branchId", 3); npcSpeak (player, message); npcSetConversationResponses (player, responses); } else { utils.removeScriptVar (player, "conversation.c_ddroid_amarent.branchId"); npcEndConversationWithMessage (player, message); } return SCRIPT_CONTINUE; } } //-- [RESPONSE NOTE] //-- PLAYER: I need information about a ship that may be lost. if (response == "s_301") { //-- [NOTE] if (c_ddroid_amarent_condition__defaultCondition (player, npc)) { //-- NPC: I'm sorry, but I cannot give out that kind of information unless you are a member of the Imperial Transit Authority. string_id message = new string_id (c_stringFile, "s_303"); int numberOfResponses = 0; boolean hasResponse = false; //-- PLAYER: Would these 1000 credits show that I'm a member of the Imperial Transit Authority? boolean hasResponse0 = false; if (c_ddroid_amarent_condition_hasBribeFunds (player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse0 = true; } //-- PLAYER: Is there anything I can do to change your mind? boolean hasResponse1 = false; if (!c_ddroid_amarent_condition_hasBribeFunds (player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse1 = true; } //-- PLAYER: Is your life really worth a silly rule like that? boolean hasResponse2 = false; if (c_ddroid_amarent_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_305"); if (hasResponse1) responses [responseIndex++] = new string_id (c_stringFile, "s_25"); if (hasResponse2) responses [responseIndex++] = new string_id (c_stringFile, "s_309"); utils.setScriptVar (player, "conversation.c_ddroid_amarent.branchId", 7); npcSpeak (player, message); npcSetConversationResponses (player, responses); } else { utils.removeScriptVar (player, "conversation.c_ddroid_amarent.branchId"); npcEndConversationWithMessage (player, message); } return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } // ---------------------------------------------------------------------- int c_ddroid_amarent_handleBranch3 (obj_id player, obj_id npc, string_id response) { //-- [BRANCH NOTE] //-- NPC: Oh! Excuse me sir. Forgive my insolence. Things have just been really busy here. //-- [RESPONSE NOTE] //-- PLAYER: I'm sure they are. You are forgiven. I need to know about a ship that is missing. if (response == "s_289") { //-- [NOTE] if (c_ddroid_amarent_condition__defaultCondition (player, npc)) { c_ddroid_amarent_action_amarentGivesInfo (player, npc); //-- NPC: Yes sir. I have been investigating that ship. It appears that the ship was diverted to Talus, though I have no information as to whether it crashed due to a malfunction or hijacking. I have been told, sir, that it is a low priority and likely won't be pursued for several more days. Here are the coordinates if you would like to investigate the crash site. string_id message = new string_id (c_stringFile, "s_291"); utils.removeScriptVar (player, "conversation.c_ddroid_amarent.branchId"); npcEndConversationWithMessage (player, message); return SCRIPT_CONTINUE; } } //-- [RESPONSE NOTE] //-- PLAYER: There is no excuse for impertinence! I need information on a missing ship, now. if (response == "s_293") { //-- [NOTE] if (c_ddroid_amarent_condition__defaultCondition (player, npc)) { //-- NPC: Yes sir. Give me a moment to consult with my notes. Yes, I think that ship is here. One more moment... string_id message = new string_id (c_stringFile, "s_295"); int numberOfResponses = 0; boolean hasResponse = false; //-- PLAYER: Come on, man! I don't have all day. boolean hasResponse0 = false; if (c_ddroid_amarent_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_297"); utils.setScriptVar (player, "conversation.c_ddroid_amarent.branchId", 5); npcSpeak (player, message); npcSetConversationResponses (player, responses); } else { utils.removeScriptVar (player, "conversation.c_ddroid_amarent.branchId"); npcEndConversationWithMessage (player, message); } return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } // ---------------------------------------------------------------------- int c_ddroid_amarent_handleBranch5 (obj_id player, obj_id npc, string_id response) { //-- [BRANCH NOTE] //-- NPC: Yes sir. Give me a moment to consult with my notes. Yes, I think that ship is here. One more moment... //-- [RESPONSE NOTE] //-- PLAYER: Come on, man! I don't have all day. if (response == "s_297") { //-- [NOTE] if (c_ddroid_amarent_condition__defaultCondition (player, npc)) { c_ddroid_amarent_action_amarentGivesInfo (player, npc); //-- NPC: Ah! Here it is. It crashed on Talus. I will transmit the location to your datapad...sir. string_id message = new string_id (c_stringFile, "s_299"); utils.removeScriptVar (player, "conversation.c_ddroid_amarent.branchId"); npcEndConversationWithMessage (player, message); return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } // ---------------------------------------------------------------------- int c_ddroid_amarent_handleBranch7 (obj_id player, obj_id npc, string_id response) { //-- [BRANCH NOTE] //-- NPC: I'm sorry, but I cannot give out that kind of information unless you are a member of the Imperial Transit Authority. //-- [RESPONSE NOTE] //-- PLAYER: Would these 1000 credits show that I'm a member of the Imperial Transit Authority? if (response == "s_305") { c_ddroid_amarent_action_bribeAmarent (player, npc); //-- [NOTE] if (c_ddroid_amarent_condition__defaultCondition (player, npc)) { c_ddroid_amarent_action_amarentGivesInfo (player, npc); //-- NPC: I suppose it is only helping out a concerned citizen. The ship that you are looking for crashed on Talus. I can copy the location to your datapad. string_id message = new string_id (c_stringFile, "s_307"); utils.removeScriptVar (player, "conversation.c_ddroid_amarent.branchId"); npcEndConversationWithMessage (player, message); return SCRIPT_CONTINUE; } } //-- [RESPONSE NOTE] //-- PLAYER: Is there anything I can do to change your mind? if (response == "s_25") { //-- [NOTE] if (c_ddroid_amarent_condition__defaultCondition (player, npc)) { //-- NPC: Well, I might be willing to overlook your shortcomings if I had ample reason. 1000 reasons, to be exact. Talk to me when you have the means to pay me...erm, I mean when you're able to convince me I have reason to help you. string_id message = new string_id (c_stringFile, "s_26"); utils.removeScriptVar (player, "conversation.c_ddroid_amarent.branchId"); npcEndConversationWithMessage (player, message); return SCRIPT_CONTINUE; } } //-- [RESPONSE NOTE] //-- PLAYER: Is your life really worth a silly rule like that? if (response == "s_309") { c_ddroid_amarent_action_intimidateAmarent (player, npc); //-- [NOTE] if (c_ddroid_amarent_condition__defaultCondition (player, npc)) { c_ddroid_amarent_action_amarentGivesInfo (player, npc); //-- NPC: Erm...no need for any weapons, I assure you! The ship crashed on Talus. If you don't hurt me, I'll copy the location to your datapad. string_id message = new string_id (c_stringFile, "s_311"); utils.removeScriptVar (player, "conversation.c_ddroid_amarent.branchId"); npcEndConversationWithMessage (player, message); return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } // ---------------------------------------------------------------------- int c_ddroid_amarent_handleBranch12 (obj_id player, obj_id npc, string_id response) { //-- [BRANCH NOTE] //-- NPC: Do you need more help? //-- [RESPONSE NOTE] //-- PLAYER: I need to know where the crash is again. if (response == "s_316") { //-- [NOTE] if (c_ddroid_amarent_condition__defaultCondition (player, npc)) { //-- NPC: All right. I'll copy it into your datapad. string_id message = new string_id (c_stringFile, "s_317"); utils.removeScriptVar (player, "conversation.c_ddroid_amarent.branchId"); npcEndConversationWithMessage (player, message); return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } // ---------------------------------------------------------------------- // ====================================================================== // User Script Triggers // ====================================================================== trigger OnInitialize () { if ((!isMob (self)) || (isPlayer (self))) detachScript(self, "conversation.c_ddroid_amarent"); setCondition (self, CONDITION_CONVERSABLE); setInvulnerable (self, true); setName (self, "Amarent Loren"); return SCRIPT_CONTINUE; } trigger OnAttach () { setCondition (self, CONDITION_CONVERSABLE); setInvulnerable (self, true); setName (self, "Amarent Loren"); 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.c_ddroid_amarent"); 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 (c_ddroid_amarent_condition_playeronquest (player, npc)) { c_ddroid_amarent_action_faceplayer (player, npc); //-- NPC: I'm sorry, but I'm really busy. What do you need? string_id message = new string_id (c_stringFile, "s_279"); int numberOfResponses = 0; boolean hasResponse = false; //-- PLAYER: Selan Ellison sent me. boolean hasResponse0 = false; if (c_ddroid_amarent_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_281"); utils.setScriptVar (player, "conversation.c_ddroid_amarent.branchId", 1); npcStartConversation (player, npc, "c_ddroid_amarent", message, responses); } else { chat.chat (npc, player, message); } return SCRIPT_CONTINUE; } //-- [NOTE] if (!c_ddroid_amarent_condition_playeronquest (player, npc)) { c_ddroid_amarent_action_faceplayer (player, npc); //-- NPC: I'm very busy. I'm sorry I can't talk to you right now. string_id message = new string_id (c_stringFile, "s_313"); chat.chat (npc, player, message); return SCRIPT_CONTINUE; } //-- [NOTE] if (c_ddroid_amarent_condition_playerlostwaypoint (player, npc)) { c_ddroid_amarent_action_faceplayer (player, npc); //-- NPC: Do you need more help? string_id message = new string_id (c_stringFile, "s_315"); int numberOfResponses = 0; boolean hasResponse = false; //-- PLAYER: I need to know where the crash is again. boolean hasResponse0 = false; if (c_ddroid_amarent_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_316"); utils.setScriptVar (player, "conversation.c_ddroid_amarent.branchId", 12); npcStartConversation (player, npc, "c_ddroid_amarent", message, responses); } else { chat.chat (npc, player, message); } return SCRIPT_CONTINUE; } //-- [NOTE] if (c_ddroid_amarent_condition_queststuck (player, npc)) { //-- NPC: Looks like you found the crash. I got a message from Valance Serth that he needs you again, if you would go out there. string_id message = new string_id (c_stringFile, "s_28"); 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 != "c_ddroid_amarent") return SCRIPT_CONTINUE; obj_id npc = self; int branchId = utils.getIntScriptVar (player, "conversation.c_ddroid_amarent.branchId"); if (branchId == 1 && c_ddroid_amarent_handleBranch1 (player, npc, response) == SCRIPT_CONTINUE) return SCRIPT_CONTINUE; if (branchId == 2 && c_ddroid_amarent_handleBranch2 (player, npc, response) == SCRIPT_CONTINUE) return SCRIPT_CONTINUE; if (branchId == 3 && c_ddroid_amarent_handleBranch3 (player, npc, response) == SCRIPT_CONTINUE) return SCRIPT_CONTINUE; if (branchId == 5 && c_ddroid_amarent_handleBranch5 (player, npc, response) == SCRIPT_CONTINUE) return SCRIPT_CONTINUE; if (branchId == 7 && c_ddroid_amarent_handleBranch7 (player, npc, response) == SCRIPT_CONTINUE) return SCRIPT_CONTINUE; if (branchId == 12 && c_ddroid_amarent_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.c_ddroid_amarent.branchId"); return SCRIPT_CONTINUE; } // ======================================================================