Files
dsrc/sku.0/sys.server/compiled/game/script/conversation/delivery_chardle.script
T

661 lines
19 KiB
Plaintext

// ======================================================================
//
// delivery_chardle.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.groundquests;
include library.utils;
// ======================================================================
// Script Constants
// ======================================================================
string c_stringFile = "conversation/delivery_chardle";
// ======================================================================
// Script Conditions
// ======================================================================
boolean delivery_chardle_condition__defaultCondition (obj_id player, obj_id npc)
{
return true;
}
// ----------------------------------------------------------------------
boolean delivery_chardle_condition_noAntivirus (obj_id player, obj_id npc)
{
faceTo(npc, player);
return (!groundquests.hasCompletedQuest(player, "outbreak_quest_01_imperial")
&& !groundquests.hasCompletedQuest(player, "outbreak_quest_01_rebel")
&& !groundquests.hasCompletedQuest(player, "outbreak_quest_01_neutral"));
}
// ----------------------------------------------------------------------
boolean delivery_chardle_condition_hasNotFoundBeta (obj_id player, obj_id npc)
{
return !hasCompletedCollectionSlot(player, "exp_icon_deathtroopers_camp_epsilon");
}
// ----------------------------------------------------------------------
boolean delivery_chardle_condition_neverDelivered (obj_id player, obj_id npc)
{
faceTo(npc, player);
return (!groundquests.isQuestActiveOrComplete(player, "camp_delta_delivery_01"));
}
// ----------------------------------------------------------------------
boolean delivery_chardle_condition_hasMeetingTask (obj_id player, obj_id npc)
{
return groundquests.isTaskActive(player, "camp_delta_delivery_01", "getBeastDelta");
}
// ----------------------------------------------------------------------
boolean delivery_chardle_condition_hasEscortTask (obj_id player, obj_id npc)
{
return groundquests.isTaskActive(player, "camp_delta_delivery_01", "escortTaskDelta");
}
// ----------------------------------------------------------------------
boolean delivery_chardle_condition_hasDeliveredBefore (obj_id player, obj_id npc)
{
return groundquests.hasCompletedQuest(player, "camp_delta_delivery_01");
}
// ----------------------------------------------------------------------
boolean delivery_chardle_condition_tooLowLevel (obj_id player, obj_id npc)
{
return getLevel(player) < 60;
}
// ======================================================================
// Script Actions
// ======================================================================
void delivery_chardle_action_giveQuest (obj_id player, obj_id npc)
{
faceTo(npc, player);
if(groundquests.hasCompletedQuest(player, "camp_delta_delivery_01"))
{
delivery_chardle_action_clearDeliveryQuest(player, npc);
}
groundquests.grantQuest(player, "camp_delta_delivery_01");
}
// ----------------------------------------------------------------------
void delivery_chardle_action_clearDeliveryQuest (obj_id player, obj_id npc)
{
groundquests.clearQuest(player, "camp_delta_delivery_01");
}
// ======================================================================
// Script %TO Tokens
// ======================================================================
// ======================================================================
// Script %DI Tokens
// ======================================================================
// ======================================================================
// Script %DF Tokens
// ======================================================================
// ======================================================================
// handleBranch<n> Functions
// ======================================================================
int delivery_chardle_handleBranch6 (obj_id player, obj_id npc, string_id response)
{
//-- [BRANCH NOTE]
//-- NPC: I need someone good with combat and you look like you want some extra credits!
//-- [RESPONSE NOTE]
//-- PLAYER: Depends on what you need.
if (response == "s_96")
{
//-- [NOTE]
if (delivery_chardle_condition__defaultCondition (player, npc))
{
doAnimationAction (npc, "explain");
//-- NPC: I need someone to escort my delivery volunteer to camp beta. I already know you have been there, word gets around. The volunteer knows the way as well so between the two of you no one should get lost.
string_id message = new string_id (c_stringFile, "s_97");
int numberOfResponses = 0;
boolean hasResponse = false;
//-- PLAYER: What are we delivering?
boolean hasResponse0 = false;
if (delivery_chardle_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.delivery_chardle.branchId", 7);
npcSpeak (player, message);
npcSetConversationResponses (player, responses);
}
else
{
utils.removeScriptVar (player, "conversation.delivery_chardle.branchId");
npcEndConversationWithMessage (player, message);
}
return SCRIPT_CONTINUE;
}
}
return SCRIPT_DEFAULT;
}
// ----------------------------------------------------------------------
int delivery_chardle_handleBranch7 (obj_id player, obj_id npc, string_id response)
{
//-- [BRANCH NOTE]
//-- NPC: I need someone to escort my delivery volunteer to camp beta. I already know you have been there, word gets around. The volunteer knows the way as well so between the two of you no one should get lost.
//-- [RESPONSE NOTE]
//-- PLAYER: What are we delivering?
if (response == "s_14")
{
//-- [NOTE]
if (delivery_chardle_condition__defaultCondition (player, npc))
{
//-- NPC: Medical supplies, food, water, ammunition. What do you think we are delivering? Imperial recruitment posters? Are you interested in helping out?
string_id message = new string_id (c_stringFile, "s_18");
int numberOfResponses = 0;
boolean hasResponse = false;
//-- PLAYER: Sure. I'll help.
boolean hasResponse0 = false;
if (delivery_chardle_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_20");
utils.setScriptVar (player, "conversation.delivery_chardle.branchId", 8);
npcSpeak (player, message);
npcSetConversationResponses (player, responses);
}
else
{
utils.removeScriptVar (player, "conversation.delivery_chardle.branchId");
npcEndConversationWithMessage (player, message);
}
return SCRIPT_CONTINUE;
}
}
return SCRIPT_DEFAULT;
}
// ----------------------------------------------------------------------
int delivery_chardle_handleBranch8 (obj_id player, obj_id npc, string_id response)
{
//-- [BRANCH NOTE]
//-- NPC: Medical supplies, food, water, ammunition. What do you think we are delivering? Imperial recruitment posters? Are you interested in helping out?
//-- [RESPONSE NOTE]
//-- PLAYER: Sure. I'll help.
if (response == "s_20")
{
//-- [NOTE]
if (delivery_chardle_condition__defaultCondition (player, npc))
{
//-- NPC: Oh I almost forgot. You should know that the delivery volunteer is armed with more than weapons. If the volunteer thinks he is about to succomb to the undead he will hit a panic switch and detonate explosives he is carrying.
string_id message = new string_id (c_stringFile, "s_22");
int numberOfResponses = 0;
boolean hasResponse = false;
//-- PLAYER: Uh....why?
boolean hasResponse0 = false;
if (delivery_chardle_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_24");
utils.setScriptVar (player, "conversation.delivery_chardle.branchId", 9);
npcSpeak (player, message);
npcSetConversationResponses (player, responses);
}
else
{
utils.removeScriptVar (player, "conversation.delivery_chardle.branchId");
npcEndConversationWithMessage (player, message);
}
return SCRIPT_CONTINUE;
}
}
return SCRIPT_DEFAULT;
}
// ----------------------------------------------------------------------
int delivery_chardle_handleBranch9 (obj_id player, obj_id npc, string_id response)
{
//-- [BRANCH NOTE]
//-- NPC: Oh I almost forgot. You should know that the delivery volunteer is armed with more than weapons. If the volunteer thinks he is about to succomb to the undead he will hit a panic switch and detonate explosives he is carrying.
//-- [RESPONSE NOTE]
//-- PLAYER: Uh....why?
if (response == "s_24")
{
//-- [NOTE]
if (delivery_chardle_condition__defaultCondition (player, npc))
{
//-- NPC: Why? Because no one wants to come back as one of those things.
string_id message = new string_id (c_stringFile, "s_26");
int numberOfResponses = 0;
boolean hasResponse = false;
//-- PLAYER: Okay...I guess.
boolean hasResponse0 = false;
if (delivery_chardle_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_28");
utils.setScriptVar (player, "conversation.delivery_chardle.branchId", 10);
npcSpeak (player, message);
npcSetConversationResponses (player, responses);
}
else
{
utils.removeScriptVar (player, "conversation.delivery_chardle.branchId");
npcEndConversationWithMessage (player, message);
}
return SCRIPT_CONTINUE;
}
}
return SCRIPT_DEFAULT;
}
// ----------------------------------------------------------------------
int delivery_chardle_handleBranch10 (obj_id player, obj_id npc, string_id response)
{
//-- [BRANCH NOTE]
//-- NPC: Why? Because no one wants to come back as one of those things.
//-- [RESPONSE NOTE]
//-- PLAYER: Okay...I guess.
if (response == "s_28")
{
//-- [NOTE]
if (delivery_chardle_condition__defaultCondition (player, npc))
{
delivery_chardle_action_giveQuest (player, npc);
//-- NPC: Go to the waypoint in your datapad. I'll send the delivery volunteer as soon as you are there.
string_id message = new string_id (c_stringFile, "s_30");
utils.removeScriptVar (player, "conversation.delivery_chardle.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
}
return SCRIPT_DEFAULT;
}
// ----------------------------------------------------------------------
int delivery_chardle_handleBranch12 (obj_id player, obj_id npc, string_id response)
{
//-- [BRANCH NOTE]
//-- NPC: You want to help out with another delivery? Same credit amount if you are interested.
//-- [RESPONSE NOTE]
//-- PLAYER: Sure.
if (response == "s_34")
{
//-- [NOTE]
if (delivery_chardle_condition__defaultCondition (player, npc))
{
delivery_chardle_action_giveQuest (player, npc);
//-- NPC: Go to the waypoint in your datapad. I'll send the delivery volunteer as soon as you are there.
string_id message = new string_id (c_stringFile, "s_36");
utils.removeScriptVar (player, "conversation.delivery_chardle.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
}
return SCRIPT_DEFAULT;
}
// ----------------------------------------------------------------------
// ======================================================================
// User Script Triggers
// ======================================================================
trigger OnInitialize ()
{
if ((!isTangible (self)) || (isPlayer (self)))
detachScript(self, "conversation.delivery_chardle");
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.delivery_chardle");
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 (delivery_chardle_condition_noAntivirus (player, npc))
{
//-- NPC: You don't have the anti-virus yet?? Get away from me...go see Doctor Cody. She can help you out.
string_id message = new string_id (c_stringFile, "s_7");
chat.chat (npc, player, message);
return SCRIPT_CONTINUE;
}
//-- [NOTE]
if (delivery_chardle_condition_tooLowLevel (player, npc))
{
//-- NPC: I'd ask you to help out but you are a little green behind the ears for anything I have.
string_id message = new string_id (c_stringFile, "s_37");
chat.chat (npc, player, message);
return SCRIPT_CONTINUE;
}
//-- [NOTE]
if (delivery_chardle_condition_hasNotFoundBeta (player, npc))
{
//-- NPC: I hear there is another camp not far from here. If you find it, come back. I have a job you might want.
string_id message = new string_id (c_stringFile, "s_10");
chat.chat (npc, player, message);
return SCRIPT_CONTINUE;
}
//-- [NOTE]
if (delivery_chardle_condition_hasEscortTask (player, npc))
{
delivery_chardle_action_clearDeliveryQuest (player, npc);
//-- NPC: I don't know what happened but you managed to lose the delivery volunteer. Come back when you want to try again.
string_id message = new string_id (c_stringFile, "s_16");
chat.chat (npc, player, message);
return SCRIPT_CONTINUE;
}
//-- [NOTE]
if (delivery_chardle_condition_hasMeetingTask (player, npc))
{
//-- NPC: You need to complete the delivery. Go to the waypoint I provided.
string_id message = new string_id (c_stringFile, "s_15");
chat.chat (npc, player, message);
return SCRIPT_CONTINUE;
}
//-- [NOTE]
if (delivery_chardle_condition_neverDelivered (player, npc))
{
doAnimationAction (npc, "thumb_up");
//-- NPC: I need someone good with combat and you look like you want some extra credits!
string_id message = new string_id (c_stringFile, "s_73");
int numberOfResponses = 0;
boolean hasResponse = false;
//-- PLAYER: Depends on what you need.
boolean hasResponse0 = false;
if (delivery_chardle_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_96");
utils.setScriptVar (player, "conversation.delivery_chardle.branchId", 6);
npcStartConversation (player, npc, "delivery_chardle", message, responses);
}
else
{
chat.chat (npc, player, message);
}
return SCRIPT_CONTINUE;
}
//-- [NOTE]
if (delivery_chardle_condition_hasDeliveredBefore (player, npc))
{
//-- NPC: You want to help out with another delivery? Same credit amount if you are interested.
string_id message = new string_id (c_stringFile, "s_32");
int numberOfResponses = 0;
boolean hasResponse = false;
//-- PLAYER: Sure.
boolean hasResponse0 = false;
if (delivery_chardle_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.delivery_chardle.branchId", 12);
npcStartConversation (player, npc, "delivery_chardle", message, responses);
}
else
{
chat.chat (npc, player, message);
}
return SCRIPT_CONTINUE;
}
//-- [NOTE]
if (delivery_chardle_condition__defaultCondition (player, npc))
{
//-- NPC: If you are hungry let me know. We have plenty of rations. If you want them hot, you can always leave them out in the sun a while.
string_id message = new string_id (c_stringFile, "s_60");
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 != "delivery_chardle")
return SCRIPT_CONTINUE;
obj_id npc = self;
int branchId = utils.getIntScriptVar (player, "conversation.delivery_chardle.branchId");
if (branchId == 6 && delivery_chardle_handleBranch6 (player, npc, response) == SCRIPT_CONTINUE)
return SCRIPT_CONTINUE;
if (branchId == 7 && delivery_chardle_handleBranch7 (player, npc, response) == SCRIPT_CONTINUE)
return SCRIPT_CONTINUE;
if (branchId == 8 && delivery_chardle_handleBranch8 (player, npc, response) == SCRIPT_CONTINUE)
return SCRIPT_CONTINUE;
if (branchId == 9 && delivery_chardle_handleBranch9 (player, npc, response) == SCRIPT_CONTINUE)
return SCRIPT_CONTINUE;
if (branchId == 10 && delivery_chardle_handleBranch10 (player, npc, response) == SCRIPT_CONTINUE)
return SCRIPT_CONTINUE;
if (branchId == 12 && delivery_chardle_handleBranch12 (player, npc, response) == SCRIPT_CONTINUE)
return SCRIPT_CONTINUE;
chat.chat (npc, "Error: Fell through all branches and responses for OnNpcConversationResponse.");
utils.removeScriptVar (player, "conversation.delivery_chardle.branchId");
return SCRIPT_CONTINUE;
}
// ======================================================================