// ====================================================================== // // padawan_chef_01.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_01"; // ====================================================================== // Script Conditions // ====================================================================== boolean padawan_chef_01_condition__defaultCondition (obj_id player, obj_id npc) { return true; } // ---------------------------------------------------------------------- boolean padawan_chef_01_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(npc, "padawan_trials.playerFailed"); } } return false; } // ---------------------------------------------------------------------- boolean padawan_chef_01_condition_acceptedQuest (obj_id player, obj_id npc) { obj_id trialPlayer = getObjIdObjVar(npc, jedi_trials.PADAWAN_TRIAL_PLAYER_OBJVAR); if ( player == trialPlayer ) { return hasObjVar(player, "jedi_trials.padawan_trials.temp.acceptedTask"); } return false; } // ---------------------------------------------------------------------- boolean padawan_chef_01_condition_wasTargetEliminated (obj_id player, obj_id npc) { obj_id trialPlayer = getObjIdObjVar(npc, jedi_trials.PADAWAN_TRIAL_PLAYER_OBJVAR); if ( player == trialPlayer ) { return hasObjVar(player, "jedi_trials.padawan_trials.temp.killedTarget"); } return false; } // ---------------------------------------------------------------------- boolean padawan_chef_01_condition_completedSuccess (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(npc, "padawan_trials.playerSucceeded"); } } return false; } // ---------------------------------------------------------------------- boolean padawan_chef_01_condition_spokeToTarget (obj_id player, obj_id npc) { obj_id trialPlayer = getObjIdObjVar(npc, jedi_trials.PADAWAN_TRIAL_PLAYER_OBJVAR); if ( player == trialPlayer ) { return hasObjVar(player, "jedi_trials.padawan_trials.temp.spokeToTarget_01"); } return false; } // ====================================================================== // Script Actions // ====================================================================== void padawan_chef_01_action_questFailure (obj_id player, obj_id npc) { setObjVar(npc, "padawan_trials.playerFailed", true); messageTo(player, "handleQuestFailure", null, 1, false); return; } // ---------------------------------------------------------------------- void padawan_chef_01_action_questSuccess (obj_id player, obj_id npc) { setObjVar(npc, "padawan_trials.playerSucceeded", true); messageTo(player, "handleTrialComplete", null, 1, false); return; } // ---------------------------------------------------------------------- void padawan_chef_01_action_sendToNextNpc (obj_id player, obj_id npc) { setObjVar(npc, "padawan_trials.playerAccepted", true); setObjVar(player, "jedi_trials.padawan_trials.temp.acceptedTask", true); messageTo(player, "handleSetSecondLoc", null, 1, false); return; } // ====================================================================== // Script %TO Tokens // ====================================================================== // ====================================================================== // Script %DI Tokens // ====================================================================== // ====================================================================== // Script %DF Tokens // ====================================================================== // ====================================================================== // handleBranch Functions // ====================================================================== int padawan_chef_01_handleBranch2 (obj_id player, obj_id npc, string_id response) { //-- [BRANCH NOTE] //-- NPC: Problem solved? Did I get my revenge? //-- [RESPONSE NOTE] //-- PLAYER: Yes. He died screaming like a newborn bantha and begging for his life. if (response == "s_7c9388b6") { //-- [NOTE] if (padawan_chef_01_condition__defaultCondition (player, npc)) { doAnimationAction (npc, "celebrate"); padawan_chef_01_action_questFailure (player, npc); //-- NPC: My hero. Ah sweet and glorious day! string_id message = new string_id (c_stringFile, "s_edc10a84"); utils.removeScriptVar (player, "conversation.padawan_chef_01.branchId"); chat.chat (npc, player, message); npcEndConversation (player); return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } // ---------------------------------------------------------------------- int padawan_chef_01_handleBranch4 (obj_id player, obj_id npc, string_id response) { //-- [BRANCH NOTE] //-- NPC: So? Tell me what happened. Did he die painfully? //-- [RESPONSE NOTE] //-- PLAYER: No. I didn't hurt him. I'll not exact your petty revenge. if (response == "s_53e26aec") { //-- [NOTE] if (padawan_chef_01_condition__defaultCondition (player, npc)) { doAnimationAction (npc, "threaten"); padawan_chef_01_action_questSuccess (player, npc); //-- NPC: But?!! No!!!! string_id message = new string_id (c_stringFile, "s_9bf6042f"); utils.removeScriptVar (player, "conversation.padawan_chef_01.branchId"); chat.chat (npc, player, message); npcEndConversation (player); return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } // ---------------------------------------------------------------------- int padawan_chef_01_handleBranch6 (obj_id player, obj_id npc, string_id response) { //-- [BRANCH NOTE] If player returns before killing the thug. //-- NPC: Is it over? Has that thug paid the price I asked? //-- [RESPONSE NOTE] //-- PLAYER: Not just yet. I'm still working on it. if (response == "s_bc5c7c4a") { //-- [NOTE] if (padawan_chef_01_condition__defaultCondition (player, npc)) { //-- NPC: Okay. Don't waste too much time I don't know how long until he discovers that tracking device. string_id message = new string_id (c_stringFile, "s_d5ab69d1"); utils.removeScriptVar (player, "conversation.padawan_chef_01.branchId"); chat.chat (npc, player, message); npcEndConversation (player); return SCRIPT_CONTINUE; } } //-- [RESPONSE NOTE] //-- PLAYER: No but I'm done. I'm not going to help you seek revenge. if (response == "s_3f4dfda1") { //-- [NOTE] if (padawan_chef_01_condition__defaultCondition (player, npc)) { padawan_chef_01_action_questSuccess (player, npc); //-- NPC: What?? I can't... ah no, my sweet revenge!??! string_id message = new string_id (c_stringFile, "s_7c44e561"); utils.removeScriptVar (player, "conversation.padawan_chef_01.branchId"); chat.chat (npc, player, message); npcEndConversation (player); return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } // ---------------------------------------------------------------------- int padawan_chef_01_handleBranch9 (obj_id player, obj_id npc, string_id response) { //-- [BRANCH NOTE] //-- NPC: He took it. //-- [RESPONSE NOTE] //-- PLAYER: Who took what? if (response == "s_a7c3aea6") { //-- [NOTE] if (padawan_chef_01_condition__defaultCondition (player, npc)) { //-- NPC: Some random thug came by here, and took my latest creation. string_id message = new string_id (c_stringFile, "s_959fc17d"); int numberOfResponses = 0; boolean hasResponse = false; //-- PLAYER: That is one sad story. boolean hasResponse0 = false; if (padawan_chef_01_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_94e89675"); utils.setScriptVar (player, "conversation.padawan_chef_01.branchId", 10); npcSpeak (player, message); npcSetConversationResponses (player, responses); } else { utils.removeScriptVar (player, "conversation.padawan_chef_01.branchId"); chat.chat (npc, player, message); npcEndConversation (player); } return SCRIPT_CONTINUE; } } //-- [RESPONSE NOTE] //-- PLAYER: Good for him. if (response == "s_9bcbdc35") { doAnimationAction (player, "laugh_cackle"); //-- [NOTE] if (padawan_chef_01_condition__defaultCondition (player, npc)) { //-- NPC: Now, that was uncalled for. string_id message = new string_id (c_stringFile, "s_56b146aa"); int numberOfResponses = 0; boolean hasResponse = false; //-- PLAYER: You are right, I'm sorry. Who took what? boolean hasResponse0 = false; if (padawan_chef_01_condition__defaultCondition (player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse0 = true; } //-- PLAYER: I don't care, I'm glad he took it. boolean hasResponse1 = false; if (padawan_chef_01_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_78228c87"); if (hasResponse1) responses [responseIndex++] = new string_id (c_stringFile, "s_1ba9c89d"); utils.setScriptVar (player, "conversation.padawan_chef_01.branchId", 14); npcSpeak (player, message); npcSetConversationResponses (player, responses); } else { utils.removeScriptVar (player, "conversation.padawan_chef_01.branchId"); chat.chat (npc, player, message); npcEndConversation (player); } return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } // ---------------------------------------------------------------------- int padawan_chef_01_handleBranch10 (obj_id player, obj_id npc, string_id response) { //-- [BRANCH NOTE] //-- NPC: Some random thug came by here, and took my latest creation. //-- [RESPONSE NOTE] //-- PLAYER: That is one sad story. if (response == "s_94e89675") { //-- [NOTE] if (padawan_chef_01_condition__defaultCondition (player, npc)) { //-- NPC: It sure is. string_id message = new string_id (c_stringFile, "s_8a0862a1"); int numberOfResponses = 0; boolean hasResponse = false; //-- PLAYER: Yes. boolean hasResponse0 = false; if (padawan_chef_01_condition__defaultCondition (player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse0 = true; } //-- PLAYER: No. boolean hasResponse1 = false; if (padawan_chef_01_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_d70dba34"); if (hasResponse1) responses [responseIndex++] = new string_id (c_stringFile, "s_4c695dbd"); utils.setScriptVar (player, "conversation.padawan_chef_01.branchId", 11); npcSpeak (player, message); npcSetConversationResponses (player, responses); } else { utils.removeScriptVar (player, "conversation.padawan_chef_01.branchId"); chat.chat (npc, player, message); npcEndConversation (player); } return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } // ---------------------------------------------------------------------- int padawan_chef_01_handleBranch11 (obj_id player, obj_id npc, string_id response) { //-- [BRANCH NOTE] //-- NPC: It sure is. //-- [RESPONSE NOTE] //-- PLAYER: Yes. if (response == "s_d70dba34") { //-- [NOTE] if (padawan_chef_01_condition__defaultCondition (player, npc)) { padawan_chef_01_action_sendToNextNpc (player, npc); //-- NPC: I chased the thug all the way to the edge of town. He ran off into the wilderness, and I quickly lost sight of him. But I managed to at least tag him with a small burst tracking device, so I know where you can find the bum. string_id message = new string_id (c_stringFile, "s_b654720c"); utils.removeScriptVar (player, "conversation.padawan_chef_01.branchId"); chat.chat (npc, player, message); npcEndConversation (player); return SCRIPT_CONTINUE; } } //-- [RESPONSE NOTE] //-- PLAYER: No. if (response == "s_4c695dbd") { //-- [NOTE] if (padawan_chef_01_condition__defaultCondition (player, npc)) { doAnimationAction (npc, "gesticulate_wildly"); padawan_chef_01_action_questSuccess (player, npc); //-- NPC: But you must... you have no choice, don't you see. Help me get my revenge. I need revenge! You must!! Arrrrrrgggh... string_id message = new string_id (c_stringFile, "s_f68302e8"); utils.removeScriptVar (player, "conversation.padawan_chef_01.branchId"); chat.chat (npc, player, message); npcEndConversation (player); return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } // ---------------------------------------------------------------------- int padawan_chef_01_handleBranch14 (obj_id player, obj_id npc, string_id response) { //-- [BRANCH NOTE] //-- NPC: Now, that was uncalled for. //-- [RESPONSE NOTE] //-- PLAYER: You are right, I'm sorry. Who took what? if (response == "s_78228c87") { //-- [NOTE] if (padawan_chef_01_condition__defaultCondition (player, npc)) { //-- NPC: Some random thug came by here, and took my latest creation. string_id message = new string_id (c_stringFile, "s_959fc17d"); int numberOfResponses = 0; boolean hasResponse = false; //-- PLAYER: That is one sad story. boolean hasResponse0 = false; if (padawan_chef_01_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_94e89675"); utils.setScriptVar (player, "conversation.padawan_chef_01.branchId", 10); npcSpeak (player, message); npcSetConversationResponses (player, responses); } else { utils.removeScriptVar (player, "conversation.padawan_chef_01.branchId"); chat.chat (npc, player, message); npcEndConversation (player); } return SCRIPT_CONTINUE; } } //-- [RESPONSE NOTE] //-- PLAYER: I don't care, I'm glad he took it. if (response == "s_1ba9c89d") { //-- [NOTE] if (padawan_chef_01_condition__defaultCondition (player, npc)) { doAnimationAction (npc, "shake_head_disgust"); padawan_chef_01_action_questFailure (player, npc); //-- NPC: Arrrgh. You... you're just cruel. Taking pleasure in another's misfortune. string_id message = new string_id (c_stringFile, "s_8cddb8eb"); utils.removeScriptVar (player, "conversation.padawan_chef_01.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_01"); 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.padawan_chef_01"); 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_01_condition_completedSuccess (player, npc)) { doAnimationAction (npc, "weeping"); //-- NPC: It's not fair. Not at all. I hate everyone. string_id message = new string_id (c_stringFile, "s_e15ebf39"); chat.chat (npc, player, message); return SCRIPT_CONTINUE; } //-- [NOTE] if (padawan_chef_01_condition_wasTargetEliminated (player, npc)) { //-- NPC: Problem solved? Did I get my revenge? string_id message = new string_id (c_stringFile, "s_be6b7d06"); int numberOfResponses = 0; boolean hasResponse = false; //-- PLAYER: Yes. He died screaming like a newborn bantha and begging for his life. boolean hasResponse0 = false; if (padawan_chef_01_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_7c9388b6"); utils.setScriptVar (player, "conversation.padawan_chef_01.branchId", 2); npcStartConversation (player, npc, "padawan_chef_01", message, responses); } else { chat.chat (npc, player, message); } return SCRIPT_CONTINUE; } //-- [NOTE] if (padawan_chef_01_condition_spokeToTarget (player, npc)) { //-- NPC: So? Tell me what happened. Did he die painfully? string_id message = new string_id (c_stringFile, "s_236213e1"); int numberOfResponses = 0; boolean hasResponse = false; //-- PLAYER: No. I didn't hurt him. I'll not exact your petty revenge. boolean hasResponse0 = false; if (padawan_chef_01_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_53e26aec"); utils.setScriptVar (player, "conversation.padawan_chef_01.branchId", 4); npcStartConversation (player, npc, "padawan_chef_01", message, responses); } else { chat.chat (npc, player, message); } return SCRIPT_CONTINUE; } //-- [NOTE] If player returns before killing the thug. if (padawan_chef_01_condition_acceptedQuest (player, npc)) { //-- NPC: Is it over? Has that thug paid the price I asked? string_id message = new string_id (c_stringFile, "s_39d844c"); int numberOfResponses = 0; boolean hasResponse = false; //-- PLAYER: Not just yet. I'm still working on it. boolean hasResponse0 = false; if (padawan_chef_01_condition__defaultCondition (player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse0 = true; } //-- PLAYER: No but I'm done. I'm not going to help you seek revenge. boolean hasResponse1 = false; if (padawan_chef_01_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_bc5c7c4a"); if (hasResponse1) responses [responseIndex++] = new string_id (c_stringFile, "s_3f4dfda1"); utils.setScriptVar (player, "conversation.padawan_chef_01.branchId", 6); npcStartConversation (player, npc, "padawan_chef_01", message, responses); } else { chat.chat (npc, player, message); } return SCRIPT_CONTINUE; } //-- [NOTE] if (padawan_chef_01_condition_isTrialPlayer (player, npc)) { //-- NPC: He took it. string_id message = new string_id (c_stringFile, "s_58e01006"); int numberOfResponses = 0; boolean hasResponse = false; //-- PLAYER: Who took what? boolean hasResponse0 = false; if (padawan_chef_01_condition__defaultCondition (player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse0 = true; } //-- PLAYER: Good for him. boolean hasResponse1 = false; if (padawan_chef_01_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_a7c3aea6"); if (hasResponse1) responses [responseIndex++] = new string_id (c_stringFile, "s_9bcbdc35"); utils.setScriptVar (player, "conversation.padawan_chef_01.branchId", 9); npcStartConversation (player, npc, "padawan_chef_01", message, responses); } else { chat.chat (npc, player, message); } return SCRIPT_CONTINUE; } //-- [NOTE] if (padawan_chef_01_condition__defaultCondition (player, npc)) { doAnimationAction (npc, "weeping"); //-- NPC: It's gone... all gone. string_id message = new string_id (c_stringFile, "s_32e459b5"); 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_01") return SCRIPT_CONTINUE; obj_id npc = self; int branchId = utils.getIntScriptVar (player, "conversation.padawan_chef_01.branchId"); if (branchId == 2 && padawan_chef_01_handleBranch2 (player, npc, response) == SCRIPT_CONTINUE) return SCRIPT_CONTINUE; if (branchId == 4 && padawan_chef_01_handleBranch4 (player, npc, response) == SCRIPT_CONTINUE) return SCRIPT_CONTINUE; if (branchId == 6 && padawan_chef_01_handleBranch6 (player, npc, response) == SCRIPT_CONTINUE) return SCRIPT_CONTINUE; if (branchId == 9 && padawan_chef_01_handleBranch9 (player, npc, response) == SCRIPT_CONTINUE) return SCRIPT_CONTINUE; if (branchId == 10 && padawan_chef_01_handleBranch10 (player, npc, response) == SCRIPT_CONTINUE) return SCRIPT_CONTINUE; if (branchId == 11 && padawan_chef_01_handleBranch11 (player, npc, response) == SCRIPT_CONTINUE) return SCRIPT_CONTINUE; if (branchId == 14 && padawan_chef_01_handleBranch14 (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_01.branchId"); return SCRIPT_CONTINUE; } // ======================================================================