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

549 lines
19 KiB
Plaintext

// ======================================================================
//
// coa3sharedcaravanleader.script
// Copyright 2003, Sony Online Entertainment
// All Rights Reserved.
//
// DO NOT EDIT THIS AUTO-GENERATED FILE. PLEASE USE THE CONVERATION EDITOR!
//
// ======================================================================
// ======================================================================
// Library Includes
// ======================================================================
include library.ai_lib;
include library.chat;
include library.factions;
include library.utils;
// ======================================================================
// Script Constants
// ======================================================================
string c_stringFile = "conversation/coa3sharedcaravanleader";
// ======================================================================
// Script Conditions
// ======================================================================
boolean coa3sharedcaravanleader_condition__defaultCondition (obj_id player, obj_id npc)
{
return true;
}
// ----------------------------------------------------------------------
boolean coa3sharedcaravanleader_condition_hasMissionFromLookout (obj_id player, obj_id npc)
{
if ((getObjIdObjVar(player, "coa3.imperial.missionNpcId") != npc) &&
(getObjIdObjVar(player, "coa3.rebel.missionNpcId") != npc))
return false;
return (getIntObjVar (player, "coa3.convTracker") == 206);
}
// ----------------------------------------------------------------------
boolean coa3sharedcaravanleader_condition_brokenPartNotRepaired (obj_id player, obj_id npc)
{
if ((getObjIdObjVar(player, "coa3.imperial.missionNpcId") != npc) &&
(getObjIdObjVar(player, "coa3.rebel.missionNpcId") != npc))
return false;
return (getIntObjVar (player, "coa3.convTracker") == 207);
}
// ----------------------------------------------------------------------
boolean coa3sharedcaravanleader_condition_brokenPartRepaired (obj_id player, obj_id npc)
{
if ((getObjIdObjVar(player, "coa3.imperial.missionNpcId") != npc) &&
(getObjIdObjVar(player, "coa3.rebel.missionNpcId") != npc))
return false;
const string REPAIRED_GRAV_UNIT = "object/tangible/theme_park/alderaan/act3/repaired_grav_unit.iff";
if (getIntObjVar(player, "coa3.convTracker") == 207 && utils.playerHasItemByTemplate(player, REPAIRED_GRAV_UNIT))
return true;
return false;
}
// ----------------------------------------------------------------------
boolean coa3sharedcaravanleader_condition_hasGottenDisk (obj_id player, obj_id npc)
{
if ((getObjIdObjVar(player, "coa3.imperial.missionNpcId") != npc) &&
(getObjIdObjVar(player, "coa3.rebel.missionNpcId") != npc))
return false;
return (getIntObjVar (player, "coa3.convTracker") == 208);
}
// ======================================================================
// Script Actions
// ======================================================================
void coa3sharedcaravanleader_action__defaultAction (obj_id player, obj_id npc)
{
}
// ----------------------------------------------------------------------
void coa3sharedcaravanleader_action_giveBrokenAntiGravUnit (obj_id player, obj_id npc)
{
setObjVar (player, "coa3.convTracker", 207);
// Give player Broken 100-GU Anti-Gravity Unit
const string BROKEN_GRAV_UNIT = "object/tangible/theme_park/alderaan/act3/broken_grav_unit.iff";
const string IMPERIAL_SHARED_STF = "theme_park/alderaan/act3/shared_imperial_missions";
const string_id BROKEN_UNIT_RECEIVED= new string_id(IMPERIAL_SHARED_STF, "m3_broken_grav_unit_received");
const string_id BROKEN_UNIT_DENIED = new string_id(IMPERIAL_SHARED_STF, "m3_broken_grav_unit_denied");
if (!utils.playerHasItemByTemplate(player, BROKEN_GRAV_UNIT))
{
obj_id inventory = getObjectInSlot(player, "inventory");
obj_id unit = createObject(BROKEN_GRAV_UNIT, inventory, "");
if (!isIdValid(unit))
{
sendSystemMessage(player, BROKEN_UNIT_DENIED);
}
else
{
sendSystemMessage(player, BROKEN_UNIT_RECEIVED);
}
}
}
// ----------------------------------------------------------------------
void coa3sharedcaravanleader_action_getDiskFromCaravanLeader (obj_id player, obj_id npc)
{
setObjVar (player, "coa3.convTracker", 208);
const string REPAIRED_GRAV_UNIT = "object/tangible/theme_park/alderaan/act3/repaired_grav_unit.iff";
const string ENCODED_DATA_DISK = "object/tangible/theme_park/alderaan/act3/encoded_data_disk.iff";
const string IMPERIAL_SHARED_STF = "theme_park/alderaan/act3/shared_imperial_missions";
const string_id DATA_DISK_RECEIVED = new string_id(IMPERIAL_SHARED_STF, "m3_data_disk_received");
const string_id DATA_DISK_DENIED = new string_id(IMPERIAL_SHARED_STF, "m3_data_disk_denied");
// Delete the 100-GU Anti-Gravity Unit from player's inventory
obj_id unit = utils.getItemPlayerHasByTemplate(player, REPAIRED_GRAV_UNIT);
if (isIdValid(unit)) destroyObject(unit);
// Give the player the Encoded Data Disk
if (!utils.playerHasItemByTemplate(player, ENCODED_DATA_DISK))
{
obj_id inventory = getObjectInSlot(player, "inventory");
obj_id disk = createObject(ENCODED_DATA_DISK, inventory, "");
if (!isIdValid(disk))
{
sendSystemMessage(player, DATA_DISK_DENIED);
}
else
{
sendSystemMessage(player, DATA_DISK_RECEIVED);
}
}
// Give the player 200 Jabba faction
factions.awardFactionStanding(player, "jabba", 200);
// Give the player a waypoint back to the coordinator.
messageTo(player, "createReturnMission", null, 1, false);
}
// ======================================================================
// User Script Triggers
// ======================================================================
trigger OnInitialize ()
{
if ((!isMob (self)) || (isPlayer (self)))
detachScript(self, "npc.conversation.coa3sharedcaravanleader");
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, "npc.conversation.coa3sharedcaravanleader");
return SCRIPT_CONTINUE;
}
// ======================================================================
// Script Triggers
// ======================================================================
trigger OnStartNpcConversation (obj_id player)
{
if (ai_lib.isInCombat (self) || ai_lib.isInCombat (player))
return SCRIPT_OVERRIDE;
//-- [NOTE] Player has agreed with lookout to fix part.
if (coa3sharedcaravanleader_condition_hasMissionFromLookout (player, self))
{
//-- NPC: Are you the one I'm waiting on? Transporting this much... umm cargo... over land is dangerous. There are a lot of people that would love to hijack this shipment. With us being broke down; it's only a matter of time before they find us.
string_id message = new string_id (c_stringFile, "s_1dde12ed");
int numberOfResponses = 0;
boolean hasResponse = false;
//-- PLAYER: Yes, I'm here to make the repairs.
boolean hasResponse0 = false;
if (coa3sharedcaravanleader_condition__defaultCondition (player, self))
{
++numberOfResponses;
hasResponse = true;
hasResponse0 = true;
}
//-- PLAYER: What are you transporting?
boolean hasResponse1 = false;
if (coa3sharedcaravanleader_condition__defaultCondition (player, self))
{
++numberOfResponses;
hasResponse = true;
hasResponse1 = true;
}
//-- PLAYER: I'm just passing through.
boolean hasResponse2 = false;
if (coa3sharedcaravanleader_condition__defaultCondition (player, self))
{
++numberOfResponses;
hasResponse = true;
hasResponse2 = true;
}
if (hasResponse)
{
int responseIndex = 0;
string_id responses [] = new string_id [numberOfResponses];
if (hasResponse0)
responses [responseIndex++] = new string_id (c_stringFile, "s_f3da7c8a");
if (hasResponse1)
responses [responseIndex++] = new string_id (c_stringFile, "s_da681077");
if (hasResponse2)
responses [responseIndex++] = new string_id (c_stringFile, "s_29e36db9");
setObjVar (player, "conversation.coa3sharedcaravanleader.branchId", 1);
npcStartConversation (player, self, "coa3sharedcaravanleader", message, responses);
}
else
{
chat.chat (self, message);
}
return SCRIPT_CONTINUE;
}
//-- [NOTE] Player was given broken part and now has the repaired version of the broken part in inventory.
if (coa3sharedcaravanleader_condition_brokenPartRepaired (player, self))
{
//-- NPC: So is that part repaired yet?
string_id message = new string_id (c_stringFile, "s_d3ba3662");
int numberOfResponses = 0;
boolean hasResponse = false;
//-- PLAYER: Yes, here it is.
boolean hasResponse0 = false;
if (coa3sharedcaravanleader_condition__defaultCondition (player, self))
{
++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_93eb6764");
setObjVar (player, "conversation.coa3sharedcaravanleader.branchId", 5);
npcStartConversation (player, self, "coa3sharedcaravanleader", message, responses);
}
else
{
chat.chat (self, message);
}
return SCRIPT_CONTINUE;
}
//-- [NOTE] Player has been given the broken part. The repaired part is not in their inventory.
if (coa3sharedcaravanleader_condition_brokenPartNotRepaired (player, self))
{
//-- NPC: So is that part repaired yet?
string_id message = new string_id (c_stringFile, "s_d3ba3662");
int numberOfResponses = 0;
boolean hasResponse = false;
//-- PLAYER: Not yet.
boolean hasResponse0 = false;
if (coa3sharedcaravanleader_condition__defaultCondition (player, self))
{
++numberOfResponses;
hasResponse = true;
hasResponse0 = true;
}
//-- PLAYER: What's in it for me?
boolean hasResponse1 = false;
if (coa3sharedcaravanleader_condition__defaultCondition (player, self))
{
++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_b5f15b19");
if (hasResponse1)
responses [responseIndex++] = new string_id (c_stringFile, "s_48566ef9");
setObjVar (player, "conversation.coa3sharedcaravanleader.branchId", 7);
npcStartConversation (player, self, "coa3sharedcaravanleader", message, responses);
}
else
{
chat.chat (self, message);
}
return SCRIPT_CONTINUE;
}
//-- [NOTE] The player gave the NPC the repaired part.
if (coa3sharedcaravanleader_condition_hasGottenDisk (player, self))
{
//-- NPC: Why are you still here? We have work to do so we can get moving and I don't need you bothering us. Get lost!
string_id message = new string_id (c_stringFile, "s_869e12b2");
chat.chat (self, message);
return SCRIPT_CONTINUE;
}
//-- [NOTE] None of the above.
if (coa3sharedcaravanleader_condition__defaultCondition (player, self))
{
//-- NPC: Didn't your mother ever tell you not to talk to strangers? Keep on moving the way you were headed and forget anything you've seen here.
string_id message = new string_id (c_stringFile, "s_e0d207ec");
chat.chat (self, message);
return SCRIPT_CONTINUE;
}
chat.chat (self, "Error: All conditions for OnStartNpcConversation were false.");
return SCRIPT_CONTINUE;
}
// ----------------------------------------------------------------------
trigger OnNpcConversationResponse (string conversationId, obj_id player, string_id response)
{
if (conversationId != "coa3sharedcaravanleader")
return SCRIPT_CONTINUE;
int branchId = getIntObjVar (player, "conversation.coa3sharedcaravanleader.branchId");
//-- [BRANCH NOTE] Player has agreed with lookout to fix part.
//-- NPC: Are you the one I'm waiting on? Transporting this much... umm cargo... over land is dangerous. There are a lot of people that would love to hijack this shipment. With us being broke down; it's only a matter of time before they find us.
//-- [RESPONSE NOTE] Give the player the broken part. objvar 207
//-- PLAYER: Yes, I'm here to make the repairs.
if (branchId == 1 && response == "s_f3da7c8a")
{
coa3sharedcaravanleader_action_giveBrokenAntiGravUnit (player, self);
//-- [NOTE]
if (coa3sharedcaravanleader_condition__defaultCondition (player, self))
{
//-- NPC: Thank the stars! Here's the part we need to get fixed. Repair that anti-gravity unit and let me know when you're finished. Then we can all get out of here and forget this whole mess ever happened.
string_id message = new string_id (c_stringFile, "s_8264ab67");
removeObjVar (player, "conversation.coa3sharedcaravanleader.branchId");
npcSpeak (player, message);
npcEndConversation (player);
return SCRIPT_CONTINUE;
}
chat.chat (self, "Error: All conditions for OnNpcConversationResponse for branch 'Are you the one I'm waiting on? Transporting this much... umm cargo... over land is dangerous. There are a lot of people that would love to hijack this shipment. With us being broke down; it's only a matter of time before they find us.' were false.");
return SCRIPT_CONTINUE;
}
//-- [BRANCH NOTE] Player has agreed with lookout to fix part.
//-- NPC: Are you the one I'm waiting on? Transporting this much... umm cargo... over land is dangerous. There are a lot of people that would love to hijack this shipment. With us being broke down; it's only a matter of time before they find us.
//-- [RESPONSE NOTE]
//-- PLAYER: What are you transporting?
if (branchId == 1 && response == "s_da681077")
{
//-- [NOTE]
if (coa3sharedcaravanleader_condition__defaultCondition (player, self))
{
//-- NPC: That's none of your business. If you're not here to do the repairs, get lost!
string_id message = new string_id (c_stringFile, "s_302369bd");
removeObjVar (player, "conversation.coa3sharedcaravanleader.branchId");
npcSpeak (player, message);
npcEndConversation (player);
return SCRIPT_CONTINUE;
}
chat.chat (self, "Error: All conditions for OnNpcConversationResponse for branch 'Are you the one I'm waiting on? Transporting this much... umm cargo... over land is dangerous. There are a lot of people that would love to hijack this shipment. With us being broke down; it's only a matter of time before they find us.' were false.");
return SCRIPT_CONTINUE;
}
//-- [BRANCH NOTE] Player has agreed with lookout to fix part.
//-- NPC: Are you the one I'm waiting on? Transporting this much... umm cargo... over land is dangerous. There are a lot of people that would love to hijack this shipment. With us being broke down; it's only a matter of time before they find us.
//-- [RESPONSE NOTE]
//-- PLAYER: I'm just passing through.
if (branchId == 1 && response == "s_29e36db9")
{
//-- [NOTE]
if (coa3sharedcaravanleader_condition__defaultCondition (player, self))
{
//-- NPC: Well you'll keep on passing through then if you know what's good for you. There's nothing to see here.
string_id message = new string_id (c_stringFile, "s_ca41d9fd");
removeObjVar (player, "conversation.coa3sharedcaravanleader.branchId");
npcSpeak (player, message);
npcEndConversation (player);
return SCRIPT_CONTINUE;
}
chat.chat (self, "Error: All conditions for OnNpcConversationResponse for branch 'Are you the one I'm waiting on? Transporting this much... umm cargo... over land is dangerous. There are a lot of people that would love to hijack this shipment. With us being broke down; it's only a matter of time before they find us.' were false.");
return SCRIPT_CONTINUE;
}
//-- [BRANCH NOTE] Player was given broken part and now has the repaired version of the broken part in inventory.
//-- NPC: So is that part repaired yet?
//-- [RESPONSE NOTE] objvar set to 208. Delete the repaired part from inventory. Give the encoded disk. Give 200 Jabba faction. Get a waypoint back to coordinator.
//-- PLAYER: Yes, here it is.
if (branchId == 5 && response == "s_93eb6764")
{
coa3sharedcaravanleader_action_getDiskFromCaravanLeader (player, self);
//-- [NOTE]
if (coa3sharedcaravanleader_condition__defaultCondition (player, self))
{
//-- NPC: Take this disc. It gives our new ETA and all the gritty details of this debacle of an operation. Most importantly, it explains I'm not at fault. I don't want this breakdown to tarnish my reputation. I'd rather die than to survive a hijacking and have to face Jabba. He'd hold me personally responsible for the loss of the cargo I'm sure! And don't get any ideas about reading that disk. That's all classified info and it's all encoded.
string_id message = new string_id (c_stringFile, "s_e2c11475");
removeObjVar (player, "conversation.coa3sharedcaravanleader.branchId");
npcSpeak (player, message);
npcEndConversation (player);
return SCRIPT_CONTINUE;
}
chat.chat (self, "Error: All conditions for OnNpcConversationResponse for branch 'So is that part repaired yet?' were false.");
return SCRIPT_CONTINUE;
}
//-- [BRANCH NOTE] Player has been given the broken part. The repaired part is not in their inventory.
//-- NPC: So is that part repaired yet?
//-- [RESPONSE NOTE]
//-- PLAYER: Not yet.
if (branchId == 7 && response == "s_b5f15b19")
{
//-- [NOTE]
if (coa3sharedcaravanleader_condition__defaultCondition (player, self))
{
//-- NPC: Well what are you waiting for, get to it! You're in as much danger as us just sitting out here in the open. The quicker that part is repaired, the better it will be for all of us.
string_id message = new string_id (c_stringFile, "s_b4c62ef2");
removeObjVar (player, "conversation.coa3sharedcaravanleader.branchId");
npcSpeak (player, message);
npcEndConversation (player);
return SCRIPT_CONTINUE;
}
chat.chat (self, "Error: All conditions for OnNpcConversationResponse for branch 'So is that part repaired yet?' were false.");
return SCRIPT_CONTINUE;
}
//-- [BRANCH NOTE] Player has been given the broken part. The repaired part is not in their inventory.
//-- NPC: So is that part repaired yet?
//-- [RESPONSE NOTE]
//-- PLAYER: What's in it for me?
if (branchId == 7 && response == "s_48566ef9")
{
//-- [NOTE]
if (coa3sharedcaravanleader_condition__defaultCondition (player, self))
{
//-- NPC: Listen. This cargo is immensely valuable to Jabba. You make these repairs and I'll give you a disk that explains everything. You turn that in and I'm sure they will give you a big reward for helping make this delivery a success.
string_id message = new string_id (c_stringFile, "s_b22dadc9");
removeObjVar (player, "conversation.coa3sharedcaravanleader.branchId");
npcSpeak (player, message);
npcEndConversation (player);
return SCRIPT_CONTINUE;
}
chat.chat (self, "Error: All conditions for OnNpcConversationResponse for branch 'So is that part repaired yet?' were false.");
return SCRIPT_CONTINUE;
}
chat.chat (self, "Error: Fell through all branches and responses for OnNpcConversationResponse.");
removeObjVar (player, "conversation.coa3sharedcaravanleader.branchId");
return SCRIPT_CONTINUE;
}
// ======================================================================