Files
dsrc/sku.0/sys.server/compiled/game/script/conversation/ran_machado.script
T
2013-09-10 23:17:15 -07:00

679 lines
19 KiB
Plaintext

// ======================================================================
//
// ran_machado.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.collection;
include library.conversation;
include library.groundquests;
include library.static_item;
include library.utils;
// ======================================================================
// Script Constants
// ======================================================================
string c_stringFile = "conversation/ran_machado";
// ======================================================================
// Script Conditions
// ======================================================================
boolean ran_machado_condition__defaultCondition (obj_id player, obj_id npc)
{
return true;
}
// ----------------------------------------------------------------------
boolean ran_machado_condition_isElligibleFirstTime (obj_id player, obj_id npc)
{
faceTo(npc,player);
return !groundquests.isQuestActiveOrComplete(player, "u16_nym_themepark_weed_pulling_ver2");
}
// ----------------------------------------------------------------------
boolean ran_machado_condition_hasCompletedReq (obj_id player, obj_id npc)
{
faceTo(npc,player);
return groundquests.isTaskActive(player, "u16_nym_themepark_weed_pulling_ver2", "returnForPay");
}
// ----------------------------------------------------------------------
boolean ran_machado_condition_isElligibleSecondTime (obj_id player, obj_id npc)
{
faceTo(npc,player);
return !groundquests.isQuestActive(player, "u16_nym_themepark_weed_pulling_ver2")
&& groundquests.hasCompletedQuest(player, "u16_nym_themepark_weed_pulling_ver2");
}
// ----------------------------------------------------------------------
boolean ran_machado_condition_hasQuestActive (obj_id player, obj_id npc)
{
faceTo(npc,player);
return groundquests.isQuestActive(player, "u16_nym_themepark_weed_pulling_ver2");
}
// ----------------------------------------------------------------------
boolean ran_machado_condition_hasFailQuest (obj_id player, obj_id npc)
{
return groundquests.isQuestActive(player, "u16_nym_themepark_weed_pulling_fail");
}
// ======================================================================
// Script Actions
// ======================================================================
void ran_machado_action_giveQuest (obj_id player, obj_id npc)
{
if(groundquests.hasCompletedQuest(player, "u16_nym_themepark_weed_pulling_ver2"))
{
groundquests.clearQuest(player, "u16_nym_themepark_weed_pulling_ver2");
}
if(!groundquests.isQuestActive(player, "u16_nym_themepark_weed_pulling_ver2"))
{
groundquests.grantQuest(player, "u16_nym_themepark_weed_pulling_ver2");
}
//The collection does not have an activation slot
}
// ----------------------------------------------------------------------
void ran_machado_action_rewardPlayer (obj_id player, obj_id npc)
{
obj_id pInv = utils.getInventoryContainer(player);
if(isValidId(pInv) && exists(pInv))
{
groundquests.sendSignal(player, "hasBeenPaid");
collection.getRandomCollectionItemShowLootBox(player, pInv, "datatables/loot/dungeon/nym_weed_loot.iff", "weeds");
}
}
// ----------------------------------------------------------------------
void ran_machado_action_clearFail (obj_id player, obj_id npc)
{
groundquests.clearQuest(player, "u16_nym_themepark_weed_pulling_fail");
}
// ======================================================================
// Script %TO Tokens
// ======================================================================
// ======================================================================
// Script %DI Tokens
// ======================================================================
// ======================================================================
// Script %DF Tokens
// ======================================================================
// ======================================================================
// handleBranch<n> Functions
// ======================================================================
int ran_machado_handleBranch2 (obj_id player, obj_id npc, string_id response)
{
//-- [BRANCH NOTE]
//-- NPC: You need to speed things up if you are going to work with me, %TU. Are you interested in trying again?
//-- [RESPONSE NOTE]
//-- PLAYER: Yes
if (response == "s_34")
{
//-- [NOTE]
if (ran_machado_condition__defaultCondition (player, npc))
{
ran_machado_action_giveQuest (player, npc);
//-- NPC: Here you go.
string_id message = new string_id (c_stringFile, "s_36");
utils.removeScriptVar (player, "conversation.ran_machado.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
}
return SCRIPT_DEFAULT;
}
// ----------------------------------------------------------------------
int ran_machado_handleBranch5 (obj_id player, obj_id npc, string_id response)
{
//-- [BRANCH NOTE]
//-- NPC: You're back! Want in on more weed pulling?
//-- [RESPONSE NOTE]
//-- PLAYER: Yes.
if (response == "s_19")
{
//-- [NOTE]
if (ran_machado_condition__defaultCondition (player, npc))
{
doAnimationAction (npc, "thank");
ran_machado_action_giveQuest (player, npc);
//-- NPC: Go get those weeds, %TU!
string_id message = new string_id (c_stringFile, "s_20");
utils.removeScriptVar (player, "conversation.ran_machado.branchId");
prose_package pp = new prose_package ();
pp.stringId = message;
pp.actor.set (player);
pp.target.set (npc);
npcEndConversationWithMessage (player, pp);
return SCRIPT_CONTINUE;
}
}
return SCRIPT_DEFAULT;
}
// ----------------------------------------------------------------------
int ran_machado_handleBranch7 (obj_id player, obj_id npc, string_id response)
{
//-- [BRANCH NOTE]
//-- NPC: Hey, care to help out the city for Nym?
//-- [RESPONSE NOTE]
//-- PLAYER: What is in it for me?
if (response == "s_14")
{
//-- [NOTE]
if (ran_machado_condition__defaultCondition (player, npc))
{
doAnimationAction (npc, "explain");
//-- NPC: Notoriety, and a small sum of credits.
string_id message = new string_id (c_stringFile, "s_21");
int numberOfResponses = 0;
boolean hasResponse = false;
//-- PLAYER: I'm listening.
boolean hasResponse0 = false;
if (ran_machado_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_23");
utils.setScriptVar (player, "conversation.ran_machado.branchId", 8);
npcSpeak (player, message);
npcSetConversationResponses (player, responses);
}
else
{
utils.removeScriptVar (player, "conversation.ran_machado.branchId");
npcEndConversationWithMessage (player, message);
}
return SCRIPT_CONTINUE;
}
}
return SCRIPT_DEFAULT;
}
// ----------------------------------------------------------------------
int ran_machado_handleBranch8 (obj_id player, obj_id npc, string_id response)
{
//-- [BRANCH NOTE]
//-- NPC: Notoriety, and a small sum of credits.
//-- [RESPONSE NOTE]
//-- PLAYER: I'm listening.
if (response == "s_23")
{
//-- [NOTE]
if (ran_machado_condition__defaultCondition (player, npc))
{
doAnimationAction (npc, "forage");
//-- NPC: Nym has put me in charge of pulling up some of the unintended foliage around the Stronghold and city. All you need to do is find weeds, pull them up and dispose of them properly.
string_id message = new string_id (c_stringFile, "s_25");
int numberOfResponses = 0;
boolean hasResponse = false;
//-- PLAYER: How do I dispose of them?
boolean hasResponse0 = false;
if (ran_machado_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_27");
utils.setScriptVar (player, "conversation.ran_machado.branchId", 9);
npcSpeak (player, message);
npcSetConversationResponses (player, responses);
}
else
{
utils.removeScriptVar (player, "conversation.ran_machado.branchId");
npcEndConversationWithMessage (player, message);
}
return SCRIPT_CONTINUE;
}
}
return SCRIPT_DEFAULT;
}
// ----------------------------------------------------------------------
int ran_machado_handleBranch9 (obj_id player, obj_id npc, string_id response)
{
//-- [BRANCH NOTE]
//-- NPC: Nym has put me in charge of pulling up some of the unintended foliage around the Stronghold and city. All you need to do is find weeds, pull them up and dispose of them properly.
//-- [RESPONSE NOTE]
//-- PLAYER: How do I dispose of them?
if (response == "s_27")
{
//-- [NOTE]
if (ran_machado_condition__defaultCondition (player, npc))
{
doAnimationAction (npc, "point_left");
//-- NPC: There is a dumpster over by the kennels. Don't worry about that yet. Once the job is done I'll send you a comm with the location of the dumpster.
string_id message = new string_id (c_stringFile, "s_29");
int numberOfResponses = 0;
boolean hasResponse = false;
//-- PLAYER: Okay, I'll do it.
boolean hasResponse0 = false;
if (ran_machado_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_31");
utils.setScriptVar (player, "conversation.ran_machado.branchId", 10);
npcSpeak (player, message);
npcSetConversationResponses (player, responses);
}
else
{
utils.removeScriptVar (player, "conversation.ran_machado.branchId");
npcEndConversationWithMessage (player, message);
}
return SCRIPT_CONTINUE;
}
}
return SCRIPT_DEFAULT;
}
// ----------------------------------------------------------------------
int ran_machado_handleBranch10 (obj_id player, obj_id npc, string_id response)
{
//-- [BRANCH NOTE]
//-- NPC: There is a dumpster over by the kennels. Don't worry about that yet. Once the job is done I'll send you a comm with the location of the dumpster.
//-- [RESPONSE NOTE]
//-- PLAYER: Okay, I'll do it.
if (response == "s_31")
{
//-- [NOTE]
if (ran_machado_condition__defaultCondition (player, npc))
{
doAnimationAction (npc, "shoo");
ran_machado_action_giveQuest (player, npc);
//-- NPC: Here is the requisition. Fulfill the job, then come back. And we don't have all day.
string_id message = new string_id (c_stringFile, "s_35");
utils.removeScriptVar (player, "conversation.ran_machado.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
}
return SCRIPT_DEFAULT;
}
// ----------------------------------------------------------------------
// ======================================================================
// User Script Triggers
// ======================================================================
trigger OnInitialize ()
{
if ((!isTangible (self)) || (isPlayer (self)))
detachScript(self, "conversation.ran_machado");
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.ran_machado");
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 (ran_machado_condition_hasCompletedReq (player, npc))
{
doAnimationAction (npc, "celebrate");
ran_machado_action_rewardPlayer (player, npc);
//-- NPC: You did good. As promised, here is your payment.
string_id message = new string_id (c_stringFile, "s_17");
chat.chat (npc, player, message);
return SCRIPT_CONTINUE;
}
//-- [NOTE]
if (ran_machado_condition_hasFailQuest (player, npc))
{
doAnimationAction (npc, "backhand_threaten");
ran_machado_action_clearFail (player, npc);
//-- NPC: You need to speed things up if you are going to work with me, %TU. Are you interested in trying again?
string_id message = new string_id (c_stringFile, "s_33");
int numberOfResponses = 0;
boolean hasResponse = false;
//-- PLAYER: Yes
boolean hasResponse0 = false;
if (ran_machado_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_34");
utils.setScriptVar (player, "conversation.ran_machado.branchId", 2);
prose_package pp = new prose_package ();
pp.stringId = message;
pp.actor.set (player);
pp.target.set (npc);
npcStartConversation (player, npc, "ran_machado", null, pp, responses);
}
else
{
prose_package pp = new prose_package ();
pp.stringId = message;
pp.actor.set (player);
pp.target.set (npc);
chat.chat (npc, player, null, null, pp);
}
return SCRIPT_CONTINUE;
}
//-- [NOTE]
if (ran_machado_condition_hasQuestActive (player, npc))
{
doAnimationAction (npc, "shakefist");
//-- NPC: Come back when you're done. But hurry, there isn't much time.
string_id message = new string_id (c_stringFile, "s_16");
chat.chat (npc, player, message);
return SCRIPT_CONTINUE;
}
//-- [NOTE]
if (ran_machado_condition_isElligibleSecondTime (player, npc))
{
doAnimationAction (npc, "celebrate");
//-- NPC: You're back! Want in on more weed pulling?
string_id message = new string_id (c_stringFile, "s_18");
int numberOfResponses = 0;
boolean hasResponse = false;
//-- PLAYER: Yes.
boolean hasResponse0 = false;
if (ran_machado_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_19");
utils.setScriptVar (player, "conversation.ran_machado.branchId", 5);
npcStartConversation (player, npc, "ran_machado", message, responses);
}
else
{
chat.chat (npc, player, message);
}
return SCRIPT_CONTINUE;
}
//-- [NOTE]
if (ran_machado_condition_isElligibleFirstTime (player, npc))
{
doAnimationAction (npc, "explain");
//-- NPC: Hey, care to help out the city for Nym?
string_id message = new string_id (c_stringFile, "s_12");
int numberOfResponses = 0;
boolean hasResponse = false;
//-- PLAYER: What is in it for me?
boolean hasResponse0 = false;
if (ran_machado_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_14");
utils.setScriptVar (player, "conversation.ran_machado.branchId", 7);
npcStartConversation (player, npc, "ran_machado", message, responses);
}
else
{
chat.chat (npc, player, message);
}
return SCRIPT_CONTINUE;
}
//-- [NOTE]
if (ran_machado_condition__defaultCondition (player, npc))
{
//-- NPC: Sorry, not interested.
string_id message = new string_id (c_stringFile, "s_38");
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 != "ran_machado")
return SCRIPT_CONTINUE;
obj_id npc = self;
int branchId = utils.getIntScriptVar (player, "conversation.ran_machado.branchId");
if (branchId == 2 && ran_machado_handleBranch2 (player, npc, response) == SCRIPT_CONTINUE)
return SCRIPT_CONTINUE;
if (branchId == 5 && ran_machado_handleBranch5 (player, npc, response) == SCRIPT_CONTINUE)
return SCRIPT_CONTINUE;
if (branchId == 7 && ran_machado_handleBranch7 (player, npc, response) == SCRIPT_CONTINUE)
return SCRIPT_CONTINUE;
if (branchId == 8 && ran_machado_handleBranch8 (player, npc, response) == SCRIPT_CONTINUE)
return SCRIPT_CONTINUE;
if (branchId == 9 && ran_machado_handleBranch9 (player, npc, response) == SCRIPT_CONTINUE)
return SCRIPT_CONTINUE;
if (branchId == 10 && ran_machado_handleBranch10 (player, npc, response) == SCRIPT_CONTINUE)
return SCRIPT_CONTINUE;
chat.chat (npc, "Error: Fell through all branches and responses for OnNpcConversationResponse.");
utils.removeScriptVar (player, "conversation.ran_machado.branchId");
return SCRIPT_CONTINUE;
}
// ======================================================================