// ====================================================================== // // echo_base_launch.script // // // // Created with SwgConversationEditor 1.37 - DO NOT EDIT THIS AUTO-GENERATED FILE! // // ====================================================================== // ====================================================================== // Library Includes // ====================================================================== include library.ai_lib; include library.buff; include library.chat; include library.conversation; include library.factions; include library.group; include library.instance; include library.township; include library.utils; // ====================================================================== // Script Constants // ====================================================================== string c_stringFile = "conversation/echo_base_launch"; // ====================================================================== // Script Conditions // ====================================================================== boolean echo_base_launch_condition__defaultCondition (obj_id player, obj_id npc) { return true; } // ---------------------------------------------------------------------- boolean echo_base_launch_condition_bothRebel (obj_id player, obj_id npc) { return ( factions.isRebel(npc) && factions.isRebel(player) ); } // ---------------------------------------------------------------------- boolean echo_base_launch_condition_bothImperial (obj_id player, obj_id npc) { return ( factions.isImperial(npc) && factions.isImperial(player) ); } // ---------------------------------------------------------------------- boolean echo_base_launch_condition_npcRebelPlayerImperial (obj_id player, obj_id npc) { return ( factions.isRebel(npc) && factions.isImperial(player) ); } // ---------------------------------------------------------------------- boolean echo_base_launch_condition_npcImperialPlayerRebel (obj_id player, obj_id npc) { return ( factions.isImperial(npc) && factions.isRebel(player) ); } // ---------------------------------------------------------------------- boolean echo_base_launch_condition_disableRebel (obj_id player, obj_id npc) { return false; // return !isGod(player) && !hasObjVar(player, "testingHoth"); } // ---------------------------------------------------------------------- boolean echo_base_launch_condition_disableImperial (obj_id player, obj_id npc) { return false; // return !isGod(player) && !hasObjVar(player, "testingHoth"); } // ---------------------------------------------------------------------- boolean echo_base_launch_condition_Rebel_awaitingInstance (obj_id player, obj_id npc) { return buff.hasBuff(player, "instance_launching") && factions.isRebel(npc) && factions.isRebel(player); } // ---------------------------------------------------------------------- boolean echo_base_launch_condition_Imperial_awaitingInstance (obj_id player, obj_id npc) { return buff.hasBuff(player, "instance_launching") && factions.isImperial(npc) && factions.isImperial(player); } // ---------------------------------------------------------------------- boolean echo_base_launch_condition_tooSmallGroup (obj_id player, obj_id npc) { if ( isGod(player) || hasObjVar(player, "testingHoth") ) { return false; } if ( group.isGrouped(player) ) { obj_id groupObj = getGroupObject(player); if ( isIdValid(groupObj) ) { int numGroupMembers = getGroupSize(groupObj); if ( numGroupMembers >= 4 ) { obj_id[] groupies = getGroupMemberIds(groupObj); if ( groupies != null && groupies.length > 0 ) { int playerCount = 0; for( int i = 0; i < groupies.length; i++ ) { if ( isPlayer(groupies[i]) ) { playerCount = playerCount + 1; } } if ( playerCount >= 4 ) { return false; } } } } } return true; } // ---------------------------------------------------------------------- boolean echo_base_launch_condition_isNotCorrectLevel (obj_id player, obj_id npc) { return getLevel(player) < township.MIN_LEVEL; } // ====================================================================== // Script Actions // ====================================================================== void echo_base_launch_action_launchRebel (obj_id player, obj_id npc) { // sendSystemMessage(player, "Launching Rebel Battle of Hoth...", ""); if ( !instance.isFlaggedForInstance(player, "echo_base") ) { instance.flagPlayerForInstance(player, "echo_base"); } boolean sentToHoth = instance.requestInstanceMovement(player, "echo_base", 1, "rebel"); if ( sentToHoth ) { buff.applyBuff(player, "instance_launching"); } } // ---------------------------------------------------------------------- void echo_base_launch_action_launchImperial (obj_id player, obj_id npc) { // sendSystemMessage(player, "Launching Imperial Battle of Hoth...", ""); if ( !instance.isFlaggedForInstance(player, "echo_base") ) { instance.flagPlayerForInstance(player, "echo_base"); } boolean sentToHoth = instance.requestInstanceMovement(player, "echo_base", 2, "imperial"); if ( sentToHoth ) { buff.applyBuff(player, "instance_launching"); } } // ---------------------------------------------------------------------- void echo_base_launch_action_showEchoBaseVendorSui (obj_id player, obj_id npc) { dictionary d = new dictionary(); d.put("player", player); messageTo(npc, "showInventorySUI", d, 0, false); return; } // ====================================================================== // Script %TO Tokens // ====================================================================== // ====================================================================== // Script %DI Tokens // ====================================================================== // ====================================================================== // Script %DF Tokens // ====================================================================== // ====================================================================== // handleBranch Functions // ====================================================================== int echo_base_launch_handleBranch4 (obj_id player, obj_id npc, string_id response) { //-- [BRANCH NOTE] //-- NPC: What can I do for you, soldier? Are you here to requisition supplies or reporting for duty? //-- [RESPONSE NOTE] //-- PLAYER: I'm reporting for duty. if (response == "s_9") { //-- [NOTE] if (echo_base_launch_condition_disableRebel (player, npc)) { //-- NPC: While that is excellent news, I have no assignments for you at this time. string_id message = new string_id (c_stringFile, "s_45"); utils.removeScriptVar (player, "conversation.echo_base_launch.branchId"); npcEndConversationWithMessage (player, message); return SCRIPT_CONTINUE; } //-- [NOTE] if (echo_base_launch_condition_tooSmallGroup (player, npc)) { //-- NPC: Ah, yes. You see, there is a small problem. This particular mission requires a combat group of at least 4...which is greater than you have in yours. If you can find more soldiers for your group, I'll be here. string_id message = new string_id (c_stringFile, "s_53"); utils.removeScriptVar (player, "conversation.echo_base_launch.branchId"); npcEndConversationWithMessage (player, message); return SCRIPT_CONTINUE; } //-- [NOTE] if (!echo_base_launch_condition_disableRebel (player, npc)) { //-- NPC: Very good soldier, though I cannot reveal too much at this juncture. I don't fully trust this place...too many unsavory elements nearby. Nevertheless, I have a top secret off-world mission of high importance for you. Are you ready? string_id message = new string_id (c_stringFile, "s_13"); int numberOfResponses = 0; boolean hasResponse = false; //-- PLAYER: I am. boolean hasResponse0 = false; if (echo_base_launch_condition__defaultCondition (player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse0 = true; } //-- PLAYER: Perhaps not. boolean hasResponse1 = false; if (echo_base_launch_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_23"); if (hasResponse1) responses [responseIndex++] = new string_id (c_stringFile, "s_25"); utils.setScriptVar (player, "conversation.echo_base_launch.branchId", 7); npcSpeak (player, message); npcSetConversationResponses (player, responses); } else { utils.removeScriptVar (player, "conversation.echo_base_launch.branchId"); npcEndConversationWithMessage (player, message); } return SCRIPT_CONTINUE; } } //-- [RESPONSE NOTE] //-- PLAYER: I would like to see what supplies you have to offer. if (response == "s_20") { //-- [NOTE] if (echo_base_launch_condition__defaultCondition (player, npc)) { echo_base_launch_action_showEchoBaseVendorSui (player, npc); //-- NPC: Of course. Let me know if you would like to requisition something. string_id message = new string_id (c_stringFile, "s_22"); utils.removeScriptVar (player, "conversation.echo_base_launch.branchId"); npcEndConversationWithMessage (player, message); return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } // ---------------------------------------------------------------------- int echo_base_launch_handleBranch7 (obj_id player, obj_id npc, string_id response) { //-- [BRANCH NOTE] //-- NPC: Very good soldier, though I cannot reveal too much at this juncture. I don't fully trust this place...too many unsavory elements nearby. Nevertheless, I have a top secret off-world mission of high importance for you. Are you ready? //-- [RESPONSE NOTE] //-- PLAYER: I am. if (response == "s_23") { //-- [NOTE] if (echo_base_launch_condition__defaultCondition (player, npc)) { doAnimationAction (npc, "salute1"); echo_base_launch_action_launchRebel (player, npc); //-- NPC: Excellent. You'll be briefed after you arrive. May the Force be with you. string_id message = new string_id (c_stringFile, "s_24"); utils.removeScriptVar (player, "conversation.echo_base_launch.branchId"); npcEndConversationWithMessage (player, message); return SCRIPT_CONTINUE; } } //-- [RESPONSE NOTE] //-- PLAYER: Perhaps not. if (response == "s_25") { //-- [NOTE] if (echo_base_launch_condition__defaultCondition (player, npc)) { doAnimationAction (npc, "shake_head_disgust"); //-- NPC: I see. If you find some courage, return to me. Our cause can use all of the able-bodied soldiers that we can muster. string_id message = new string_id (c_stringFile, "s_26"); utils.removeScriptVar (player, "conversation.echo_base_launch.branchId"); npcEndConversationWithMessage (player, message); return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } // ---------------------------------------------------------------------- int echo_base_launch_handleBranch13 (obj_id player, obj_id npc, string_id response) { //-- [BRANCH NOTE] //-- NPC: Stand at attention, soldier. You represent the Empire! Even in this forsaken place. I do not understand why we tolerate its existence. //-- [RESPONSE NOTE] //-- PLAYER: I am reporting for duty, Sir. if (response == "s_32") { //-- [NOTE] if (echo_base_launch_condition_disableImperial (player, npc)) { //-- NPC: I applaud your yearning to serve your Empire but regret to say that I have nothing available at this time. string_id message = new string_id (c_stringFile, "s_46"); utils.removeScriptVar (player, "conversation.echo_base_launch.branchId"); npcEndConversationWithMessage (player, message); return SCRIPT_CONTINUE; } //-- [NOTE] if (echo_base_launch_condition_tooSmallGroup (player, npc)) { //-- NPC: As much as I might like to do so, I cannot send you into battle without at least 3 other soldiers to accompany you. My hands are tied on this...official orders...no squads of less than 4. string_id message = new string_id (c_stringFile, "s_55"); utils.removeScriptVar (player, "conversation.echo_base_launch.branchId"); npcEndConversationWithMessage (player, message); return SCRIPT_CONTINUE; } //-- [NOTE] if (!echo_base_launch_condition_disableImperial (player, npc)) { //-- NPC: Do not call me 'Sir', cadet, I work for a living. I am sending you off-world on a critical mission. Are you ready to disembark? string_id message = new string_id (c_stringFile, "s_36"); int numberOfResponses = 0; boolean hasResponse = false; //-- PLAYER: I am, Si...er...I am. Yes. boolean hasResponse0 = false; if (echo_base_launch_condition__defaultCondition (player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse0 = true; } //-- PLAYER: Not yet. boolean hasResponse1 = false; if (echo_base_launch_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_38"); if (hasResponse1) responses [responseIndex++] = new string_id (c_stringFile, "s_42"); utils.setScriptVar (player, "conversation.echo_base_launch.branchId", 16); npcSpeak (player, message); npcSetConversationResponses (player, responses); } else { utils.removeScriptVar (player, "conversation.echo_base_launch.branchId"); npcEndConversationWithMessage (player, message); } return SCRIPT_CONTINUE; } } //-- [RESPONSE NOTE] //-- PLAYER: I would like to see what supplies you have to offer. if (response == "s_51") { //-- [NOTE] if (echo_base_launch_condition__defaultCondition (player, npc)) { echo_base_launch_action_showEchoBaseVendorSui (player, npc); //-- NPC: If you wish to requisition something, please do so. I have pressing matters to attend to. string_id message = new string_id (c_stringFile, "s_54"); utils.removeScriptVar (player, "conversation.echo_base_launch.branchId"); npcEndConversationWithMessage (player, message); return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } // ---------------------------------------------------------------------- int echo_base_launch_handleBranch16 (obj_id player, obj_id npc, string_id response) { //-- [BRANCH NOTE] //-- NPC: Do not call me 'Sir', cadet, I work for a living. I am sending you off-world on a critical mission. Are you ready to disembark? //-- [RESPONSE NOTE] //-- PLAYER: I am, Si...er...I am. Yes. if (response == "s_38") { //-- [NOTE] if (echo_base_launch_condition__defaultCondition (player, npc)) { doAnimationAction (npc, "salute2"); echo_base_launch_action_launchImperial (player, npc); //-- NPC: Good. You'll receive further orders upon arrival. Do not fail your Empire, soldier. Now go to it! Hup, hup, hup... string_id message = new string_id (c_stringFile, "s_40"); utils.removeScriptVar (player, "conversation.echo_base_launch.branchId"); npcEndConversationWithMessage (player, message); return SCRIPT_CONTINUE; } } //-- [RESPONSE NOTE] //-- PLAYER: Not yet. if (response == "s_42") { //-- [NOTE] if (echo_base_launch_condition__defaultCondition (player, npc)) { doAnimationAction (npc, "dismiss"); //-- NPC: Then why are you wasting my time, soldier? string_id message = new string_id (c_stringFile, "s_44"); utils.removeScriptVar (player, "conversation.echo_base_launch.branchId"); npcEndConversationWithMessage (player, message); return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } // ---------------------------------------------------------------------- // ====================================================================== // User Script Triggers // ====================================================================== trigger OnInitialize () { if ((!isTangible (self)) || (isPlayer (self))) detachScript(self, "conversation.echo_base_launch"); 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.echo_base_launch"); 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 (echo_base_launch_condition_isNotCorrectLevel (player, npc)) { //-- NPC: While I appreciate your enthusiasm soldier, the mission I offer requires someone with more seasoning and experience. string_id message = new string_id (c_stringFile, "s_57"); chat.chat (npc, player, message); return SCRIPT_CONTINUE; } //-- [NOTE] if (echo_base_launch_condition_Rebel_awaitingInstance (player, npc)) { //-- NPC: You'll be briefed when you arrive. Have patience, soldier. string_id message = new string_id (c_stringFile, "s_50"); chat.chat (npc, player, message); return SCRIPT_CONTINUE; } //-- [NOTE] if (echo_base_launch_condition_npcRebelPlayerImperial (player, npc)) { doAnimationAction (npc, "wave_on_dismissing"); //-- NPC: I have nothing to say to you. string_id message = new string_id (c_stringFile, "s_18"); chat.chat (npc, player, message); return SCRIPT_CONTINUE; } //-- [NOTE] if (echo_base_launch_condition_bothRebel (player, npc)) { //-- NPC: What can I do for you, soldier? Are you here to requisition supplies or reporting for duty? string_id message = new string_id (c_stringFile, "s_7"); int numberOfResponses = 0; boolean hasResponse = false; //-- PLAYER: I'm reporting for duty. boolean hasResponse0 = false; if (echo_base_launch_condition__defaultCondition (player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse0 = true; } //-- PLAYER: I would like to see what supplies you have to offer. boolean hasResponse1 = false; if (echo_base_launch_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_9"); if (hasResponse1) responses [responseIndex++] = new string_id (c_stringFile, "s_20"); utils.setScriptVar (player, "conversation.echo_base_launch.branchId", 4); npcStartConversation (player, npc, "echo_base_launch", message, responses); } else { chat.chat (npc, player, message); } return SCRIPT_CONTINUE; } //-- [NOTE] if (echo_base_launch_condition_Imperial_awaitingInstance (player, npc)) { //-- NPC: Your orders await you at your destination. I cannot say more at this time...this location is not secure. string_id message = new string_id (c_stringFile, "s_49"); chat.chat (npc, player, message); return SCRIPT_CONTINUE; } //-- [NOTE] if (echo_base_launch_condition_npcImperialPlayerRebel (player, npc)) { doAnimationAction (npc, "threaten"); //-- NPC: You're fortunate I've been ordered to tolerate your kind in this township. For now. But I'd advise you to leave. Quickly. string_id message = new string_id (c_stringFile, "s_48"); chat.chat (npc, player, message); return SCRIPT_CONTINUE; } //-- [NOTE] if (echo_base_launch_condition_bothImperial (player, npc)) { //-- NPC: Stand at attention, soldier. You represent the Empire! Even in this forsaken place. I do not understand why we tolerate its existence. string_id message = new string_id (c_stringFile, "s_30"); int numberOfResponses = 0; boolean hasResponse = false; //-- PLAYER: I am reporting for duty, Sir. boolean hasResponse0 = false; if (echo_base_launch_condition__defaultCondition (player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse0 = true; } //-- PLAYER: I would like to see what supplies you have to offer. boolean hasResponse1 = false; if (echo_base_launch_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_32"); if (hasResponse1) responses [responseIndex++] = new string_id (c_stringFile, "s_51"); utils.setScriptVar (player, "conversation.echo_base_launch.branchId", 13); npcStartConversation (player, npc, "echo_base_launch", message, responses); } else { chat.chat (npc, player, message); } return SCRIPT_CONTINUE; } //-- [NOTE] Player is Neutral. if (echo_base_launch_condition__defaultCondition (player, npc)) { doAnimationAction (npc, "wave_finger_warning"); //-- NPC: I'm here on official business, citizen. Sign up and join the War or step aside for those who do not fear to choose a side. string_id message = new string_id (c_stringFile, "s_58"); 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 != "echo_base_launch") return SCRIPT_CONTINUE; obj_id npc = self; int branchId = utils.getIntScriptVar (player, "conversation.echo_base_launch.branchId"); if (branchId == 4 && echo_base_launch_handleBranch4 (player, npc, response) == SCRIPT_CONTINUE) return SCRIPT_CONTINUE; if (branchId == 7 && echo_base_launch_handleBranch7 (player, npc, response) == SCRIPT_CONTINUE) return SCRIPT_CONTINUE; if (branchId == 13 && echo_base_launch_handleBranch13 (player, npc, response) == SCRIPT_CONTINUE) return SCRIPT_CONTINUE; if (branchId == 16 && echo_base_launch_handleBranch16 (player, npc, response) == SCRIPT_CONTINUE) return SCRIPT_CONTINUE; chat.chat (npc, "Error: Fell through all branches and responses for OnNpcConversationResponse."); utils.removeScriptVar (player, "conversation.echo_base_launch.branchId"); return SCRIPT_CONTINUE; } // ======================================================================