// ====================================================================== // // barada.script // Copyright 2004, Sony Online Entertainment // All Rights Reserved. // // Created with SwgConversationEditor 1.35 - 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/barada"; // ====================================================================== // Script Conditions // ====================================================================== boolean barada_condition__defaultCondition (obj_id player, obj_id npc) { return true; } // ---------------------------------------------------------------------- boolean barada_condition_completedBarada (obj_id player, obj_id npc) { if (groundquests.hasCompletedQuest(player, "quest/jabba_barada_v2")) { return true; } return false; } // ---------------------------------------------------------------------- boolean barada_condition_completedPorcellus (obj_id player, obj_id npc) { if (groundquests.hasCompletedQuest(player, "quest/jabba_porcellus")) { return true; } return false; } // ---------------------------------------------------------------------- boolean barada_condition_findingParts (obj_id player, obj_id npc) { if (groundquests.isTaskActive(player, "quest/jabba_barada_v2", "suspiciousParts")) { return true; } return false; } // ---------------------------------------------------------------------- boolean barada_condition_killingCompetition (obj_id player, obj_id npc) { if (groundquests.isTaskActive(player, "quest/jabba_barada_v2", "PodRaceVillainy")) { return true; } return false; } // ---------------------------------------------------------------------- boolean barada_condition_readyToReturn (obj_id player, obj_id npc) { if (groundquests.isTaskActive(player, "quest/jabba_barada_v2", "readyToReturn")) { return true; } return false; } // ====================================================================== // Script Actions // ====================================================================== void barada_action_grantBaradaQuest (obj_id player, obj_id npc) { groundquests.requestGrantQuest (player, "quest/jabba_barada_v2"); } // ---------------------------------------------------------------------- void barada_action_sendBaradaDoneSignal (obj_id player, obj_id npc) { faceTo(npc, player); groundquests.sendSignal (player, "doneWithBarada"); groundquests.grantQuest(player, "pointer_bib_fortuna"); } // ---------------------------------------------------------------------- void barada_action_clearPointer (obj_id player, obj_id npc) { faceTo(npc, player); groundquests.sendSignal(player, "found_barada"); } // ---------------------------------------------------------------------- void barada_action_facePlayer (obj_id player, obj_id npc) { faceTo(npc, player); } // ====================================================================== // Script %TO Tokens // ====================================================================== // ====================================================================== // Script %DI Tokens // ====================================================================== // ====================================================================== // Script %DF Tokens // ====================================================================== // ====================================================================== // handleBranch Functions // ====================================================================== int barada_handleBranch5 (obj_id player, obj_id npc, string_id response) { //-- [BRANCH NOTE] //-- NPC: Porcellus says you're good. He told you I needed help? I do. Someone with a steady hand and steady nerves. Is that you? //-- [RESPONSE NOTE] //-- PLAYER: Yeah, that's me. if (response == "s_13") { //-- [NOTE] if (barada_condition__defaultCondition (player, npc)) { //-- NPC: Good, good. Let's get started then. Valarian's racers are cheating. There's no way they're building better vehicles than me. Find out what they're doing. string_id message = new string_id (c_stringFile, "s_15"); int numberOfResponses = 0; boolean hasResponse = false; //-- PLAYER: Isn't pod racing illegal? boolean hasResponse0 = false; if (barada_condition__defaultCondition (player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse0 = true; } //-- PLAYER: What do you need me to do? boolean hasResponse1 = false; if (barada_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_17"); if (hasResponse1) responses [responseIndex++] = new string_id (c_stringFile, "s_36"); utils.setScriptVar (player, "conversation.barada.branchId", 6); npcSpeak (player, message); npcSetConversationResponses (player, responses); } else { utils.removeScriptVar (player, "conversation.barada.branchId"); npcEndConversationWithMessage (player, message); } return SCRIPT_CONTINUE; } } //-- [RESPONSE NOTE] //-- PLAYER: No. That's not me at all. if (response == "s_40") { //-- [NOTE] if (barada_condition__defaultCondition (player, npc)) { //-- NPC: Then what are you standing around here for? It's dangerous here. I mean look at us. You might wanna find an exit. string_id message = new string_id (c_stringFile, "s_42"); utils.removeScriptVar (player, "conversation.barada.branchId"); npcEndConversationWithMessage (player, message); return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } // ---------------------------------------------------------------------- int barada_handleBranch6 (obj_id player, obj_id npc, string_id response) { //-- [BRANCH NOTE] //-- NPC: Good, good. Let's get started then. Valarian's racers are cheating. There's no way they're building better vehicles than me. Find out what they're doing. //-- [RESPONSE NOTE] //-- PLAYER: Isn't pod racing illegal? if (response == "s_17") { //-- [NOTE] if (barada_condition__defaultCondition (player, npc)) { //-- NPC: What are you, some kind of Imperial spy? Everything we do around here is illegal. Unless you really are an Imperial spy, in which case I was kidding. No, wait, Jabba's paid off the Imperials, so it doesn't matter. What were we talking about? string_id message = new string_id (c_stringFile, "s_24"); int numberOfResponses = 0; boolean hasResponse = false; //-- PLAYER: Where do you hold these pod races? boolean hasResponse0 = false; if (barada_condition__defaultCondition (player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse0 = true; } //-- PLAYER: I just need to know what to do. boolean hasResponse1 = false; if (barada_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_26"); if (hasResponse1) responses [responseIndex++] = new string_id (c_stringFile, "s_34"); utils.setScriptVar (player, "conversation.barada.branchId", 7); npcSpeak (player, message); npcSetConversationResponses (player, responses); } else { utils.removeScriptVar (player, "conversation.barada.branchId"); npcEndConversationWithMessage (player, message); } return SCRIPT_CONTINUE; } } //-- [RESPONSE NOTE] //-- PLAYER: What do you need me to do? if (response == "s_36") { //-- [NOTE] if (barada_condition__defaultCondition (player, npc)) { barada_action_grantBaradaQuest (player, npc); //-- NPC: Find some of Valarian's pod racers and see what they have. string_id message = new string_id (c_stringFile, "s_38"); utils.removeScriptVar (player, "conversation.barada.branchId"); npcEndConversationWithMessage (player, message); return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } // ---------------------------------------------------------------------- int barada_handleBranch7 (obj_id player, obj_id npc, string_id response) { //-- [BRANCH NOTE] //-- NPC: What are you, some kind of Imperial spy? Everything we do around here is illegal. Unless you really are an Imperial spy, in which case I was kidding. No, wait, Jabba's paid off the Imperials, so it doesn't matter. What were we talking about? //-- [RESPONSE NOTE] //-- PLAYER: Where do you hold these pod races? if (response == "s_26") { //-- [NOTE] if (barada_condition__defaultCondition (player, npc)) { //-- NPC: Don't concern yourself with everything at once. All you need to know is what I want you to do, and then I just need you to do it. string_id message = new string_id (c_stringFile, "s_28"); int numberOfResponses = 0; boolean hasResponse = false; //-- PLAYER: What should I do? boolean hasResponse0 = false; if (barada_condition__defaultCondition (player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse0 = true; } //-- PLAYER: I don't like this. I'm leaving. boolean hasResponse1 = false; if (barada_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_30"); if (hasResponse1) responses [responseIndex++] = new string_id (c_stringFile, "s_32"); utils.setScriptVar (player, "conversation.barada.branchId", 8); npcSpeak (player, message); npcSetConversationResponses (player, responses); } else { utils.removeScriptVar (player, "conversation.barada.branchId"); npcEndConversationWithMessage (player, message); } return SCRIPT_CONTINUE; } } //-- [RESPONSE NOTE] //-- PLAYER: I just need to know what to do. if (response == "s_34") { //-- [NOTE] if (barada_condition__defaultCondition (player, npc)) { barada_action_grantBaradaQuest (player, npc); //-- NPC: Find some of Valarian's pod racers and see what they have. string_id message = new string_id (c_stringFile, "s_38"); utils.removeScriptVar (player, "conversation.barada.branchId"); npcEndConversationWithMessage (player, message); return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } // ---------------------------------------------------------------------- int barada_handleBranch8 (obj_id player, obj_id npc, string_id response) { //-- [BRANCH NOTE] //-- NPC: Don't concern yourself with everything at once. All you need to know is what I want you to do, and then I just need you to do it. //-- [RESPONSE NOTE] //-- PLAYER: What should I do? if (response == "s_30") { //-- [NOTE] if (barada_condition__defaultCondition (player, npc)) { barada_action_grantBaradaQuest (player, npc); //-- NPC: Find some of Valarian's pod racers and see what they have. string_id message = new string_id (c_stringFile, "s_38"); utils.removeScriptVar (player, "conversation.barada.branchId"); npcEndConversationWithMessage (player, message); return SCRIPT_CONTINUE; } } //-- [RESPONSE NOTE] //-- PLAYER: I don't like this. I'm leaving. if (response == "s_32") { //-- [NOTE] if (barada_condition__defaultCondition (player, npc)) { //-- NPC: Then what are you standing around here for? It's dangerous here. I mean look at us. You might wanna find an exit. string_id message = new string_id (c_stringFile, "s_42"); utils.removeScriptVar (player, "conversation.barada.branchId"); npcEndConversationWithMessage (player, message); return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } // ---------------------------------------------------------------------- // ====================================================================== // User Script Triggers // ====================================================================== trigger OnInitialize () { if ((!isMob (self)) || (isPlayer (self))) detachScript(self, "conversation.barada"); setCondition (self, CONDITION_CONVERSABLE); setCondition (self, CONDITION_INTERESTING); return SCRIPT_CONTINUE; } trigger OnAttach () { setCondition (self, CONDITION_CONVERSABLE); setCondition (self, CONDITION_INTERESTING); 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.barada"); 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 (barada_condition_completedBarada (player, npc)) { barada_action_facePlayer (player, npc); //-- NPC: I heard through the grapevine that Lady Valarian is really mad at the loss of her pod racer champion. Well done! string_id message = new string_id (c_stringFile, "s_4"); chat.chat (npc, player, message); return SCRIPT_CONTINUE; } //-- [NOTE] if (barada_condition_readyToReturn (player, npc)) { barada_action_sendBaradaDoneSignal (player, npc); //-- NPC: This is fantastic. I'm going to give you this. It's a customization kit for your vehicle. We have hundreds of them lying around, so I don't really feel bad about giving you one. Oh, I should have kept that last part to myself, shouldn't I? Oh well. Hey, go see Bib Fortuna. He's got something to talk to you about. string_id message = new string_id (c_stringFile, "s_23"); chat.chat (npc, player, message); return SCRIPT_CONTINUE; } //-- [NOTE] if (barada_condition_killingCompetition (player, npc)) { barada_action_facePlayer (player, npc); //-- NPC: I thought I sent you out to take care of our competition. You know, 'take care'...do I have to spell it out for you? string_id message = new string_id (c_stringFile, "s_20"); chat.chat (npc, player, message); return SCRIPT_CONTINUE; } //-- [NOTE] if (barada_condition_findingParts (player, npc)) { barada_action_facePlayer (player, npc); //-- NPC: Have you found any more of those suspicious engine parts Valarian's been using? string_id message = new string_id (c_stringFile, "s_19"); chat.chat (npc, player, message); return SCRIPT_CONTINUE; } //-- [NOTE] if (barada_condition_completedPorcellus (player, npc)) { barada_action_clearPointer (player, npc); //-- NPC: Porcellus says you're good. He told you I needed help? I do. Someone with a steady hand and steady nerves. Is that you? string_id message = new string_id (c_stringFile, "s_11"); int numberOfResponses = 0; boolean hasResponse = false; //-- PLAYER: Yeah, that's me. boolean hasResponse0 = false; if (barada_condition__defaultCondition (player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse0 = true; } //-- PLAYER: No. That's not me at all. boolean hasResponse1 = false; if (barada_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_13"); if (hasResponse1) responses [responseIndex++] = new string_id (c_stringFile, "s_40"); utils.setScriptVar (player, "conversation.barada.branchId", 5); npcStartConversation (player, npc, "barada", message, responses); } else { chat.chat (npc, player, message); } return SCRIPT_CONTINUE; } //-- [NOTE] if (barada_condition__defaultCondition (player, npc)) { //-- NPC: I'm not sure what you're doing in my garage, but you better go do it somewhere else. string_id message = new string_id (c_stringFile, "s_44"); 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 != "barada") return SCRIPT_CONTINUE; obj_id npc = self; int branchId = utils.getIntScriptVar (player, "conversation.barada.branchId"); if (branchId == 5 && barada_handleBranch5 (player, npc, response) == SCRIPT_CONTINUE) return SCRIPT_CONTINUE; if (branchId == 6 && barada_handleBranch6 (player, npc, response) == SCRIPT_CONTINUE) return SCRIPT_CONTINUE; if (branchId == 7 && barada_handleBranch7 (player, npc, response) == SCRIPT_CONTINUE) return SCRIPT_CONTINUE; if (branchId == 8 && barada_handleBranch8 (player, npc, response) == SCRIPT_CONTINUE) return SCRIPT_CONTINUE; chat.chat (npc, "Error: Fell through all branches and responses for OnNpcConversationResponse."); utils.removeScriptVar (player, "conversation.barada.branchId"); return SCRIPT_CONTINUE; } // ======================================================================