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

623 lines
18 KiB
Plaintext

// ======================================================================
//
// npe_runequest.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.groundquests;
include library.npe;
include library.utils;
// ======================================================================
// Script Constants
// ======================================================================
string c_stringFile = "conversation/npe_runequest";
// ======================================================================
// Script Conditions
// ======================================================================
boolean npe_runequest_condition__defaultCondition (obj_id player, obj_id npc)
{
return true;
}
// ----------------------------------------------------------------------
boolean npe_runequest_condition_isTaskActiveRune (obj_id player, obj_id npc)
{
return (groundquests.isTaskActive(player, "npe_runequest", "runes") &&
!groundquests.hasCompletedQuest(player, "npe_runequest"));
}
// ----------------------------------------------------------------------
boolean npe_runequest_condition_hasCompletedRuneTask (obj_id player, obj_id npc)
{
return (groundquests.hasCompletedTask(player, "npe_runequest", "runes") &&
!groundquests.hasCompletedQuest(player, "npe_runequest"));
}
// ----------------------------------------------------------------------
boolean npe_runequest_condition_hasCompletedQuestRune (obj_id player, obj_id npc)
{
return groundquests.hasCompletedQuest(player, "npe_runequest");
}
// ----------------------------------------------------------------------
boolean npe_runequest_condition_hasTemplate (obj_id player, obj_id npc)
{
return hasObjVar(player, "npe.finishedTemplate");
}
// ======================================================================
// Script Actions
// ======================================================================
void npe_runequest_action_grantRuneQuest (obj_id player, obj_id npc)
{
// Apply the first quest to the player here
groundquests.grantQuest(player, "npe_runequest");
if(!hasObjVar(player, npe.QUEST_REWORK_VAR))
setObjVar(player, npe.QUEST_REWORK_VAR, npe.QUEST_ENUMERATION);
}
// ----------------------------------------------------------------------
void npe_runequest_action_giveRuneSignal (obj_id player, obj_id npc)
{
groundquests.sendSignal(player, "runesignal");
}
// ----------------------------------------------------------------------
void npe_runequest_action_groupPopUp (obj_id player, obj_id npc)
{
messageTo(player, "groupPopUp1", null, 0, false);
messageTo(player, "groupPopUp2", null, 5, false);
}
// ======================================================================
// Script %TO Tokens
// ======================================================================
// ======================================================================
// Script %DI Tokens
// ======================================================================
// ======================================================================
// Script %DF Tokens
// ======================================================================
// ======================================================================
// handleBranch<n> Functions
// ======================================================================
int npe_runequest_handleBranch2 (obj_id player, obj_id npc, string_id response)
{
//-- [BRANCH NOTE]
//-- NPC: Did you get them? Did you find them all?
//-- [RESPONSE NOTE]
//-- PLAYER: Yes, I found them all. Here's your paper.
if (response == "s_15")
{
//-- [NOTE]
if (npe_runequest_condition__defaultCondition (player, npc))
{
//-- NPC: Oh, thank you! Let me take a look at them. Yes, perfect! Here. Take this as your reward for helping me. I'm so grateful!
string_id message = new string_id (c_stringFile, "s_16");
int numberOfResponses = 0;
boolean hasResponse = false;
//-- PLAYER: Thank you.
boolean hasResponse0 = false;
if (npe_runequest_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_17");
utils.setScriptVar (player, "conversation.npe_runequest.branchId", 3);
npcSpeak (player, message);
npcSetConversationResponses (player, responses);
}
else
{
utils.removeScriptVar (player, "conversation.npe_runequest.branchId");
npcEndConversationWithMessage (player, message);
}
return SCRIPT_CONTINUE;
}
}
return SCRIPT_DEFAULT;
}
// ----------------------------------------------------------------------
int npe_runequest_handleBranch3 (obj_id player, obj_id npc, string_id response)
{
//-- [BRANCH NOTE]
//-- NPC: Oh, thank you! Let me take a look at them. Yes, perfect! Here. Take this as your reward for helping me. I'm so grateful!
//-- [RESPONSE NOTE]
//-- PLAYER: Thank you.
if (response == "s_17")
{
doAnimationAction (player, "bow");
//-- [NOTE]
if (npe_runequest_condition__defaultCondition (player, npc))
{
doAnimationAction (npc, "wave1");
npe_runequest_action_giveRuneSignal (player, npc);
//-- NPC: No thank you.
string_id message = new string_id (c_stringFile, "s_18");
utils.removeScriptVar (player, "conversation.npe_runequest.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
}
return SCRIPT_DEFAULT;
}
// ----------------------------------------------------------------------
int npe_runequest_handleBranch5 (obj_id player, obj_id npc, string_id response)
{
//-- [BRANCH NOTE]
//-- NPC: Did you find all of the runes?
//-- [RESPONSE NOTE]
//-- PLAYER: Not yet. I have to look for them still.
if (response == "s_14")
{
//-- [NOTE]
if (npe_runequest_condition__defaultCondition (player, npc))
{
//-- NPC: Okay. Well, good luck to you! I hope you come back soon!
string_id message = new string_id (c_stringFile, "s_20");
utils.removeScriptVar (player, "conversation.npe_runequest.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
}
return SCRIPT_DEFAULT;
}
// ----------------------------------------------------------------------
int npe_runequest_handleBranch7 (obj_id player, obj_id npc, string_id response)
{
//-- [BRANCH NOTE]
//-- NPC: Oh! I didn't see you there. Nice to meet you. You know, this place is rather dangerous. You should be careful.
//-- [RESPONSE NOTE]
//-- PLAYER: I will be. Why are you here?
if (response == "s_24")
{
//-- [NOTE]
if (npe_runequest_condition__defaultCondition (player, npc))
{
//-- NPC: I guess I don't seem to be the adventuring type, hm? I'm an archaeologist. Within this haunted place, there are runes that I'm quite interested in. They're written on the altars of the Rak'qua tribe. I just can't seem to get to them on my own.
string_id message = new string_id (c_stringFile, "s_26");
int numberOfResponses = 0;
boolean hasResponse = false;
//-- PLAYER: Maybe I can help somehow.
boolean hasResponse0 = false;
if (npe_runequest_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.npe_runequest.branchId", 8);
npcSpeak (player, message);
npcSetConversationResponses (player, responses);
}
else
{
utils.removeScriptVar (player, "conversation.npe_runequest.branchId");
npcEndConversationWithMessage (player, message);
}
return SCRIPT_CONTINUE;
}
}
return SCRIPT_DEFAULT;
}
// ----------------------------------------------------------------------
int npe_runequest_handleBranch8 (obj_id player, obj_id npc, string_id response)
{
//-- [BRANCH NOTE]
//-- NPC: I guess I don't seem to be the adventuring type, hm? I'm an archaeologist. Within this haunted place, there are runes that I'm quite interested in. They're written on the altars of the Rak'qua tribe. I just can't seem to get to them on my own.
//-- [RESPONSE NOTE]
//-- PLAYER: Maybe I can help somehow.
if (response == "s_28")
{
//-- [NOTE]
if (npe_runequest_condition__defaultCondition (player, npc))
{
//-- NPC: Oh would you? Here. Take this. You can trace over the runes onto this sheet of paper. I need eight rubbings, but I only know the locations of six. You will have to find the last two on your own. Will you still do it?
string_id message = new string_id (c_stringFile, "s_30");
int numberOfResponses = 0;
boolean hasResponse = false;
//-- PLAYER: I'll do it.
boolean hasResponse0 = false;
if (npe_runequest_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_32");
utils.setScriptVar (player, "conversation.npe_runequest.branchId", 9);
npcSpeak (player, message);
npcSetConversationResponses (player, responses);
}
else
{
utils.removeScriptVar (player, "conversation.npe_runequest.branchId");
npcEndConversationWithMessage (player, message);
}
return SCRIPT_CONTINUE;
}
}
return SCRIPT_DEFAULT;
}
// ----------------------------------------------------------------------
int npe_runequest_handleBranch9 (obj_id player, obj_id npc, string_id response)
{
//-- [BRANCH NOTE]
//-- NPC: Oh would you? Here. Take this. You can trace over the runes onto this sheet of paper. I need eight rubbings, but I only know the locations of six. You will have to find the last two on your own. Will you still do it?
//-- [RESPONSE NOTE]
//-- PLAYER: I'll do it.
if (response == "s_32")
{
npe_runequest_action_groupPopUp (player, npc);
//-- [NOTE]
if (npe_runequest_condition__defaultCondition (player, npc))
{
npe_runequest_action_grantRuneQuest (player, npc);
//-- NPC: Great! I'll wait for you eagerly.
string_id message = new string_id (c_stringFile, "s_34");
utils.removeScriptVar (player, "conversation.npe_runequest.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
}
return SCRIPT_DEFAULT;
}
// ----------------------------------------------------------------------
// ======================================================================
// User Script Triggers
// ======================================================================
trigger OnInitialize ()
{
if ((!isMob (self)) || (isPlayer (self)))
detachScript(self, "conversation.npe_runequest");
setCondition (self, CONDITION_CONVERSABLE);
setName( self, "Aquillia (Archaeologist)");
//setCondition (self, CONDITION_INTERESTING);
setInvulnerable (self, true);
return SCRIPT_CONTINUE;
}
trigger OnAttach ()
{
setCondition (self, CONDITION_CONVERSABLE);
setName( self, "Aquillia (Archaeologist)");
//setCondition (self, CONDITION_INTERESTING);
setInvulnerable (self, true);
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.npe_runequest");
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 (npe_runequest_condition_hasCompletedQuestRune (player, npc))
{
//-- NPC: Those runes you found for me did wonders for my career! I can't repay you enough!
string_id message = new string_id (c_stringFile, "s_12");
chat.chat (npc, player, message);
return SCRIPT_CONTINUE;
}
//-- [NOTE]
if (npe_runequest_condition_hasCompletedRuneTask (player, npc))
{
doAnimationAction (npc, "implore");
//-- NPC: Did you get them? Did you find them all?
string_id message = new string_id (c_stringFile, "s_11");
int numberOfResponses = 0;
boolean hasResponse = false;
//-- PLAYER: Yes, I found them all. Here's your paper.
boolean hasResponse0 = false;
if (npe_runequest_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_15");
utils.setScriptVar (player, "conversation.npe_runequest.branchId", 2);
npcStartConversation (player, npc, "npe_runequest", message, responses);
}
else
{
chat.chat (npc, player, message);
}
return SCRIPT_CONTINUE;
}
//-- [NOTE]
if (npe_runequest_condition_isTaskActiveRune (player, npc))
{
doAnimationAction (npc, "implore");
//-- NPC: Did you find all of the runes?
string_id message = new string_id (c_stringFile, "s_10");
int numberOfResponses = 0;
boolean hasResponse = false;
//-- PLAYER: Not yet. I have to look for them still.
boolean hasResponse0 = false;
if (npe_runequest_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.npe_runequest.branchId", 5);
npcStartConversation (player, npc, "npe_runequest", message, responses);
}
else
{
chat.chat (npc, player, message);
}
return SCRIPT_CONTINUE;
}
//-- [NOTE]
if (npe_runequest_condition_hasTemplate (player, npc))
{
doAnimationAction (npc, "bow");
//-- NPC: Oh! I didn't see you there. Nice to meet you. You know, this place is rather dangerous. You should be careful.
string_id message = new string_id (c_stringFile, "s_22");
int numberOfResponses = 0;
boolean hasResponse = false;
//-- PLAYER: I will be. Why are you here?
boolean hasResponse0 = false;
if (npe_runequest_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.npe_runequest.branchId", 7);
npcStartConversation (player, npc, "npe_runequest", message, responses);
}
else
{
chat.chat (npc, player, message);
}
return SCRIPT_CONTINUE;
}
//-- [NOTE]
if (npe_runequest_condition__defaultCondition (player, npc))
{
//-- NPC: Finish your training, then come back to see me.
string_id message = new string_id (c_stringFile, "s_36");
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 != "npe_runequest")
return SCRIPT_CONTINUE;
obj_id npc = self;
int branchId = utils.getIntScriptVar (player, "conversation.npe_runequest.branchId");
if (branchId == 2 && npe_runequest_handleBranch2 (player, npc, response) == SCRIPT_CONTINUE)
return SCRIPT_CONTINUE;
if (branchId == 3 && npe_runequest_handleBranch3 (player, npc, response) == SCRIPT_CONTINUE)
return SCRIPT_CONTINUE;
if (branchId == 5 && npe_runequest_handleBranch5 (player, npc, response) == SCRIPT_CONTINUE)
return SCRIPT_CONTINUE;
if (branchId == 7 && npe_runequest_handleBranch7 (player, npc, response) == SCRIPT_CONTINUE)
return SCRIPT_CONTINUE;
if (branchId == 8 && npe_runequest_handleBranch8 (player, npc, response) == SCRIPT_CONTINUE)
return SCRIPT_CONTINUE;
if (branchId == 9 && npe_runequest_handleBranch9 (player, npc, response) == SCRIPT_CONTINUE)
return SCRIPT_CONTINUE;
chat.chat (npc, "Error: Fell through all branches and responses for OnNpcConversationResponse.");
utils.removeScriptVar (player, "conversation.npe_runequest.branchId");
return SCRIPT_CONTINUE;
}
// ======================================================================