// ====================================================================== // // som_pei_yi.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.utils; // ====================================================================== // Script Constants // ====================================================================== string c_stringFile = "conversation/som_pei_yi"; // ====================================================================== // Script Conditions // ====================================================================== boolean som_pei_yi_condition__defaultCondition (obj_id player, obj_id npc) { return true; } // ---------------------------------------------------------------------- boolean som_pei_yi_condition_isEntertainer (obj_id player, obj_id npc) { int level = getLevel(player); return (utils.isProfession(player, utils.ENTERTAINER) && level >= 46); } // ---------------------------------------------------------------------- boolean som_pei_yi_condition_isDancer (obj_id player, obj_id npc) { return hasSkill(player, "social_dancer_novice"); } // ---------------------------------------------------------------------- boolean som_pei_yi_condition_hasDance (obj_id player, obj_id npc) { return hasCommand(player, "startDance+peiyi"); } // ====================================================================== // Script Actions // ====================================================================== void som_pei_yi_action_grantDance (obj_id player, obj_id npc) { sendSystemMessage(player, new string_id("som/som_quest", "grant_dance")); grantCommand(player, "startDance+peiyi"); } // ====================================================================== // Script %TO Tokens // ====================================================================== // ====================================================================== // Script %DI Tokens // ====================================================================== // ====================================================================== // Script %DF Tokens // ====================================================================== // ====================================================================== // handleBranch Functions // ====================================================================== int som_pei_yi_handleBranch1 (obj_id player, obj_id npc, string_id response) { //-- [BRANCH NOTE] //-- NPC: Hello! It's good to see you again! Have you shown anyone the dance I taught you? //-- [RESPONSE NOTE] //-- PLAYER: Yes, I did. if (response == "s_44") { //-- [NOTE] if (som_pei_yi_condition__defaultCondition (player, npc)) { //-- NPC: And? What did they think? string_id message = new string_id (c_stringFile, "s_47"); int numberOfResponses = 0; boolean hasResponse = false; //-- PLAYER: They liked it. boolean hasResponse0 = false; if (som_pei_yi_condition__defaultCondition (player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse0 = true; } //-- PLAYER: They did not like it. boolean hasResponse1 = false; if (som_pei_yi_condition__defaultCondition (player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse1 = true; } //-- PLAYER: Oh, sorry. I've got to go. boolean hasResponse2 = false; if (som_pei_yi_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_48"); if (hasResponse1) responses [responseIndex++] = new string_id (c_stringFile, "s_49"); if (hasResponse2) responses [responseIndex++] = new string_id (c_stringFile, "s_50"); utils.setScriptVar (player, "conversation.som_pei_yi.branchId", 2); npcSpeak (player, message); npcSetConversationResponses (player, responses); } else { utils.removeScriptVar (player, "conversation.som_pei_yi.branchId"); npcEndConversationWithMessage (player, message); } return SCRIPT_CONTINUE; } } //-- [RESPONSE NOTE] //-- PLAYER: No, not yet. if (response == "s_45") { //-- [NOTE] if (som_pei_yi_condition__defaultCondition (player, npc)) { //-- NPC: When you do, be sure to tell me what they think of it. string_id message = new string_id (c_stringFile, "s_46"); utils.removeScriptVar (player, "conversation.som_pei_yi.branchId"); npcEndConversationWithMessage (player, message); return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } // ---------------------------------------------------------------------- int som_pei_yi_handleBranch2 (obj_id player, obj_id npc, string_id response) { //-- [BRANCH NOTE] //-- NPC: And? What did they think? //-- [RESPONSE NOTE] //-- PLAYER: They liked it. if (response == "s_48") { //-- [NOTE] if (som_pei_yi_condition__defaultCondition (player, npc)) { //-- NPC: Oh, I'm glad to hear it! Thank you so much for telling me. string_id message = new string_id (c_stringFile, "s_53"); utils.removeScriptVar (player, "conversation.som_pei_yi.branchId"); npcEndConversationWithMessage (player, message); return SCRIPT_CONTINUE; } } //-- [RESPONSE NOTE] //-- PLAYER: They did not like it. if (response == "s_49") { //-- [NOTE] if (som_pei_yi_condition__defaultCondition (player, npc)) { //-- NPC: Oh, that's too bad. I tried so hard to come up with something everyone would like. Thank you for being honest though. string_id message = new string_id (c_stringFile, "s_52"); utils.removeScriptVar (player, "conversation.som_pei_yi.branchId"); npcEndConversationWithMessage (player, message); return SCRIPT_CONTINUE; } } //-- [RESPONSE NOTE] //-- PLAYER: Oh, sorry. I've got to go. if (response == "s_50") { //-- [NOTE] if (som_pei_yi_condition__defaultCondition (player, npc)) { //-- NPC: Oh, alright. Good bye. string_id message = new string_id (c_stringFile, "s_51"); utils.removeScriptVar (player, "conversation.som_pei_yi.branchId"); npcEndConversationWithMessage (player, message); return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } // ---------------------------------------------------------------------- int som_pei_yi_handleBranch7 (obj_id player, obj_id npc, string_id response) { //-- [BRANCH NOTE] //-- NPC: Hello, it's nice to see a friendly face on such a violent planet. //-- [RESPONSE NOTE] //-- PLAYER: You don't look much like a miner. if (response == "s_17") { //-- [NOTE] if (som_pei_yi_condition__defaultCondition (player, npc)) { //-- NPC: Oh no? I wouldn't imagine so. I don't know the first thing about mining. My area of expertise is dancing, actually. string_id message = new string_id (c_stringFile, "s_19"); int numberOfResponses = 0; boolean hasResponse = false; //-- PLAYER: You're a dancer? boolean hasResponse0 = false; if (som_pei_yi_condition__defaultCondition (player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse0 = true; } //-- PLAYER: Probably not. Good bye. boolean hasResponse1 = false; if (som_pei_yi_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_21"); if (hasResponse1) responses [responseIndex++] = new string_id (c_stringFile, "s_25"); utils.setScriptVar (player, "conversation.som_pei_yi.branchId", 8); npcSpeak (player, message); npcSetConversationResponses (player, responses); } else { utils.removeScriptVar (player, "conversation.som_pei_yi.branchId"); npcEndConversationWithMessage (player, message); } return SCRIPT_CONTINUE; } } //-- [RESPONSE NOTE] //-- PLAYER: Who are you? if (response == "s_29") { //-- [NOTE] if (som_pei_yi_condition__defaultCondition (player, npc)) { //-- NPC: My name is Pei Yi. I'm a dancer in a small dance troupe that you've probably never heard of. string_id message = new string_id (c_stringFile, "s_31"); int numberOfResponses = 0; boolean hasResponse = false; //-- PLAYER: What brings you here? boolean hasResponse0 = false; if (som_pei_yi_condition__defaultCondition (player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse0 = true; } //-- PLAYER: Probably not. Good bye. boolean hasResponse1 = false; if (som_pei_yi_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_33"); if (hasResponse1) responses [responseIndex++] = new string_id (c_stringFile, "s_82"); utils.setScriptVar (player, "conversation.som_pei_yi.branchId", 11); npcSpeak (player, message); npcSetConversationResponses (player, responses); } else { utils.removeScriptVar (player, "conversation.som_pei_yi.branchId"); npcEndConversationWithMessage (player, message); } return SCRIPT_CONTINUE; } } //-- [RESPONSE NOTE] //-- PLAYER: It's nice to meet you. Good bye. if (response == "s_86") { //-- [NOTE] if (som_pei_yi_condition__defaultCondition (player, npc)) { //-- NPC: Good bye. string_id message = new string_id (c_stringFile, "s_88"); utils.removeScriptVar (player, "conversation.som_pei_yi.branchId"); npcEndConversationWithMessage (player, message); return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } // ---------------------------------------------------------------------- int som_pei_yi_handleBranch8 (obj_id player, obj_id npc, string_id response) { //-- [BRANCH NOTE] //-- NPC: Oh no? I wouldn't imagine so. I don't know the first thing about mining. My area of expertise is dancing, actually. //-- [RESPONSE NOTE] //-- PLAYER: You're a dancer? if (response == "s_21") { //-- [NOTE] if (som_pei_yi_condition__defaultCondition (player, npc)) { //-- NPC: That's right. My name is Pei Yi. I dance for a small troupe that you've probably never heard of. string_id message = new string_id (c_stringFile, "s_23"); int numberOfResponses = 0; boolean hasResponse = false; //-- PLAYER: What brings you here? boolean hasResponse0 = false; if (som_pei_yi_condition__defaultCondition (player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse0 = true; } //-- PLAYER: Probably not. Good bye. boolean hasResponse1 = false; if (som_pei_yi_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_33"); if (hasResponse1) responses [responseIndex++] = new string_id (c_stringFile, "s_82"); utils.setScriptVar (player, "conversation.som_pei_yi.branchId", 11); npcSpeak (player, message); npcSetConversationResponses (player, responses); } else { utils.removeScriptVar (player, "conversation.som_pei_yi.branchId"); npcEndConversationWithMessage (player, message); } return SCRIPT_CONTINUE; } } //-- [RESPONSE NOTE] //-- PLAYER: Probably not. Good bye. if (response == "s_25") { //-- [NOTE] if (som_pei_yi_condition__defaultCondition (player, npc)) { //-- NPC: Good bye. string_id message = new string_id (c_stringFile, "s_27"); utils.removeScriptVar (player, "conversation.som_pei_yi.branchId"); npcEndConversationWithMessage (player, message); return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } // ---------------------------------------------------------------------- int som_pei_yi_handleBranch9 (obj_id player, obj_id npc, string_id response) { //-- [BRANCH NOTE] //-- NPC: That's right. My name is Pei Yi. I dance for a small troupe that you've probably never heard of. //-- [RESPONSE NOTE] //-- PLAYER: What brings you here? if (response == "s_33") { //-- [NOTE] if (som_pei_yi_condition__defaultCondition (player, npc)) { //-- NPC: I was to meet up with the rest of my troupe on Naboo for a very prestigious show. I bought passage on Captain Stahn's ship, but the engine fell apart or something and we were forced to make a detour here for supplies and repairs. string_id message = new string_id (c_stringFile, "s_35"); int numberOfResponses = 0; boolean hasResponse = false; //-- PLAYER: How long will the repairs take? boolean hasResponse0 = false; if (som_pei_yi_condition__defaultCondition (player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse0 = true; } //-- PLAYER: That's too bad. Good bye. boolean hasResponse1 = false; if (som_pei_yi_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_37"); if (hasResponse1) responses [responseIndex++] = new string_id (c_stringFile, "s_78"); utils.setScriptVar (player, "conversation.som_pei_yi.branchId", 12); npcSpeak (player, message); npcSetConversationResponses (player, responses); } else { utils.removeScriptVar (player, "conversation.som_pei_yi.branchId"); npcEndConversationWithMessage (player, message); } return SCRIPT_CONTINUE; } } //-- [RESPONSE NOTE] //-- PLAYER: Probably not. Good bye. if (response == "s_82") { //-- [NOTE] if (som_pei_yi_condition__defaultCondition (player, npc)) { //-- NPC: Good bye. string_id message = new string_id (c_stringFile, "s_84"); utils.removeScriptVar (player, "conversation.som_pei_yi.branchId"); npcEndConversationWithMessage (player, message); return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } // ---------------------------------------------------------------------- int som_pei_yi_handleBranch11 (obj_id player, obj_id npc, string_id response) { //-- [BRANCH NOTE] //-- NPC: My name is Pei Yi. I'm a dancer in a small dance troupe that you've probably never heard of. //-- [RESPONSE NOTE] //-- PLAYER: What brings you here? if (response == "s_33") { //-- [NOTE] if (som_pei_yi_condition__defaultCondition (player, npc)) { //-- NPC: I was to meet up with the rest of my troupe on Naboo for a very prestigious show. I bought passage on Captain Stahn's ship, but the engine fell apart or something and we were forced to make a detour here for supplies and repairs. string_id message = new string_id (c_stringFile, "s_35"); int numberOfResponses = 0; boolean hasResponse = false; //-- PLAYER: How long will the repairs take? boolean hasResponse0 = false; if (som_pei_yi_condition__defaultCondition (player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse0 = true; } //-- PLAYER: That's too bad. Good bye. boolean hasResponse1 = false; if (som_pei_yi_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_37"); if (hasResponse1) responses [responseIndex++] = new string_id (c_stringFile, "s_78"); utils.setScriptVar (player, "conversation.som_pei_yi.branchId", 12); npcSpeak (player, message); npcSetConversationResponses (player, responses); } else { utils.removeScriptVar (player, "conversation.som_pei_yi.branchId"); npcEndConversationWithMessage (player, message); } return SCRIPT_CONTINUE; } } //-- [RESPONSE NOTE] //-- PLAYER: Probably not. Good bye. if (response == "s_82") { //-- [NOTE] if (som_pei_yi_condition__defaultCondition (player, npc)) { //-- NPC: Good bye. string_id message = new string_id (c_stringFile, "s_84"); utils.removeScriptVar (player, "conversation.som_pei_yi.branchId"); npcEndConversationWithMessage (player, message); return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } // ---------------------------------------------------------------------- int som_pei_yi_handleBranch12 (obj_id player, obj_id npc, string_id response) { //-- [BRANCH NOTE] //-- NPC: I was to meet up with the rest of my troupe on Naboo for a very prestigious show. I bought passage on Captain Stahn's ship, but the engine fell apart or something and we were forced to make a detour here for supplies and repairs. //-- [RESPONSE NOTE] //-- PLAYER: How long will the repairs take? if (response == "s_37") { //-- [NOTE] if (som_pei_yi_condition__defaultCondition (player, npc)) { //-- NPC: It seems like we've been here ages already, and Captain Stahn still doesn't have a good idea when the ship will be ready. I should be grateful, I suppose. We might not have even made it here at all. string_id message = new string_id (c_stringFile, "s_39"); int numberOfResponses = 0; boolean hasResponse = false; //-- PLAYER: Are you going to miss your performance on Naboo? boolean hasResponse0 = false; if (som_pei_yi_condition__defaultCondition (player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse0 = true; } //-- PLAYER: That's true. Good bye. boolean hasResponse1 = false; if (som_pei_yi_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_41"); if (hasResponse1) responses [responseIndex++] = new string_id (c_stringFile, "s_74"); utils.setScriptVar (player, "conversation.som_pei_yi.branchId", 13); npcSpeak (player, message); npcSetConversationResponses (player, responses); } else { utils.removeScriptVar (player, "conversation.som_pei_yi.branchId"); npcEndConversationWithMessage (player, message); } return SCRIPT_CONTINUE; } } //-- [RESPONSE NOTE] //-- PLAYER: That's too bad. Good bye. if (response == "s_78") { //-- [NOTE] if (som_pei_yi_condition__defaultCondition (player, npc)) { //-- NPC: Good bye. string_id message = new string_id (c_stringFile, "s_80"); utils.removeScriptVar (player, "conversation.som_pei_yi.branchId"); npcEndConversationWithMessage (player, message); return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } // ---------------------------------------------------------------------- int som_pei_yi_handleBranch13 (obj_id player, obj_id npc, string_id response) { //-- [BRANCH NOTE] //-- NPC: It seems like we've been here ages already, and Captain Stahn still doesn't have a good idea when the ship will be ready. I should be grateful, I suppose. We might not have even made it here at all. //-- [RESPONSE NOTE] //-- PLAYER: Are you going to miss your performance on Naboo? if (response == "s_41") { //-- [NOTE] if (som_pei_yi_condition__defaultCondition (player, npc)) { //-- NPC: I'm afraid so. Even if we left right now, I don't see any way that I could make it there in time. It's a shame, too. I designed a new dance especially for this performance. But...the show must go on. string_id message = new string_id (c_stringFile, "s_54"); int numberOfResponses = 0; boolean hasResponse = false; //-- PLAYER: I'm sorry to hear that. I'm a dancer myself. boolean hasResponse0 = false; if (som_pei_yi_condition_isEntertainer (player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse0 = true; } //-- PLAYER: That's too bad. Good bye. boolean hasResponse1 = false; if (som_pei_yi_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_56"); if (hasResponse1) responses [responseIndex++] = new string_id (c_stringFile, "s_70"); utils.setScriptVar (player, "conversation.som_pei_yi.branchId", 14); npcSpeak (player, message); npcSetConversationResponses (player, responses); } else { utils.removeScriptVar (player, "conversation.som_pei_yi.branchId"); npcEndConversationWithMessage (player, message); } return SCRIPT_CONTINUE; } } //-- [RESPONSE NOTE] //-- PLAYER: That's true. Good bye. if (response == "s_74") { //-- [NOTE] if (som_pei_yi_condition__defaultCondition (player, npc)) { //-- NPC: Good bye. string_id message = new string_id (c_stringFile, "s_76"); utils.removeScriptVar (player, "conversation.som_pei_yi.branchId"); npcEndConversationWithMessage (player, message); return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } // ---------------------------------------------------------------------- int som_pei_yi_handleBranch14 (obj_id player, obj_id npc, string_id response) { //-- [BRANCH NOTE] //-- NPC: I'm afraid so. Even if we left right now, I don't see any way that I could make it there in time. It's a shame, too. I designed a new dance especially for this performance. But...the show must go on. //-- [RESPONSE NOTE] //-- PLAYER: I'm sorry to hear that. I'm a dancer myself. if (response == "s_56") { //-- [NOTE] if (som_pei_yi_condition__defaultCondition (player, npc)) { //-- NPC: Oh, really? Then you understand my disappointment. It really was a very impressive dance. Say...if you have a moment, perhaps I could teach it to you! If you show it to your friends, maybe you could tell me if they like it or not. string_id message = new string_id (c_stringFile, "s_58"); int numberOfResponses = 0; boolean hasResponse = false; //-- PLAYER: That would be great! Thank you! boolean hasResponse0 = false; if (som_pei_yi_condition__defaultCondition (player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse0 = true; } //-- PLAYER: Maybe another time. Good bye. boolean hasResponse1 = false; if (som_pei_yi_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_60"); if (hasResponse1) responses [responseIndex++] = new string_id (c_stringFile, "s_66"); utils.setScriptVar (player, "conversation.som_pei_yi.branchId", 15); npcSpeak (player, message); npcSetConversationResponses (player, responses); } else { utils.removeScriptVar (player, "conversation.som_pei_yi.branchId"); npcEndConversationWithMessage (player, message); } return SCRIPT_CONTINUE; } } //-- [RESPONSE NOTE] //-- PLAYER: That's too bad. Good bye. if (response == "s_70") { //-- [NOTE] if (som_pei_yi_condition__defaultCondition (player, npc)) { //-- NPC: Good bye. string_id message = new string_id (c_stringFile, "s_72"); utils.removeScriptVar (player, "conversation.som_pei_yi.branchId"); npcEndConversationWithMessage (player, message); return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } // ---------------------------------------------------------------------- int som_pei_yi_handleBranch15 (obj_id player, obj_id npc, string_id response) { //-- [BRANCH NOTE] //-- NPC: Oh, really? Then you understand my disappointment. It really was a very impressive dance. Say...if you have a moment, perhaps I could teach it to you! If you show it to your friends, maybe you could tell me if they like it or not. //-- [RESPONSE NOTE] //-- PLAYER: That would be great! Thank you! if (response == "s_60") { //-- [NOTE] if (som_pei_yi_condition_isEntertainer (player, npc)) { som_pei_yi_action_grantDance (player, npc); //-- NPC: Then let the lessons commence! And be sure to tell me what your friends think after you show them! string_id message = new string_id (c_stringFile, "s_62"); utils.removeScriptVar (player, "conversation.som_pei_yi.branchId"); npcEndConversationWithMessage (player, message); return SCRIPT_CONTINUE; } //-- [NOTE] if (som_pei_yi_condition__defaultCondition (player, npc)) { //-- NPC: Hmm... I can tell that you're eager to learn, but you're just not skilled enough yet. It's a pretty complex routine. I should have warned you. Perhaps if you came back after getting a little more practice. string_id message = new string_id (c_stringFile, "s_64"); utils.removeScriptVar (player, "conversation.som_pei_yi.branchId"); npcEndConversationWithMessage (player, message); return SCRIPT_CONTINUE; } } //-- [RESPONSE NOTE] //-- PLAYER: Maybe another time. Good bye. if (response == "s_66") { //-- [NOTE] if (som_pei_yi_condition__defaultCondition (player, npc)) { //-- NPC: Good bye. string_id message = new string_id (c_stringFile, "s_68"); utils.removeScriptVar (player, "conversation.som_pei_yi.branchId"); npcEndConversationWithMessage (player, message); return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } // ---------------------------------------------------------------------- // ====================================================================== // User Script Triggers // ====================================================================== trigger OnInitialize () { if ((!isMob (self)) || (isPlayer (self))) detachScript(self, "conversation.som_pei_yi"); 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.som_pei_yi"); 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 (som_pei_yi_condition_hasDance (player, npc)) { //-- NPC: Hello! It's good to see you again! Have you shown anyone the dance I taught you? string_id message = new string_id (c_stringFile, "s_42"); int numberOfResponses = 0; boolean hasResponse = false; //-- PLAYER: Yes, I did. boolean hasResponse0 = false; if (som_pei_yi_condition__defaultCondition (player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse0 = true; } //-- PLAYER: No, not yet. boolean hasResponse1 = false; if (som_pei_yi_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_44"); if (hasResponse1) responses [responseIndex++] = new string_id (c_stringFile, "s_45"); utils.setScriptVar (player, "conversation.som_pei_yi.branchId", 1); npcStartConversation (player, npc, "som_pei_yi", message, responses); } else { chat.chat (npc, player, message); } return SCRIPT_CONTINUE; } //-- [NOTE] if (som_pei_yi_condition__defaultCondition (player, npc)) { //-- NPC: Hello, it's nice to see a friendly face on such a violent planet. string_id message = new string_id (c_stringFile, "s_15"); int numberOfResponses = 0; boolean hasResponse = false; //-- PLAYER: You don't look much like a miner. boolean hasResponse0 = false; if (som_pei_yi_condition__defaultCondition (player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse0 = true; } //-- PLAYER: Who are you? boolean hasResponse1 = false; if (som_pei_yi_condition__defaultCondition (player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse1 = true; } //-- PLAYER: It's nice to meet you. Good bye. boolean hasResponse2 = false; if (som_pei_yi_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_17"); if (hasResponse1) responses [responseIndex++] = new string_id (c_stringFile, "s_29"); if (hasResponse2) responses [responseIndex++] = new string_id (c_stringFile, "s_86"); utils.setScriptVar (player, "conversation.som_pei_yi.branchId", 7); npcStartConversation (player, npc, "som_pei_yi", 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 != "som_pei_yi") return SCRIPT_CONTINUE; obj_id npc = self; int branchId = utils.getIntScriptVar (player, "conversation.som_pei_yi.branchId"); if (branchId == 1 && som_pei_yi_handleBranch1 (player, npc, response) == SCRIPT_CONTINUE) return SCRIPT_CONTINUE; if (branchId == 2 && som_pei_yi_handleBranch2 (player, npc, response) == SCRIPT_CONTINUE) return SCRIPT_CONTINUE; if (branchId == 7 && som_pei_yi_handleBranch7 (player, npc, response) == SCRIPT_CONTINUE) return SCRIPT_CONTINUE; if (branchId == 8 && som_pei_yi_handleBranch8 (player, npc, response) == SCRIPT_CONTINUE) return SCRIPT_CONTINUE; if (branchId == 9 && som_pei_yi_handleBranch9 (player, npc, response) == SCRIPT_CONTINUE) return SCRIPT_CONTINUE; if (branchId == 11 && som_pei_yi_handleBranch11 (player, npc, response) == SCRIPT_CONTINUE) return SCRIPT_CONTINUE; if (branchId == 12 && som_pei_yi_handleBranch12 (player, npc, response) == SCRIPT_CONTINUE) return SCRIPT_CONTINUE; if (branchId == 13 && som_pei_yi_handleBranch13 (player, npc, response) == SCRIPT_CONTINUE) return SCRIPT_CONTINUE; if (branchId == 14 && som_pei_yi_handleBranch14 (player, npc, response) == SCRIPT_CONTINUE) return SCRIPT_CONTINUE; if (branchId == 15 && som_pei_yi_handleBranch15 (player, npc, response) == SCRIPT_CONTINUE) return SCRIPT_CONTINUE; chat.chat (npc, "Error: Fell through all branches and responses for OnNpcConversationResponse."); utils.removeScriptVar (player, "conversation.som_pei_yi.branchId"); return SCRIPT_CONTINUE; } // ======================================================================