// ====================================================================== // // npe_brawler_bully.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/npe_brawler_bully"; // ====================================================================== // Script Conditions // ====================================================================== boolean npe_brawler_bully_condition__defaultCondition (obj_id player, obj_id npc) { return true; } // ---------------------------------------------------------------------- boolean npe_brawler_bully_condition_isTaskActiveBully (obj_id player, obj_id npc) { return groundquests.isTaskActive(player, "npe_brawler_2", "killdude"); } // ---------------------------------------------------------------------- boolean npe_brawler_bully_condition_hasCompletedTaskBully (obj_id player, obj_id npc) { return groundquests.hasCompletedTask(player, "npe_brawler_2", "killdude"); } // ====================================================================== // Script Actions // ====================================================================== void npe_brawler_bully_action_giveSignalBully (obj_id player, obj_id npc) { groundquests.sendSignal(player, "npe_brawler1_bully_signal"); } // ---------------------------------------------------------------------- void npe_brawler_bully_action_facePlayer (obj_id player, obj_id npc) { faceTo(npc, player); } // ====================================================================== // Script %TO Tokens // ====================================================================== // ====================================================================== // Script %DI Tokens // ====================================================================== // ====================================================================== // Script %DF Tokens // ====================================================================== // ====================================================================== // handleBranch Functions // ====================================================================== int npe_brawler_bully_handleBranch2 (obj_id player, obj_id npc, string_id response) { //-- [BRANCH NOTE] //-- NPC: I saw you talking to Tiarsis. She's a hot little number, isn't she? //-- [RESPONSE NOTE] //-- PLAYER: Um, sure. She has a message for you. if (response == "s_20") { //-- [NOTE] if (npe_brawler_bully_condition__defaultCondition (player, npc)) { doAnimationAction (npc, "pose_proudly"); //-- NPC: Does she now? She just doesn't appreciate my considerable charms. string_id message = new string_id (c_stringFile, "s_22"); int numberOfResponses = 0; boolean hasResponse = false; //-- PLAYER: She's said that I can kill you if you don't leave her customers alone. boolean hasResponse0 = false; if (npe_brawler_bully_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_24"); utils.setScriptVar (player, "conversation.npe_brawler_bully.branchId", 3); npcSpeak (player, message); npcSetConversationResponses (player, responses); } else { utils.removeScriptVar (player, "conversation.npe_brawler_bully.branchId"); npcEndConversationWithMessage (player, message); } return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } // ---------------------------------------------------------------------- int npe_brawler_bully_handleBranch3 (obj_id player, obj_id npc, string_id response) { //-- [BRANCH NOTE] //-- NPC: Does she now? She just doesn't appreciate my considerable charms. //-- [RESPONSE NOTE] //-- PLAYER: She's said that I can kill you if you don't leave her customers alone. if (response == "s_24") { //-- [NOTE] if (npe_brawler_bully_condition__defaultCondition (player, npc)) { doAnimationAction (npc, "taken_aback"); npe_brawler_bully_action_giveSignalBully (player, npc); //-- NPC: Whoa there. No need to be hasty. I'll behave myself! In fact, I'll even help her out! I...overheard a group of people calling themselves the Genesis Red talk about sabotaging the lower levels of the station! string_id message = new string_id (c_stringFile, "s_26"); int numberOfResponses = 0; boolean hasResponse = false; //-- PLAYER: Thank you. boolean hasResponse0 = false; if (npe_brawler_bully_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_29"); utils.setScriptVar (player, "conversation.npe_brawler_bully.branchId", 4); npcSpeak (player, message); npcSetConversationResponses (player, responses); } else { utils.removeScriptVar (player, "conversation.npe_brawler_bully.branchId"); npcEndConversationWithMessage (player, message); } return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } // ---------------------------------------------------------------------- int npe_brawler_bully_handleBranch4 (obj_id player, obj_id npc, string_id response) { //-- [BRANCH NOTE] //-- NPC: Whoa there. No need to be hasty. I'll behave myself! In fact, I'll even help her out! I...overheard a group of people calling themselves the Genesis Red talk about sabotaging the lower levels of the station! //-- [RESPONSE NOTE] //-- PLAYER: Thank you. if (response == "s_29") { //-- [NOTE] if (npe_brawler_bully_condition__defaultCondition (player, npc)) { //-- NPC: Yeah. Anytime. string_id message = new string_id (c_stringFile, "s_30"); utils.removeScriptVar (player, "conversation.npe_brawler_bully.branchId"); npcEndConversationWithMessage (player, message); return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } // ---------------------------------------------------------------------- // ====================================================================== // User Script Triggers // ====================================================================== trigger OnInitialize () { if ((!isMob (self)) || (isPlayer (self))) detachScript(self, "conversation.npe_brawler_bully"); setCondition (self, CONDITION_CONVERSABLE); setInvulnerable( self, true ); //setCondition( self, CONDITION_INTERESTING ); setName( self, "Cantina Bully" ); return SCRIPT_CONTINUE; } trigger OnAttach () { setCondition (self, CONDITION_CONVERSABLE); setInvulnerable( self, true ); //setCondition( self, CONDITION_INTERESTING ); setName( self, "Cantina Bully" ); 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.npe_brawler_bully"); 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 (npe_brawler_bully_condition_hasCompletedTaskBully (player, npc)) { doAnimationAction (npc, "thumb_up"); npe_brawler_bully_action_facePlayer (player, npc); //-- NPC: Look, I'm behaving myself! string_id message = new string_id (c_stringFile, "s_13"); chat.chat (npc, player, message); return SCRIPT_CONTINUE; } //-- [NOTE] if (npe_brawler_bully_condition_isTaskActiveBully (player, npc)) { doAnimationAction (npc, "laugh"); npe_brawler_bully_action_facePlayer (player, npc); //-- NPC: I saw you talking to Tiarsis. She's a hot little number, isn't she? string_id message = new string_id (c_stringFile, "s_18"); int numberOfResponses = 0; boolean hasResponse = false; //-- PLAYER: Um, sure. She has a message for you. boolean hasResponse0 = false; if (npe_brawler_bully_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_20"); utils.setScriptVar (player, "conversation.npe_brawler_bully.branchId", 2); npcStartConversation (player, npc, "npe_brawler_bully", message, responses); } else { chat.chat (npc, player, message); } return SCRIPT_CONTINUE; } //-- [NOTE] if (npe_brawler_bully_condition__defaultCondition (player, npc)) { npe_brawler_bully_action_facePlayer (player, npc); //-- NPC: You look like you want to give me money for a drink. 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 != "npe_brawler_bully") return SCRIPT_CONTINUE; obj_id npc = self; int branchId = utils.getIntScriptVar (player, "conversation.npe_brawler_bully.branchId"); if (branchId == 2 && npe_brawler_bully_handleBranch2 (player, npc, response) == SCRIPT_CONTINUE) return SCRIPT_CONTINUE; if (branchId == 3 && npe_brawler_bully_handleBranch3 (player, npc, response) == SCRIPT_CONTINUE) return SCRIPT_CONTINUE; if (branchId == 4 && npe_brawler_bully_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.npe_brawler_bully.branchId"); return SCRIPT_CONTINUE; } // ======================================================================