mirror of
https://github.com/SWG-Source/dsrc.git
synced 2026-08-01 01:15:59 -04:00
264 lines
7.3 KiB
Plaintext
264 lines
7.3 KiB
Plaintext
// ======================================================================
|
|
//
|
|
// death_watch_treadwell.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/death_watch_treadwell";
|
|
|
|
// ======================================================================
|
|
// Script Conditions
|
|
// ======================================================================
|
|
|
|
boolean death_watch_treadwell_condition__defaultCondition (obj_id player, obj_id npc)
|
|
{
|
|
return true;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
boolean death_watch_treadwell_condition_hasBattery (obj_id player, obj_id npc)
|
|
{
|
|
obj_id[] objContents = utils.getContents(player, true);
|
|
|
|
if( objContents != null )
|
|
{
|
|
for( int intI = 0; intI<objContents.length; intI++ )
|
|
{
|
|
string strItemTemplate = getTemplateName(objContents[intI]);
|
|
{
|
|
if( strItemTemplate=="object/tangible/dungeon/death_watch_bunker/drill_battery.iff")
|
|
return true;
|
|
}
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
// ======================================================================
|
|
// Script Actions
|
|
// ======================================================================
|
|
|
|
void death_watch_treadwell_action__defaultAction (obj_id player, obj_id npc)
|
|
{
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
void death_watch_treadwell_action_fixBattery (obj_id player, obj_id npc)
|
|
{
|
|
playClientEffectLoc(player, "clienteffect/treadwell_chatter_02.cef", getLocation(npc), 0f);
|
|
dictionary params = new dictionary();
|
|
params.put("player", player);
|
|
messageTo(npc, "handleCleanBattery", params, 1f, false);
|
|
return;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
void death_watch_treadwell_action_vocalize_01 (obj_id player, obj_id npc)
|
|
{
|
|
playClientEffectLoc(player, "clienteffect/treadwell_chatter_01.cef", getLocation(npc), 0f);
|
|
return;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
void death_watch_treadwell_action_vocalize_02 (obj_id player, obj_id npc)
|
|
{
|
|
playClientEffectLoc(player, "clienteffect/treadwell_chatter_02.cef", getLocation(npc), 0f);
|
|
return;
|
|
}
|
|
|
|
// ======================================================================
|
|
// User Script Triggers
|
|
// ======================================================================
|
|
|
|
trigger OnInitialize ()
|
|
{
|
|
if ((!isMob (self)) || (isPlayer (self)))
|
|
detachScript(self, "npc.conversation.death_watch_treadwell");
|
|
|
|
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.death_watch_treadwell");
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
// ======================================================================
|
|
// Script Triggers
|
|
// ======================================================================
|
|
|
|
trigger OnStartNpcConversation (obj_id player)
|
|
{
|
|
if (ai_lib.isInCombat (self) || ai_lib.isInCombat (player))
|
|
return SCRIPT_OVERRIDE;
|
|
|
|
//-- [NOTE]
|
|
if (death_watch_treadwell_condition__defaultCondition (player, self))
|
|
{
|
|
death_watch_treadwell_action_vocalize_01 (player, self);
|
|
|
|
//-- NPC: ...
|
|
string_id message = new string_id (c_stringFile, "s_9208410d");
|
|
int numberOfResponses = 0;
|
|
|
|
boolean hasResponse = false;
|
|
|
|
//-- PLAYER: Yes you can help me. I was sent to get this battery cleaned.
|
|
boolean hasResponse0 = false;
|
|
if (death_watch_treadwell_condition_hasBattery (player, self))
|
|
{
|
|
++numberOfResponses;
|
|
hasResponse = true;
|
|
hasResponse0 = true;
|
|
}
|
|
|
|
//-- PLAYER: No thank you. I am not need of any assistance.
|
|
boolean hasResponse1 = false;
|
|
if (death_watch_treadwell_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_4fcd015f");
|
|
|
|
if (hasResponse1)
|
|
responses [responseIndex++] = new string_id (c_stringFile, "s_8e9e4ef9");
|
|
|
|
setObjVar (player, "conversation.death_watch_treadwell.branchId", 1);
|
|
|
|
npcStartConversation (player, self, "death_watch_treadwell", 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 != "death_watch_treadwell")
|
|
return SCRIPT_CONTINUE;
|
|
|
|
int branchId = getIntObjVar (player, "conversation.death_watch_treadwell.branchId");
|
|
|
|
//-- [BRANCH NOTE]
|
|
//-- NPC: ...
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: Yes you can help me. I was sent to get this battery cleaned.
|
|
if (branchId == 1 && response == "s_4fcd015f")
|
|
{
|
|
//-- [NOTE]
|
|
if (death_watch_treadwell_condition__defaultCondition (player, self))
|
|
{
|
|
death_watch_treadwell_action_fixBattery (player, self);
|
|
|
|
//-- NPC: ...
|
|
string_id message = new string_id (c_stringFile, "s_9208410d");
|
|
removeObjVar (player, "conversation.death_watch_treadwell.branchId");
|
|
|
|
npcSpeak (player, message);
|
|
npcEndConversation (player);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
chat.chat (self, "Error: All conditions for OnNpcConversationResponse for branch '...' were false.");
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//-- [BRANCH NOTE]
|
|
//-- NPC: ...
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: No thank you. I am not need of any assistance.
|
|
if (branchId == 1 && response == "s_8e9e4ef9")
|
|
{
|
|
//-- [NOTE]
|
|
if (death_watch_treadwell_condition__defaultCondition (player, self))
|
|
{
|
|
death_watch_treadwell_action_vocalize_02 (player, self);
|
|
|
|
//-- NPC: ...
|
|
string_id message = new string_id (c_stringFile, "s_9208410d");
|
|
removeObjVar (player, "conversation.death_watch_treadwell.branchId");
|
|
|
|
npcSpeak (player, message);
|
|
npcEndConversation (player);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
chat.chat (self, "Error: All conditions for OnNpcConversationResponse for branch '...' were false.");
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
chat.chat (self, "Error: Fell through all branches and responses for OnNpcConversationResponse.");
|
|
|
|
removeObjVar (player, "conversation.death_watch_treadwell.branchId");
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
// ======================================================================
|
|
|