// ====================================================================== // // imperial_master_trooper.script // Copyright 2004, Sony Online Entertainment // All Rights Reserved. // // Created with SwgConversationEditor 1.28 - DO NOT EDIT THIS AUTO-GENERATED FILE! // // ====================================================================== // ====================================================================== // Library Includes // ====================================================================== include library.ai_lib; include library.chat; include library.features; include library.skill; include library.space_quest; include library.space_skill; include library.utils; // ====================================================================== // Script Constants // ====================================================================== string c_stringFile = "conversation/imperial_master_trooper"; // ====================================================================== // Script Conditions // ====================================================================== boolean imperial_master_trooper_condition__defaultCondition (obj_id player, obj_id npc) { return true; } // ---------------------------------------------------------------------- boolean imperial_master_trooper_condition_remembersPlayer (obj_id player, obj_id npc) { return ( utils.hasScriptVar( player, "metNewbiePilot" )); } // ---------------------------------------------------------------------- boolean imperial_master_trooper_condition_isImperialPilot (obj_id player, obj_id npc) { return ( hasSkill( player, "pilot_imperial_navy_novice" )); } // ---------------------------------------------------------------------- boolean imperial_master_trooper_condition_isRebelPilot (obj_id player, obj_id npc) { return ( hasSkill( player, "pilot_rebel_navy_novice" )); } // ---------------------------------------------------------------------- boolean imperial_master_trooper_condition_isPrivateerPilot (obj_id player, obj_id npc) { return hasSkill( player, "pilot_neutral_novice" ); } // ---------------------------------------------------------------------- boolean imperial_master_trooper_condition_hasSpaceExpansion (obj_id player, obj_id npc) { return ( features.isSpaceEdition( player ) ); } // ---------------------------------------------------------------------- boolean imperial_master_trooper_condition_hasSpaceShip (obj_id player, obj_id npc) { return ( space_quest.hasShip( player ) ); } // ====================================================================== // Script Actions // ====================================================================== void imperial_master_trooper_action_rememberPlayer (obj_id player, obj_id npc) { utils.setScriptVar( player, "metNewbiePilot", true ); } // ---------------------------------------------------------------------- void imperial_master_trooper_action_grantQuestOne (obj_id player, obj_id npc) { space_quest.grantQuest ( player, "delivery", "tatooine_newbie_1"); space_quest.grantNewbieShip( player, "rebel"); } // ====================================================================== // Script %TO Tokens // ====================================================================== // ====================================================================== // Script %DI Tokens // ====================================================================== // ====================================================================== // Script %DF Tokens // ====================================================================== // ====================================================================== // handleBranch Functions // ====================================================================== int imperial_master_trooper_handleBranch3 (obj_id player, obj_id npc, string_id response) { //-- [BRANCH NOTE] Faction greeting. Player is an Imperial pilot. //-- NPC: Hold, pilot. What business do you have here? //-- [RESPONSE NOTE] //-- PLAYER: I'm here to speak to the boss here! if (response == "s_33788e9b") { //-- [NOTE] if (imperial_master_trooper_condition__defaultCondition (player, npc)) { doAnimationAction (npc, "nod_head_once"); //-- NPC: Then if you must... string_id message = new string_id (c_stringFile, "s_4cf446c4"); utils.removeScriptVar (player, "conversation.imperial_master_trooper.branchId"); chat.chat (npc, player, message); npcEndConversation (player); return SCRIPT_CONTINUE; } } //-- [RESPONSE NOTE] //-- PLAYER: None. if (response == "s_86ed2e98") { //-- [NOTE] if (imperial_master_trooper_condition__defaultCondition (player, npc)) { doAnimationAction (npc, "wave_on_dismissing"); //-- NPC: Then get out of here! string_id message = new string_id (c_stringFile, "s_a366a1ca"); utils.removeScriptVar (player, "conversation.imperial_master_trooper.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.imperial_master_trooper"); setCondition (self, CONDITION_CONVERSABLE); setInvulnerable( self, true ); setCondition( self, CONDITION_SPACE_INTERESTING ); setName (self, "Starship Pilot"); return SCRIPT_CONTINUE; } trigger OnAttach () { setCondition (self, CONDITION_CONVERSABLE); setInvulnerable( self, true ); setCondition( self, CONDITION_SPACE_INTERESTING ); setName (self, "Starship Pilot"); 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); faceTo( self, player ); return SCRIPT_CONTINUE; } trigger OnIncapacitated (obj_id killer) { clearCondition (self, CONDITION_CONVERSABLE); detachScript (self, "conversation.imperial_master_trooper"); 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] Generic Greeting. Player does not have the space expansion. if (!imperial_master_trooper_condition_hasSpaceExpansion (player, npc)) { doAnimationAction (npc, "shake_head_disgust"); doAnimationAction (player, "shrug_hands"); //-- NPC: You don't look like much of a pilot to me. string_id message = new string_id (c_stringFile, "s_28c5a74a"); chat.chat (npc, player, message); return SCRIPT_CONTINUE; } //-- [NOTE] Faction Greeting. Player is a Rebel pilot. if (imperial_master_trooper_condition_isRebelPilot (player, npc)) { //-- NPC: Rebel pilots don't belong here! string_id message = new string_id (c_stringFile, "s_326b2667"); chat.chat (npc, player, message); return SCRIPT_CONTINUE; } //-- [NOTE] Faction greeting. Player is an Imperial pilot. if (imperial_master_trooper_condition_isImperialPilot (player, npc)) { //-- NPC: Hold, pilot. What business do you have here? string_id message = new string_id (c_stringFile, "s_7e51c66"); int numberOfResponses = 0; boolean hasResponse = false; //-- PLAYER: I'm here to speak to the boss here! boolean hasResponse0 = false; if (imperial_master_trooper_condition__defaultCondition (player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse0 = true; } //-- PLAYER: None. boolean hasResponse1 = false; if (imperial_master_trooper_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_33788e9b"); if (hasResponse1) responses [responseIndex++] = new string_id (c_stringFile, "s_86ed2e98"); utils.setScriptVar (player, "conversation.imperial_master_trooper.branchId", 3); npcStartConversation (player, npc, "imperial_master_trooper", message, responses); } else { chat.chat (npc, player, message); } return SCRIPT_CONTINUE; } //-- [NOTE] Faction greeting. Player is a Privateer pilot. if (imperial_master_trooper_condition_isPrivateerPilot (player, npc)) { //-- NPC: You have no business here, smuggler. I suggest you take off! string_id message = new string_id (c_stringFile, "s_9049d3d5"); chat.chat (npc, player, message); return SCRIPT_CONTINUE; } //-- [NOTE] if (imperial_master_trooper_condition__defaultCondition (player, npc)) { //-- NPC: I have no time for you, friend. We have a war to fight! string_id message = new string_id (c_stringFile, "s_75207c3"); 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 != "imperial_master_trooper") return SCRIPT_CONTINUE; obj_id npc = self; int branchId = utils.getIntScriptVar (player, "conversation.imperial_master_trooper.branchId"); if (branchId == 3 && imperial_master_trooper_handleBranch3 (player, npc, response) == SCRIPT_CONTINUE) return SCRIPT_CONTINUE; chat.chat (npc, "Error: Fell through all branches and responses for OnNpcConversationResponse."); utils.removeScriptVar (player, "conversation.imperial_master_trooper.branchId"); return SCRIPT_CONTINUE; } // ======================================================================