mirror of
https://github.com/SWG-Source/dsrc.git
synced 2026-07-31 00:15:54 -04:00
1093 lines
30 KiB
Plaintext
1093 lines
30 KiB
Plaintext
// ======================================================================
|
|
//
|
|
// event_perk_racing.script
|
|
// Copyright 2004, Sony Online Entertainment
|
|
// All Rights Reserved.
|
|
//
|
|
// Created with SwgConversationEditor 1.36 - DO NOT EDIT THIS AUTO-GENERATED FILE!
|
|
//
|
|
// ======================================================================
|
|
|
|
// ======================================================================
|
|
// Library Includes
|
|
// ======================================================================
|
|
|
|
include library.ai_lib;
|
|
include library.chat;
|
|
include library.utils;
|
|
|
|
// ======================================================================
|
|
// Script Constants
|
|
// ======================================================================
|
|
|
|
string c_stringFile = "conversation/event_perk_racing";
|
|
|
|
// ======================================================================
|
|
// Script Conditions
|
|
// ======================================================================
|
|
|
|
boolean event_perk_racing_condition__defaultCondition (obj_id player, obj_id npc)
|
|
{
|
|
return true;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
boolean event_perk_racing_condition_partOfStory (obj_id player, obj_id npc)
|
|
{
|
|
obj_id storyteller = getObjIdObjVar(npc, "storytellerid");
|
|
if ( isIdValid(storyteller) )
|
|
{
|
|
if ( storyteller == player )
|
|
{
|
|
return true;
|
|
}
|
|
|
|
if ( utils.hasScriptVar(player, "storytellerAssistant") )
|
|
{
|
|
obj_id whoAmIAssisting = utils.getObjIdScriptVar(player, "storytellerAssistant");
|
|
if ( isIdValid(whoAmIAssisting) && storyteller == whoAmIAssisting )
|
|
{
|
|
return true;
|
|
}
|
|
}
|
|
|
|
if ( utils.hasScriptVar(player, "storytellerid") )
|
|
{
|
|
obj_id playersStoryteller = utils.getObjIdScriptVar(player, "storytellerid");
|
|
if ( isIdValid(playersStoryteller) && storyteller == playersStoryteller )
|
|
{
|
|
return true;
|
|
}
|
|
}
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
boolean event_perk_racing_condition_isRacing (obj_id player, obj_id npc)
|
|
{
|
|
return hasScript(player, "systems.event_perk.race_droid_player") && hasObjVar(player, "event_perk.racing.isRacing");
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
boolean event_perk_racing_condition_hasLastTime (obj_id player, obj_id npc)
|
|
{
|
|
return hasScript(player, "systems.event_perk.race_droid_player");
|
|
}
|
|
|
|
// ======================================================================
|
|
// Script Actions
|
|
// ======================================================================
|
|
|
|
void event_perk_racing_action_startRace (obj_id player, obj_id npc)
|
|
{
|
|
dictionary params = new dictionary();
|
|
params.put("player", player);
|
|
params.put("npc", npc);
|
|
params.put("value", 1);
|
|
|
|
messageTo(npc, "messageStartMission", params, 0, false);
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
void event_perk_racing_action_displayCurrentLeader (obj_id player, obj_id npc)
|
|
{
|
|
dictionary params = new dictionary();
|
|
params.put("player", player);
|
|
params.put("npc", npc);
|
|
|
|
messageTo(npc, "messageDisplayLeader", params, 0, false);
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
void event_perk_racing_action_abortRace (obj_id player, obj_id npc)
|
|
{
|
|
dictionary params = new dictionary();
|
|
params.put("player", player);
|
|
messageTo(player, "handleCleanUp", params, 0, false);
|
|
playMusic(player, "sound/music_combat_bfield_death.snd");
|
|
}
|
|
|
|
// ======================================================================
|
|
// Script %TO Tokens
|
|
// ======================================================================
|
|
|
|
string event_perk_racing_tokenTO_storytellerName (obj_id player, obj_id npc)
|
|
{
|
|
return getStringObjVar(npc, "storytellerName");
|
|
}
|
|
|
|
// ======================================================================
|
|
// Script %DI Tokens
|
|
// ======================================================================
|
|
|
|
// ======================================================================
|
|
// Script %DF Tokens
|
|
// ======================================================================
|
|
|
|
// ======================================================================
|
|
// handleBranch<n> Functions
|
|
// ======================================================================
|
|
|
|
int event_perk_racing_handleBranch1 (obj_id player, obj_id npc, string_id response)
|
|
{
|
|
//-- [BRANCH NOTE]
|
|
//-- NPC: Greetings, I'm the coordinator for this race course. You are not authorized to participate. Thank you.
|
|
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: How do I get authorization?
|
|
if (response == "s_23")
|
|
{
|
|
//-- [NOTE]
|
|
if (event_perk_racing_condition__defaultCondition (player, npc))
|
|
{
|
|
//-- NPC: You will need to be invited to %TO's story.
|
|
string_id message = new string_id (c_stringFile, "s_24");
|
|
utils.removeScriptVar (player, "conversation.event_perk_racing.branchId");
|
|
|
|
prose_package pp = new prose_package ();
|
|
pp.stringId = message;
|
|
pp.actor.set (player);
|
|
pp.target.set (npc);
|
|
pp.other.set (event_perk_racing_tokenTO_storytellerName (player, npc));
|
|
|
|
npcEndConversationWithMessage (player, pp);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
}
|
|
|
|
return SCRIPT_DEFAULT;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
int event_perk_racing_handleBranch3 (obj_id player, obj_id npc, string_id response)
|
|
{
|
|
//-- [BRANCH NOTE]
|
|
//-- NPC: The clock is ticking, get moving!
|
|
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: I need to abort this race.
|
|
if (response == "s_d900d1be")
|
|
{
|
|
event_perk_racing_action_abortRace (player, npc);
|
|
|
|
//-- [NOTE]
|
|
if (event_perk_racing_condition__defaultCondition (player, npc))
|
|
{
|
|
//-- NPC: As you wish.
|
|
string_id message = new string_id (c_stringFile, "s_6441a2a6");
|
|
utils.removeScriptVar (player, "conversation.event_perk_racing.branchId");
|
|
|
|
npcEndConversationWithMessage (player, message);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
}
|
|
|
|
return SCRIPT_DEFAULT;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
int event_perk_racing_handleBranch5 (obj_id player, obj_id npc, string_id response)
|
|
{
|
|
//-- [BRANCH NOTE]
|
|
//-- NPC: Race completed.
|
|
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: How'd I do?
|
|
if (response == "s_21")
|
|
{
|
|
//-- [NOTE]
|
|
if (event_perk_racing_condition__defaultCondition (player, npc))
|
|
{
|
|
//-- NPC: Your results are still being uploaded.
|
|
string_id message = new string_id (c_stringFile, "s_22");
|
|
utils.removeScriptVar (player, "conversation.event_perk_racing.branchId");
|
|
|
|
npcEndConversationWithMessage (player, message);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
}
|
|
|
|
return SCRIPT_DEFAULT;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
int event_perk_racing_handleBranch7 (obj_id player, obj_id npc, string_id response)
|
|
{
|
|
//-- [BRANCH NOTE]
|
|
//-- NPC: Greetings, I'm the coordinator for this race course. If you'd like to race the track, just let me know. How may I serve you today?
|
|
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: How do I race?
|
|
if (response == "s_e460e3d3")
|
|
{
|
|
//-- [NOTE]
|
|
if (event_perk_racing_condition__defaultCondition (player, npc))
|
|
{
|
|
//-- NPC: A series of waypoints will appear one after the other. Head to each waypoint as quickly as possible. When you arrive back here, talk to me again and I'll register your last time for this track.
|
|
string_id message = new string_id (c_stringFile, "s_4b4fb2b7");
|
|
int numberOfResponses = 0;
|
|
|
|
boolean hasResponse = false;
|
|
|
|
//-- PLAYER: How do I race?
|
|
boolean hasResponse0 = false;
|
|
if (event_perk_racing_condition__defaultCondition (player, npc))
|
|
{
|
|
++numberOfResponses;
|
|
hasResponse = true;
|
|
hasResponse0 = true;
|
|
}
|
|
|
|
//-- PLAYER: I'd like to see who holds the current record for this track.
|
|
boolean hasResponse1 = false;
|
|
if (event_perk_racing_condition__defaultCondition (player, npc))
|
|
{
|
|
++numberOfResponses;
|
|
hasResponse = true;
|
|
hasResponse1 = true;
|
|
}
|
|
|
|
//-- PLAYER: I'd like to give this track a try.
|
|
boolean hasResponse2 = false;
|
|
if (event_perk_racing_condition__defaultCondition (player, npc))
|
|
{
|
|
++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_e460e3d3");
|
|
|
|
if (hasResponse1)
|
|
responses [responseIndex++] = new string_id (c_stringFile, "s_2492930f");
|
|
|
|
if (hasResponse2)
|
|
responses [responseIndex++] = new string_id (c_stringFile, "s_dffdee4b");
|
|
|
|
utils.setScriptVar (player, "conversation.event_perk_racing.branchId", 7);
|
|
|
|
npcSpeak (player, message);
|
|
npcSetConversationResponses (player, responses);
|
|
}
|
|
else
|
|
{
|
|
utils.removeScriptVar (player, "conversation.event_perk_racing.branchId");
|
|
|
|
npcEndConversationWithMessage (player, message);
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
}
|
|
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: I'd like to see who holds the current record for this track.
|
|
if (response == "s_2492930f")
|
|
{
|
|
event_perk_racing_action_displayCurrentLeader (player, npc);
|
|
|
|
//-- [NOTE]
|
|
if (event_perk_racing_condition__defaultCondition (player, npc))
|
|
{
|
|
//-- NPC: Displaying current data...
|
|
string_id message = new string_id (c_stringFile, "s_371b3f4");
|
|
utils.removeScriptVar (player, "conversation.event_perk_racing.branchId");
|
|
|
|
npcEndConversationWithMessage (player, message);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
}
|
|
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: I'd like to give this track a try.
|
|
if (response == "s_dffdee4b")
|
|
{
|
|
//-- [NOTE]
|
|
if (event_perk_racing_condition__defaultCondition (player, npc))
|
|
{
|
|
//-- NPC: Get ready... I'll start the timer when you say go!
|
|
string_id message = new string_id (c_stringFile, "s_1cd82216");
|
|
int numberOfResponses = 0;
|
|
|
|
boolean hasResponse = false;
|
|
|
|
//-- PLAYER: GO!!!
|
|
boolean hasResponse0 = false;
|
|
if (event_perk_racing_condition__defaultCondition (player, npc))
|
|
{
|
|
++numberOfResponses;
|
|
hasResponse = true;
|
|
hasResponse0 = true;
|
|
}
|
|
|
|
//-- PLAYER: Uhh, wait a minute.
|
|
boolean hasResponse1 = false;
|
|
if (event_perk_racing_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_2528fad7");
|
|
|
|
if (hasResponse1)
|
|
responses [responseIndex++] = new string_id (c_stringFile, "s_262e8687");
|
|
|
|
utils.setScriptVar (player, "conversation.event_perk_racing.branchId", 10);
|
|
|
|
npcSpeak (player, message);
|
|
npcSetConversationResponses (player, responses);
|
|
}
|
|
else
|
|
{
|
|
utils.removeScriptVar (player, "conversation.event_perk_racing.branchId");
|
|
|
|
npcEndConversationWithMessage (player, message);
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
}
|
|
|
|
return SCRIPT_DEFAULT;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
int event_perk_racing_handleBranch8 (obj_id player, obj_id npc, string_id response)
|
|
{
|
|
//-- [BRANCH NOTE]
|
|
//-- NPC: A series of waypoints will appear one after the other. Head to each waypoint as quickly as possible. When you arrive back here, talk to me again and I'll register your last time for this track.
|
|
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: How do I race?
|
|
if (response == "s_e460e3d3")
|
|
{
|
|
//-- [NOTE]
|
|
if (event_perk_racing_condition__defaultCondition (player, npc))
|
|
{
|
|
//-- NPC: A series of waypoints will appear one after the other. Head to each waypoint as quickly as possible. When you arrive back here, talk to me again and I'll register your last time for this track.
|
|
string_id message = new string_id (c_stringFile, "s_4b4fb2b7");
|
|
int numberOfResponses = 0;
|
|
|
|
boolean hasResponse = false;
|
|
|
|
//-- PLAYER: How do I race?
|
|
boolean hasResponse0 = false;
|
|
if (event_perk_racing_condition__defaultCondition (player, npc))
|
|
{
|
|
++numberOfResponses;
|
|
hasResponse = true;
|
|
hasResponse0 = true;
|
|
}
|
|
|
|
//-- PLAYER: I'd like to see who holds the current record for this track.
|
|
boolean hasResponse1 = false;
|
|
if (event_perk_racing_condition__defaultCondition (player, npc))
|
|
{
|
|
++numberOfResponses;
|
|
hasResponse = true;
|
|
hasResponse1 = true;
|
|
}
|
|
|
|
//-- PLAYER: I'd like to give this track a try.
|
|
boolean hasResponse2 = false;
|
|
if (event_perk_racing_condition__defaultCondition (player, npc))
|
|
{
|
|
++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_e460e3d3");
|
|
|
|
if (hasResponse1)
|
|
responses [responseIndex++] = new string_id (c_stringFile, "s_2492930f");
|
|
|
|
if (hasResponse2)
|
|
responses [responseIndex++] = new string_id (c_stringFile, "s_dffdee4b");
|
|
|
|
utils.setScriptVar (player, "conversation.event_perk_racing.branchId", 7);
|
|
|
|
npcSpeak (player, message);
|
|
npcSetConversationResponses (player, responses);
|
|
}
|
|
else
|
|
{
|
|
utils.removeScriptVar (player, "conversation.event_perk_racing.branchId");
|
|
|
|
npcEndConversationWithMessage (player, message);
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
}
|
|
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: I'd like to see who holds the current record for this track.
|
|
if (response == "s_2492930f")
|
|
{
|
|
event_perk_racing_action_displayCurrentLeader (player, npc);
|
|
|
|
//-- [NOTE]
|
|
if (event_perk_racing_condition__defaultCondition (player, npc))
|
|
{
|
|
//-- NPC: Displaying current data...
|
|
string_id message = new string_id (c_stringFile, "s_371b3f4");
|
|
utils.removeScriptVar (player, "conversation.event_perk_racing.branchId");
|
|
|
|
npcEndConversationWithMessage (player, message);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
}
|
|
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: I'd like to give this track a try.
|
|
if (response == "s_dffdee4b")
|
|
{
|
|
//-- [NOTE]
|
|
if (event_perk_racing_condition__defaultCondition (player, npc))
|
|
{
|
|
//-- NPC: Get ready... I'll start the timer when you say go!
|
|
string_id message = new string_id (c_stringFile, "s_1cd82216");
|
|
int numberOfResponses = 0;
|
|
|
|
boolean hasResponse = false;
|
|
|
|
//-- PLAYER: GO!!!
|
|
boolean hasResponse0 = false;
|
|
if (event_perk_racing_condition__defaultCondition (player, npc))
|
|
{
|
|
++numberOfResponses;
|
|
hasResponse = true;
|
|
hasResponse0 = true;
|
|
}
|
|
|
|
//-- PLAYER: Uhh, wait a minute.
|
|
boolean hasResponse1 = false;
|
|
if (event_perk_racing_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_2528fad7");
|
|
|
|
if (hasResponse1)
|
|
responses [responseIndex++] = new string_id (c_stringFile, "s_262e8687");
|
|
|
|
utils.setScriptVar (player, "conversation.event_perk_racing.branchId", 10);
|
|
|
|
npcSpeak (player, message);
|
|
npcSetConversationResponses (player, responses);
|
|
}
|
|
else
|
|
{
|
|
utils.removeScriptVar (player, "conversation.event_perk_racing.branchId");
|
|
|
|
npcEndConversationWithMessage (player, message);
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
}
|
|
|
|
return SCRIPT_DEFAULT;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
int event_perk_racing_handleBranch10 (obj_id player, obj_id npc, string_id response)
|
|
{
|
|
//-- [BRANCH NOTE]
|
|
//-- NPC: Get ready... I'll start the timer when you say go!
|
|
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: GO!!!
|
|
if (response == "s_2528fad7")
|
|
{
|
|
event_perk_racing_action_startRace (player, npc);
|
|
|
|
//-- [NOTE]
|
|
if (event_perk_racing_condition__defaultCondition (player, npc))
|
|
{
|
|
//-- NPC: And they're off!
|
|
string_id message = new string_id (c_stringFile, "s_b2acc217");
|
|
utils.removeScriptVar (player, "conversation.event_perk_racing.branchId");
|
|
|
|
npcEndConversationWithMessage (player, message);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
}
|
|
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: Uhh, wait a minute.
|
|
if (response == "s_262e8687")
|
|
{
|
|
//-- [NOTE]
|
|
if (event_perk_racing_condition__defaultCondition (player, npc))
|
|
{
|
|
//-- NPC: No hurry. Let me know when you're ready.
|
|
string_id message = new string_id (c_stringFile, "s_c0918d6");
|
|
int numberOfResponses = 0;
|
|
|
|
boolean hasResponse = false;
|
|
|
|
//-- PLAYER: How do I race?
|
|
boolean hasResponse0 = false;
|
|
if (event_perk_racing_condition__defaultCondition (player, npc))
|
|
{
|
|
++numberOfResponses;
|
|
hasResponse = true;
|
|
hasResponse0 = true;
|
|
}
|
|
|
|
//-- PLAYER: I'd like to see who holds the current record for this track.
|
|
boolean hasResponse1 = false;
|
|
if (event_perk_racing_condition__defaultCondition (player, npc))
|
|
{
|
|
++numberOfResponses;
|
|
hasResponse = true;
|
|
hasResponse1 = true;
|
|
}
|
|
|
|
//-- PLAYER: I'd like to give this track a try.
|
|
boolean hasResponse2 = false;
|
|
if (event_perk_racing_condition__defaultCondition (player, npc))
|
|
{
|
|
++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_e460e3d3");
|
|
|
|
if (hasResponse1)
|
|
responses [responseIndex++] = new string_id (c_stringFile, "s_2492930f");
|
|
|
|
if (hasResponse2)
|
|
responses [responseIndex++] = new string_id (c_stringFile, "s_dffdee4b");
|
|
|
|
utils.setScriptVar (player, "conversation.event_perk_racing.branchId", 7);
|
|
|
|
npcSpeak (player, message);
|
|
npcSetConversationResponses (player, responses);
|
|
}
|
|
else
|
|
{
|
|
utils.removeScriptVar (player, "conversation.event_perk_racing.branchId");
|
|
|
|
npcEndConversationWithMessage (player, message);
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
}
|
|
|
|
return SCRIPT_DEFAULT;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
int event_perk_racing_handleBranch12 (obj_id player, obj_id npc, string_id response)
|
|
{
|
|
//-- [BRANCH NOTE]
|
|
//-- NPC: No hurry. Let me know when you're ready.
|
|
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: How do I race?
|
|
if (response == "s_e460e3d3")
|
|
{
|
|
//-- [NOTE]
|
|
if (event_perk_racing_condition__defaultCondition (player, npc))
|
|
{
|
|
//-- NPC: A series of waypoints will appear one after the other. Head to each waypoint as quickly as possible. When you arrive back here, talk to me again and I'll register your last time for this track.
|
|
string_id message = new string_id (c_stringFile, "s_4b4fb2b7");
|
|
int numberOfResponses = 0;
|
|
|
|
boolean hasResponse = false;
|
|
|
|
//-- PLAYER: How do I race?
|
|
boolean hasResponse0 = false;
|
|
if (event_perk_racing_condition__defaultCondition (player, npc))
|
|
{
|
|
++numberOfResponses;
|
|
hasResponse = true;
|
|
hasResponse0 = true;
|
|
}
|
|
|
|
//-- PLAYER: I'd like to see who holds the current record for this track.
|
|
boolean hasResponse1 = false;
|
|
if (event_perk_racing_condition__defaultCondition (player, npc))
|
|
{
|
|
++numberOfResponses;
|
|
hasResponse = true;
|
|
hasResponse1 = true;
|
|
}
|
|
|
|
//-- PLAYER: I'd like to give this track a try.
|
|
boolean hasResponse2 = false;
|
|
if (event_perk_racing_condition__defaultCondition (player, npc))
|
|
{
|
|
++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_e460e3d3");
|
|
|
|
if (hasResponse1)
|
|
responses [responseIndex++] = new string_id (c_stringFile, "s_2492930f");
|
|
|
|
if (hasResponse2)
|
|
responses [responseIndex++] = new string_id (c_stringFile, "s_dffdee4b");
|
|
|
|
utils.setScriptVar (player, "conversation.event_perk_racing.branchId", 7);
|
|
|
|
npcSpeak (player, message);
|
|
npcSetConversationResponses (player, responses);
|
|
}
|
|
else
|
|
{
|
|
utils.removeScriptVar (player, "conversation.event_perk_racing.branchId");
|
|
|
|
npcEndConversationWithMessage (player, message);
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
}
|
|
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: I'd like to see who holds the current record for this track.
|
|
if (response == "s_2492930f")
|
|
{
|
|
event_perk_racing_action_displayCurrentLeader (player, npc);
|
|
|
|
//-- [NOTE]
|
|
if (event_perk_racing_condition__defaultCondition (player, npc))
|
|
{
|
|
//-- NPC: Displaying current data...
|
|
string_id message = new string_id (c_stringFile, "s_371b3f4");
|
|
utils.removeScriptVar (player, "conversation.event_perk_racing.branchId");
|
|
|
|
npcEndConversationWithMessage (player, message);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
}
|
|
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: I'd like to give this track a try.
|
|
if (response == "s_dffdee4b")
|
|
{
|
|
//-- [NOTE]
|
|
if (event_perk_racing_condition__defaultCondition (player, npc))
|
|
{
|
|
//-- NPC: Get ready... I'll start the timer when you say go!
|
|
string_id message = new string_id (c_stringFile, "s_1cd82216");
|
|
int numberOfResponses = 0;
|
|
|
|
boolean hasResponse = false;
|
|
|
|
//-- PLAYER: GO!!!
|
|
boolean hasResponse0 = false;
|
|
if (event_perk_racing_condition__defaultCondition (player, npc))
|
|
{
|
|
++numberOfResponses;
|
|
hasResponse = true;
|
|
hasResponse0 = true;
|
|
}
|
|
|
|
//-- PLAYER: Uhh, wait a minute.
|
|
boolean hasResponse1 = false;
|
|
if (event_perk_racing_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_2528fad7");
|
|
|
|
if (hasResponse1)
|
|
responses [responseIndex++] = new string_id (c_stringFile, "s_262e8687");
|
|
|
|
utils.setScriptVar (player, "conversation.event_perk_racing.branchId", 10);
|
|
|
|
npcSpeak (player, message);
|
|
npcSetConversationResponses (player, responses);
|
|
}
|
|
else
|
|
{
|
|
utils.removeScriptVar (player, "conversation.event_perk_racing.branchId");
|
|
|
|
npcEndConversationWithMessage (player, message);
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
}
|
|
|
|
return SCRIPT_DEFAULT;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
// ======================================================================
|
|
// User Script Triggers
|
|
// ======================================================================
|
|
|
|
trigger OnInitialize ()
|
|
{
|
|
if ( isPlayer (self) )
|
|
detachScript(self, "conversation.event_perk_racing");
|
|
|
|
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.event_perk_racing");
|
|
|
|
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 (!event_perk_racing_condition_partOfStory (player, npc))
|
|
{
|
|
//-- NPC: Greetings, I'm the coordinator for this race course. You are not authorized to participate. Thank you.
|
|
string_id message = new string_id (c_stringFile, "s_17");
|
|
int numberOfResponses = 0;
|
|
|
|
boolean hasResponse = false;
|
|
|
|
//-- PLAYER: How do I get authorization?
|
|
boolean hasResponse0 = false;
|
|
if (event_perk_racing_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.event_perk_racing.branchId", 1);
|
|
|
|
npcStartConversation (player, npc, "event_perk_racing", message, responses);
|
|
}
|
|
else
|
|
{
|
|
chat.chat (npc, player, message);
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//-- [NOTE]
|
|
if (event_perk_racing_condition_isRacing (player, npc))
|
|
{
|
|
//-- NPC: The clock is ticking, get moving!
|
|
string_id message = new string_id (c_stringFile, "s_6a5b9858");
|
|
int numberOfResponses = 0;
|
|
|
|
boolean hasResponse = false;
|
|
|
|
//-- PLAYER: I need to abort this race.
|
|
boolean hasResponse0 = false;
|
|
if (event_perk_racing_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_d900d1be");
|
|
|
|
utils.setScriptVar (player, "conversation.event_perk_racing.branchId", 3);
|
|
|
|
npcStartConversation (player, npc, "event_perk_racing", message, responses);
|
|
}
|
|
else
|
|
{
|
|
chat.chat (npc, player, message);
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//-- [NOTE]
|
|
if (event_perk_racing_condition_hasLastTime (player, npc))
|
|
{
|
|
//-- NPC: Race completed.
|
|
string_id message = new string_id (c_stringFile, "s_891e1f6");
|
|
int numberOfResponses = 0;
|
|
|
|
boolean hasResponse = false;
|
|
|
|
//-- PLAYER: How'd I do?
|
|
boolean hasResponse0 = false;
|
|
if (event_perk_racing_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_21");
|
|
|
|
utils.setScriptVar (player, "conversation.event_perk_racing.branchId", 5);
|
|
|
|
npcStartConversation (player, npc, "event_perk_racing", message, responses);
|
|
}
|
|
else
|
|
{
|
|
chat.chat (npc, player, message);
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//-- [NOTE]
|
|
if (event_perk_racing_condition__defaultCondition (player, npc))
|
|
{
|
|
//-- NPC: Greetings, I'm the coordinator for this race course. If you'd like to race the track, just let me know. How may I serve you today?
|
|
string_id message = new string_id (c_stringFile, "s_ac51e630");
|
|
int numberOfResponses = 0;
|
|
|
|
boolean hasResponse = false;
|
|
|
|
//-- PLAYER: How do I race?
|
|
boolean hasResponse0 = false;
|
|
if (event_perk_racing_condition__defaultCondition (player, npc))
|
|
{
|
|
++numberOfResponses;
|
|
hasResponse = true;
|
|
hasResponse0 = true;
|
|
}
|
|
|
|
//-- PLAYER: I'd like to see who holds the current record for this track.
|
|
boolean hasResponse1 = false;
|
|
if (event_perk_racing_condition__defaultCondition (player, npc))
|
|
{
|
|
++numberOfResponses;
|
|
hasResponse = true;
|
|
hasResponse1 = true;
|
|
}
|
|
|
|
//-- PLAYER: I'd like to give this track a try.
|
|
boolean hasResponse2 = false;
|
|
if (event_perk_racing_condition__defaultCondition (player, npc))
|
|
{
|
|
++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_e460e3d3");
|
|
|
|
if (hasResponse1)
|
|
responses [responseIndex++] = new string_id (c_stringFile, "s_2492930f");
|
|
|
|
if (hasResponse2)
|
|
responses [responseIndex++] = new string_id (c_stringFile, "s_dffdee4b");
|
|
|
|
utils.setScriptVar (player, "conversation.event_perk_racing.branchId", 7);
|
|
|
|
npcStartConversation (player, npc, "event_perk_racing", message, responses);
|
|
}
|
|
else
|
|
{
|
|
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 != "event_perk_racing")
|
|
return SCRIPT_CONTINUE;
|
|
|
|
obj_id npc = self;
|
|
|
|
int branchId = utils.getIntScriptVar (player, "conversation.event_perk_racing.branchId");
|
|
|
|
if (branchId == 1 && event_perk_racing_handleBranch1 (player, npc, response) == SCRIPT_CONTINUE)
|
|
return SCRIPT_CONTINUE;
|
|
|
|
if (branchId == 3 && event_perk_racing_handleBranch3 (player, npc, response) == SCRIPT_CONTINUE)
|
|
return SCRIPT_CONTINUE;
|
|
|
|
if (branchId == 5 && event_perk_racing_handleBranch5 (player, npc, response) == SCRIPT_CONTINUE)
|
|
return SCRIPT_CONTINUE;
|
|
|
|
if (branchId == 7 && event_perk_racing_handleBranch7 (player, npc, response) == SCRIPT_CONTINUE)
|
|
return SCRIPT_CONTINUE;
|
|
|
|
if (branchId == 8 && event_perk_racing_handleBranch8 (player, npc, response) == SCRIPT_CONTINUE)
|
|
return SCRIPT_CONTINUE;
|
|
|
|
if (branchId == 10 && event_perk_racing_handleBranch10 (player, npc, response) == SCRIPT_CONTINUE)
|
|
return SCRIPT_CONTINUE;
|
|
|
|
if (branchId == 12 && event_perk_racing_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.event_perk_racing.branchId");
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
// ======================================================================
|
|
|