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

264 lines
7.8 KiB
Plaintext

// ======================================================================
//
// sean_contact.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/sean_contact";
// ======================================================================
// Script Conditions
// ======================================================================
boolean sean_contact_condition__defaultCondition (obj_id player, obj_id npc)
{
return true;
}
// ----------------------------------------------------------------------
boolean sean_contact_condition_hasItem (obj_id player, obj_id npc)
{
if ( hasObjVar(npc, "bestine.electionWinner") )
{
string winner = getStringObjVar(npc, "bestine.electionWinner");
if ( (winner == "Sean") || (winner == "sean") )
{
if ( utils.playerHasItemByTemplate(player, "object/tangible/loot/quest/sean_history_disk.iff") )
return true;
}
}
return false;
}
// ----------------------------------------------------------------------
boolean sean_contact_condition_notInoffice (obj_id player, obj_id npc)
{
if ( hasObjVar(npc, "bestine.electionWinner") )
{
string winner = getStringObjVar(npc, "bestine.electionWinner");
if ( (winner != "Sean") && (winner != "sean") )
return true;
}
return false;
}
// ======================================================================
// Script Actions
// ======================================================================
void sean_contact_action__defaultAction (obj_id player, obj_id npc)
{
}
// ----------------------------------------------------------------------
void sean_contact_action_Destroyed (obj_id player, obj_id npc)
{
obj_id disk = utils.getItemPlayerHasByTemplate(player, "object/tangible/loot/quest/sean_history_disk.iff");
if ( isIdValid(disk) )
{
destroyObject(disk);
setObjVar( player, "bestine.destroyed", true);
removeObjVar( player, "bestine.mess");
obj_id waypoint = getObjIdObjVar(player, "bestine.contactWaypoint");
if ( isIdValid(waypoint) )
destroyWaypointInDatapad(waypoint, player);
removeObjVar(player, "bestine.contactWaypoint");
}
}
// ----------------------------------------------------------------------
void sean_contact_action_cleanUpObjVars (obj_id player, obj_id npc)
{
if ( !utils.playerHasItemByTemplate(player, "object/tangible/loot/quest/sean_history_disk.iff") )
{
if ( hasObjVar(player, "bestine.mess") )
removeObjVar(player, "bestine.mess");
if ( hasObjVar(player, "bestine.itemfound") )
removeObjVar(player, "bestine.itemfound");
}
}
// ======================================================================
// User Script Triggers
// ======================================================================
trigger OnInitialize ()
{
if ((!isMob (self)) || (isPlayer (self)))
detachScript(self, "npc.conversation.sean_contact");
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.sean_contact");
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 the required item and sean is in office
if (sean_contact_condition_hasItem (player, self))
{
//-- NPC: So he's got himself into more trouble I see. I just heard the news. Let me have that disk. He'll be grateful to you.
string_id message = new string_id (c_stringFile, "s_1e325cde");
int numberOfResponses = 0;
boolean hasResponse = false;
//-- PLAYER: Here you go.
boolean hasResponse0 = false;
if (sean_contact_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_829888a9");
setObjVar (player, "conversation.sean_contact.branchId", 1);
npcStartConversation (player, self, "sean_contact", message, responses);
}
else
{
chat.chat (self, message);
}
return SCRIPT_CONTINUE;
}
//-- [NOTE] sean is not in office
if (sean_contact_condition_notInoffice (player, self))
{
sean_contact_action_cleanUpObjVars (player, self);
//-- NPC: Elections, Sand People raids, museums! So many new things are happening in Bestine. Listen to the townsfolk. They may have interesting things to say.
string_id message = new string_id (c_stringFile, "s_f1baf7f");
chat.chat (self, message);
return SCRIPT_CONTINUE;
}
//-- [NOTE] default: sean is in office, but player does not have item
if (sean_contact_condition__defaultCondition (player, self))
{
sean_contact_action_cleanUpObjVars (player, self);
//-- NPC: I'm waiting for someone else. I've heard, however, that Sean Trenwell is in need of assistance at the capitol.
string_id message = new string_id (c_stringFile, "s_c17cd032");
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 != "sean_contact")
return SCRIPT_CONTINUE;
int branchId = getIntObjVar (player, "conversation.sean_contact.branchId");
//-- [BRANCH NOTE] player has the required item and sean is in office
//-- NPC: So he's got himself into more trouble I see. I just heard the news. Let me have that disk. He'll be grateful to you.
//-- [RESPONSE NOTE]
//-- PLAYER: Here you go.
if (branchId == 1 && response == "s_829888a9")
{
//-- [NOTE]
if (sean_contact_condition__defaultCondition (player, self))
{
sean_contact_action_Destroyed (player, self);
//-- NPC: It's finished. Go tell him the good news. He and his career are safe.
string_id message = new string_id (c_stringFile, "s_3e134731");
removeObjVar (player, "conversation.sean_contact.branchId");
npcSpeak (player, message);
npcEndConversation (player);
return SCRIPT_CONTINUE;
}
chat.chat (self, "Error: All conditions for OnNpcConversationResponse for branch 'So he's got himself into more trouble I see. I just heard the news. Let me have that disk. He'll be grateful to you.' were false.");
return SCRIPT_CONTINUE;
}
chat.chat (self, "Error: Fell through all branches and responses for OnNpcConversationResponse.");
removeObjVar (player, "conversation.sean_contact.branchId");
return SCRIPT_CONTINUE;
}
// ======================================================================