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

387 lines
12 KiB
Plaintext

// ======================================================================
//
// village_elder.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.utils;
// ======================================================================
// Script Constants
// ======================================================================
string c_stringFile = "conversation/village_elder";
// ======================================================================
// Script Conditions
// ======================================================================
boolean village_elder_condition__defaultCondition (obj_id player, obj_id npc)
{
return true;
}
// ----------------------------------------------------------------------
boolean village_elder_condition_needCrystal (obj_id player, obj_id npc)
{
if (utils.playerHasItemByTemplateInBankOrInventory(player, "object/tangible/loot/quest/force_sensitive/force_crystal.iff"))
{
return false;
}
return true;
}
// ======================================================================
// Script Actions
// ======================================================================
void village_elder_action_giveCrystal (obj_id player, obj_id npc)
{
createObjectInInventoryAllowOverload("object/tangible/loot/quest/force_sensitive/force_crystal.iff", player);
return;
}
// ======================================================================
// Script %TO Tokens
// ======================================================================
// ======================================================================
// Script %DI Tokens
// ======================================================================
// ======================================================================
// Script %DF Tokens
// ======================================================================
// ======================================================================
// User Script Triggers
// ======================================================================
trigger OnInitialize ()
{
if ((!isMob (self)) || (isPlayer (self)))
detachScript(self, "npc.conversation.village_elder");
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.village_elder");
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)
{
if (ai_lib.isInCombat (self) || ai_lib.isInCombat (player))
return SCRIPT_OVERRIDE;
//-- [NOTE]
if (village_elder_condition__defaultCondition (player, self))
{
//-- NPC: Hello, I am Elgin Seropf, elder of this village. What brings you to our home?
string_id message = new string_id (c_stringFile, "s_688b65");
int numberOfResponses = 0;
boolean hasResponse = false;
//-- PLAYER: I was sent here by an old man that seemed to think I had some kind of destiny here.
boolean hasResponse0 = false;
if (village_elder_condition__defaultCondition (player, self))
{
++numberOfResponses;
hasResponse = true;
hasResponse0 = true;
}
//-- PLAYER: I seem to have misplaced my Force crystal, may I have another?
boolean hasResponse1 = false;
if (village_elder_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_fb95fc83");
if (hasResponse1)
responses [responseIndex++] = new string_id (c_stringFile, "s_85e90557");
setObjVar (player, "conversation.village_elder.branchId", 1);
npcStartConversation (player, self, "village_elder", message, responses);
}
else
{
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 != "village_elder")
return SCRIPT_CONTINUE;
int branchId = getIntObjVar (player, "conversation.village_elder.branchId");
//-- [BRANCH NOTE]
//-- NPC: Hello, I am Elgin Seropf, elder of this village. What brings you to our home?
//-- [RESPONSE NOTE]
//-- PLAYER: I was sent here by an old man that seemed to think I had some kind of destiny here.
if (branchId == 1 && response == "s_fb95fc83")
{
//-- [NOTE]
if (village_elder_condition__defaultCondition (player, self))
{
//-- NPC: Yes, you might at that. Do you have any skills we might be in need of?
string_id message = new string_id (c_stringFile, "s_4dfe3937");
int numberOfResponses = 0;
boolean hasResponse = false;
//-- PLAYER: I can help provide security for your village.
boolean hasResponse0 = false;
if (village_elder_condition__defaultCondition (player, self))
{
++numberOfResponses;
hasResponse = true;
hasResponse0 = true;
}
//-- PLAYER: I am a medic, I was wondering if you needed any assistance.
boolean hasResponse1 = false;
if (village_elder_condition__defaultCondition (player, self))
{
++numberOfResponses;
hasResponse = true;
hasResponse1 = true;
}
//-- PLAYER: I am a craftsman. I would be able to help you rebuild some of this.
boolean hasResponse2 = false;
if (village_elder_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_a9e1f5c2");
if (hasResponse1)
responses [responseIndex++] = new string_id (c_stringFile, "s_d931cb17");
if (hasResponse2)
responses [responseIndex++] = new string_id (c_stringFile, "s_efefc64f");
setObjVar (player, "conversation.village_elder.branchId", 2);
npcSpeak (player, message);
npcSetConversationResponses (player, responses);
}
else
{
removeObjVar (player, "conversation.village_elder.branchId");
npcSpeak (player, message);
npcEndConversation (player);
}
return SCRIPT_CONTINUE;
}
chat.chat (self, "Error: All conditions for OnNpcConversationResponse for branch 'Hello, I am Elgin Seropf, elder of this village. What brings you to our home?' were false.");
return SCRIPT_CONTINUE;
}
//-- [BRANCH NOTE]
//-- NPC: Hello, I am Elgin Seropf, elder of this village. What brings you to our home?
//-- [RESPONSE NOTE]
//-- PLAYER: I seem to have misplaced my Force crystal, may I have another?
if (branchId == 1 && response == "s_85e90557")
{
//-- [NOTE]
if (village_elder_condition_needCrystal (player, self))
{
village_elder_action_giveCrystal (player, self);
//-- NPC: Here you are. Remember you may use the crystal to view your progress.
string_id message = new string_id (c_stringFile, "s_bdd3bae5");
removeObjVar (player, "conversation.village_elder.branchId");
npcSpeak (player, message);
npcEndConversation (player);
return SCRIPT_CONTINUE;
}
//-- [NOTE]
if (!village_elder_condition_needCrystal (player, self))
{
//-- NPC: I sense you already have a crystal and do not need another.
string_id message = new string_id (c_stringFile, "s_199fe2af");
removeObjVar (player, "conversation.village_elder.branchId");
npcSpeak (player, message);
npcEndConversation (player);
return SCRIPT_CONTINUE;
}
chat.chat (self, "Error: All conditions for OnNpcConversationResponse for branch 'Hello, I am Elgin Seropf, elder of this village. What brings you to our home?' were false.");
return SCRIPT_CONTINUE;
}
//-- [BRANCH NOTE]
//-- NPC: Yes, you might at that. Do you have any skills we might be in need of?
//-- [RESPONSE NOTE]
//-- PLAYER: I can help provide security for your village.
if (branchId == 2 && response == "s_a9e1f5c2")
{
//-- [NOTE]
if (village_elder_condition__defaultCondition (player, self))
{
//-- NPC: You would be looking for Captain Sarguillo. He is about 30 meters to the Southeast from here.
string_id message = new string_id (c_stringFile, "s_7d804cc7");
removeObjVar (player, "conversation.village_elder.branchId");
npcSpeak (player, message);
npcEndConversation (player);
return SCRIPT_CONTINUE;
}
chat.chat (self, "Error: All conditions for OnNpcConversationResponse for branch 'Yes, you might at that. Do you have any skills we might be in need of?' were false.");
return SCRIPT_CONTINUE;
}
//-- [BRANCH NOTE]
//-- NPC: Yes, you might at that. Do you have any skills we might be in need of?
//-- [RESPONSE NOTE]
//-- PLAYER: I am a medic, I was wondering if you needed any assistance.
if (branchId == 2 && response == "s_d931cb17")
{
//-- [NOTE]
if (village_elder_condition__defaultCondition (player, self))
{
//-- NPC: Ahh, you are looking for Fyona our doctor. She is right over there under the medic tent.
string_id message = new string_id (c_stringFile, "s_ba08eb80");
removeObjVar (player, "conversation.village_elder.branchId");
npcSpeak (player, message);
npcEndConversation (player);
return SCRIPT_CONTINUE;
}
chat.chat (self, "Error: All conditions for OnNpcConversationResponse for branch 'Yes, you might at that. Do you have any skills we might be in need of?' were false.");
return SCRIPT_CONTINUE;
}
//-- [BRANCH NOTE]
//-- NPC: Yes, you might at that. Do you have any skills we might be in need of?
//-- [RESPONSE NOTE]
//-- PLAYER: I am a craftsman. I would be able to help you rebuild some of this.
if (branchId == 2 && response == "s_efefc64f")
{
//-- [NOTE]
if (village_elder_condition__defaultCondition (player, self))
{
//-- NPC: You will want to visit out Chief Engineer. He lives along the south wall near out communications and sensor array.
string_id message = new string_id (c_stringFile, "s_7f56b89c");
removeObjVar (player, "conversation.village_elder.branchId");
npcSpeak (player, message);
npcEndConversation (player);
return SCRIPT_CONTINUE;
}
chat.chat (self, "Error: All conditions for OnNpcConversationResponse for branch 'Yes, you might at that. Do you have any skills we might be in need of?' were false.");
return SCRIPT_CONTINUE;
}
chat.chat (self, "Error: Fell through all branches and responses for OnNpcConversationResponse.");
removeObjVar (player, "conversation.village_elder.branchId");
return SCRIPT_CONTINUE;
}
// ======================================================================