// ====================================================================== // // padawan_chef_02.script // Copyright 2004, Sony Online Entertainment // All Rights Reserved. // // Created with SwgConversationEditor 1.34 - DO NOT EDIT THIS AUTO-GENERATED FILE! // // ====================================================================== // ====================================================================== // Library Includes // ====================================================================== include library.ai_lib; include library.chat; include library.jedi_trials; include library.utils; // ====================================================================== // Script Constants // ====================================================================== string c_stringFile = "conversation/padawan_chef_02"; // ====================================================================== // Script Conditions // ====================================================================== boolean padawan_chef_02_condition__defaultCondition (obj_id player, obj_id npc) { return true; } // ---------------------------------------------------------------------- boolean padawan_chef_02_condition_isTrialPlayer (obj_id player, obj_id npc) { obj_id trialPlayer = getObjIdObjVar(npc, jedi_trials.PADAWAN_TRIAL_PLAYER_OBJVAR); if ( player == trialPlayer ) { string trialName = jedi_trials.getJediTrialName(player); if ( trialName != null && trialName.equals("chef") ) { return !hasObjVar(player, "jedi_trials.padawan_trials.temp.spokeToTarget_01"); } } return false; } // ====================================================================== // Script Actions // ====================================================================== void padawan_chef_02_action_spokeToNpc (obj_id player, obj_id npc) { setObjVar(player, "jedi_trials.padawan_trials.temp.spokeToTarget_01", true); stopCombat(npc); setInvulnerable (npc, true); messageTo(player, "handleSetBeginLoc", null, 1, false); return; } // ---------------------------------------------------------------------- void padawan_chef_02_action_npcAttacks (obj_id player, obj_id npc) { dictionary webster = new dictionary(); webster.put("player", player); messageTo(npc, "handleQuestStartAttack", webster, 1, false); return; } // ====================================================================== // Script %TO Tokens // ====================================================================== // ====================================================================== // Script %DI Tokens // ====================================================================== // ====================================================================== // Script %DF Tokens // ====================================================================== // ====================================================================== // handleBranch Functions // ====================================================================== int padawan_chef_02_handleBranch1 (obj_id player, obj_id npc, string_id response) { //-- [BRANCH NOTE] //-- NPC: Hey... who are you? What are you doing following me? At least you're not that crazed chef. He was out of his mind. I mean, it was just a pie. //-- [RESPONSE NOTE] //-- PLAYER: I'm here because that crazed chef asked me to be. if (response == "s_c1e21c08") { //-- [NOTE] if (padawan_chef_02_condition__defaultCondition (player, npc)) { //-- NPC: What? No! Ha. That's truly unbelievable. Okay, so you're here. Now what? You gonna try and collect some money for that pie? string_id message = new string_id (c_stringFile, "s_78cca73a"); int numberOfResponses = 0; boolean hasResponse = false; //-- PLAYER: Not money, exactly. But I am here to make you pay for that pie. In blood. boolean hasResponse0 = false; if (padawan_chef_02_condition__defaultCondition (player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse0 = true; } //-- PLAYER: The chef wants revenge. But I think I've made a mistake. I'm leaving. boolean hasResponse1 = false; if (padawan_chef_02_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_ca28f99d"); if (hasResponse1) responses [responseIndex++] = new string_id (c_stringFile, "s_928c6a6a"); utils.setScriptVar (player, "conversation.padawan_chef_02.branchId", 2); npcSpeak (player, message); npcSetConversationResponses (player, responses); } else { utils.removeScriptVar (player, "conversation.padawan_chef_02.branchId"); chat.chat (npc, player, message); npcEndConversation (player); } return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } // ---------------------------------------------------------------------- int padawan_chef_02_handleBranch2 (obj_id player, obj_id npc, string_id response) { //-- [BRANCH NOTE] //-- NPC: What? No! Ha. That's truly unbelievable. Okay, so you're here. Now what? You gonna try and collect some money for that pie? //-- [RESPONSE NOTE] //-- PLAYER: Not money, exactly. But I am here to make you pay for that pie. In blood. if (response == "s_ca28f99d") { doAnimationAction (player, "slit_throat"); //-- [NOTE] if (padawan_chef_02_condition__defaultCondition (player, npc)) { doAnimationAction (npc, "threaten_combat"); padawan_chef_02_action_npcAttacks (player, npc); //-- NPC: Whoa! Hold it. Just a minute. For a pie? You want blood? Alright. Whatever. Come on. Let's go! string_id message = new string_id (c_stringFile, "s_867ceb54"); utils.removeScriptVar (player, "conversation.padawan_chef_02.branchId"); chat.chat (npc, player, message); npcEndConversation (player); return SCRIPT_CONTINUE; } } //-- [RESPONSE NOTE] //-- PLAYER: The chef wants revenge. But I think I've made a mistake. I'm leaving. if (response == "s_928c6a6a") { //-- [NOTE] if (padawan_chef_02_condition__defaultCondition (player, npc)) { doAnimationAction (npc, "embarrassed"); padawan_chef_02_action_spokeToNpc (player, npc); //-- NPC: Oh. Yeah, good. And you tell that chef... well, tell him his pie was really good. And that I'll try and pay for the next one. string_id message = new string_id (c_stringFile, "s_2ad2bbf9"); utils.removeScriptVar (player, "conversation.padawan_chef_02.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.padawan_chef_02"); setCondition (self, CONDITION_CONVERSABLE); return SCRIPT_CONTINUE; } trigger OnAttach () { setCondition (self, CONDITION_CONVERSABLE); return SCRIPT_CONTINUE; } trigger OnObjectMenuRequest (obj_id player, menu_info menuInfo) { if ( !isIncapacitated(self) ) { int menu = menuInfo.addRootMenu (menu_info_types.CONVERSE_START, null); menu_info_data menuInfoData = menuInfo.getMenuItemById (menu); menuInfoData.setServerNotify (false); setCondition (self, CONDITION_CONVERSABLE); } else { clearCondition (self, CONDITION_CONVERSABLE); } return SCRIPT_CONTINUE; } trigger OnIncapacitated (obj_id killer) { clearCondition (self, CONDITION_CONVERSABLE); detachScript (self, "conversation.padawan_chef_02"); 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 (padawan_chef_02_condition_isTrialPlayer (player, npc)) { doAnimationAction (npc, "nervous"); //-- NPC: Hey... who are you? What are you doing following me? At least you're not that crazed chef. He was out of his mind. I mean, it was just a pie. string_id message = new string_id (c_stringFile, "s_35494a44"); int numberOfResponses = 0; boolean hasResponse = false; //-- PLAYER: I'm here because that crazed chef asked me to be. boolean hasResponse0 = false; if (padawan_chef_02_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_c1e21c08"); utils.setScriptVar (player, "conversation.padawan_chef_02.branchId", 1); npcStartConversation (player, npc, "padawan_chef_02", message, responses); } else { chat.chat (npc, player, message); } return SCRIPT_CONTINUE; } //-- [NOTE] if (padawan_chef_02_condition__defaultCondition (player, npc)) { doAnimationAction (npc, "rub_belly"); //-- NPC: Oh man, that pie was so good. I hope that guy makes another one. I might even pay for the next one. string_id message = new string_id (c_stringFile, "s_7ca121b2"); 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 != "padawan_chef_02") return SCRIPT_CONTINUE; obj_id npc = self; int branchId = utils.getIntScriptVar (player, "conversation.padawan_chef_02.branchId"); if (branchId == 1 && padawan_chef_02_handleBranch1 (player, npc, response) == SCRIPT_CONTINUE) return SCRIPT_CONTINUE; if (branchId == 2 && padawan_chef_02_handleBranch2 (player, npc, response) == SCRIPT_CONTINUE) return SCRIPT_CONTINUE; chat.chat (npc, "Error: Fell through all branches and responses for OnNpcConversationResponse."); utils.removeScriptVar (player, "conversation.padawan_chef_02.branchId"); return SCRIPT_CONTINUE; } // ======================================================================