mirror of
https://github.com/SWG-Source/dsrc.git
synced 2026-08-01 01:15:59 -04:00
327 lines
9.6 KiB
Plaintext
327 lines
9.6 KiB
Plaintext
// ======================================================================
|
|
//
|
|
// npe_medic_guard.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.utils;
|
|
|
|
// ======================================================================
|
|
// Script Constants
|
|
// ======================================================================
|
|
|
|
string c_stringFile = "conversation/npe_medic_guard";
|
|
|
|
// ======================================================================
|
|
// Script Conditions
|
|
// ======================================================================
|
|
|
|
boolean npe_medic_guard_condition__defaultCondition (obj_id player, obj_id npc)
|
|
{
|
|
return true;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
boolean npe_medic_guard_condition_isOnQuest (obj_id player, obj_id npc)
|
|
{
|
|
return groundquests.isTaskActive(player, "npe_medic2", "npe_medic2_heal");
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
boolean npe_medic_guard_condition_hasHealed (obj_id player, obj_id npc)
|
|
{
|
|
return groundquests.hasCompletedTask(player, "npe_medic2", "npe_medic2_heal");
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
boolean npe_medic_guard_condition_hasFullyHealed (obj_id player, obj_id npc)
|
|
{
|
|
return (groundquests.isTaskActive(player, "npe_medic2", "return_technician") || groundquests.hasCompletedQuest(player, "npe_medic2"));
|
|
}
|
|
|
|
// ======================================================================
|
|
// Script Actions
|
|
// ======================================================================
|
|
|
|
void npe_medic_guard_action_facePlayer (obj_id player, obj_id npc)
|
|
{
|
|
faceTo(npc, player);
|
|
}
|
|
|
|
// ======================================================================
|
|
// Script %TO Tokens
|
|
// ======================================================================
|
|
|
|
// ======================================================================
|
|
// Script %DI Tokens
|
|
// ======================================================================
|
|
|
|
// ======================================================================
|
|
// Script %DF Tokens
|
|
// ======================================================================
|
|
|
|
// ======================================================================
|
|
// handleBranch<n> Functions
|
|
// ======================================================================
|
|
|
|
int npe_medic_guard_handleBranch2 (obj_id player, obj_id npc, string_id response)
|
|
{
|
|
//-- [BRANCH NOTE]
|
|
//-- NPC: He burned his eyes. Can you help him?
|
|
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: How did he do that?
|
|
if (response == "s_7")
|
|
{
|
|
//-- [NOTE]
|
|
if (npe_medic_guard_condition__defaultCondition (player, npc))
|
|
{
|
|
//-- NPC: I'm not entirely sure. He was fixing the monitor here, then he just sort of fainted and fell forward. Perhaps he inhaled too much smoke. Please help him...
|
|
string_id message = new string_id (c_stringFile, "s_9");
|
|
int numberOfResponses = 0;
|
|
|
|
boolean hasResponse = false;
|
|
|
|
//-- PLAYER: I'll do what I can.
|
|
boolean hasResponse0 = false;
|
|
if (npe_medic_guard_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_13");
|
|
|
|
utils.setScriptVar (player, "conversation.npe_medic_guard.branchId", 3);
|
|
|
|
npcSpeak (player, message);
|
|
npcSetConversationResponses (player, responses);
|
|
}
|
|
else
|
|
{
|
|
utils.removeScriptVar (player, "conversation.npe_medic_guard.branchId");
|
|
|
|
npcEndConversationWithMessage (player, message);
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
}
|
|
|
|
return SCRIPT_DEFAULT;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
int npe_medic_guard_handleBranch3 (obj_id player, obj_id npc, string_id response)
|
|
{
|
|
//-- [BRANCH NOTE]
|
|
//-- NPC: I'm not entirely sure. He was fixing the monitor here, then he just sort of fainted and fell forward. Perhaps he inhaled too much smoke. Please help him...
|
|
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: I'll do what I can.
|
|
if (response == "s_13")
|
|
{
|
|
//-- [NOTE]
|
|
if (npe_medic_guard_condition__defaultCondition (player, npc))
|
|
{
|
|
//-- NPC: Okay...I will stand guard.
|
|
string_id message = new string_id (c_stringFile, "s_14");
|
|
utils.removeScriptVar (player, "conversation.npe_medic_guard.branchId");
|
|
|
|
npcEndConversationWithMessage (player, message);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
}
|
|
|
|
return SCRIPT_DEFAULT;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
// ======================================================================
|
|
// User Script Triggers
|
|
// ======================================================================
|
|
|
|
trigger OnInitialize ()
|
|
{
|
|
if ((!isMob (self)) || (isPlayer (self)))
|
|
detachScript(self, "conversation.npe_medic_guard");
|
|
|
|
setCondition (self, CONDITION_CONVERSABLE);
|
|
setName(self, "Car'das Guard");
|
|
setInvulnerable( self, true );
|
|
obj_id gun = createObject ("object/weapon/ranged/carbine/carbine_cdef.iff", self, "");
|
|
equip(gun, self);
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
trigger OnAttach ()
|
|
{
|
|
setCondition (self, CONDITION_CONVERSABLE);
|
|
setName(self, "Car'das Guard");
|
|
setInvulnerable( self, true );
|
|
obj_id gun = createObject ("object/weapon/ranged/carbine/carbine_cdef.iff", self, "");
|
|
equip(gun, self);
|
|
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_medic_guard");
|
|
|
|
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_medic_guard_condition_hasHealed (player, npc))
|
|
{
|
|
npe_medic_guard_action_facePlayer (player, npc);
|
|
|
|
//-- NPC: Thank you for helping. I will stand guard while he rests.
|
|
string_id message = new string_id (c_stringFile, "s_12");
|
|
chat.chat (npc, player, message);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//-- [NOTE]
|
|
if (npe_medic_guard_condition_isOnQuest (player, npc))
|
|
{
|
|
npe_medic_guard_action_facePlayer (player, npc);
|
|
|
|
//-- NPC: He burned his eyes. Can you help him?
|
|
string_id message = new string_id (c_stringFile, "s_5");
|
|
int numberOfResponses = 0;
|
|
|
|
boolean hasResponse = false;
|
|
|
|
//-- PLAYER: How did he do that?
|
|
boolean hasResponse0 = false;
|
|
if (npe_medic_guard_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_7");
|
|
|
|
utils.setScriptVar (player, "conversation.npe_medic_guard.branchId", 2);
|
|
|
|
npcStartConversation (player, npc, "npe_medic_guard", message, responses);
|
|
}
|
|
else
|
|
{
|
|
chat.chat (npc, player, message);
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//-- [NOTE]
|
|
if (npe_medic_guard_condition__defaultCondition (player, npc))
|
|
{
|
|
npe_medic_guard_action_facePlayer (player, npc);
|
|
|
|
//-- NPC: Please go get a medic to help!
|
|
string_id message = new string_id (c_stringFile, "s_16");
|
|
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_medic_guard")
|
|
return SCRIPT_CONTINUE;
|
|
|
|
obj_id npc = self;
|
|
|
|
int branchId = utils.getIntScriptVar (player, "conversation.npe_medic_guard.branchId");
|
|
|
|
if (branchId == 2 && npe_medic_guard_handleBranch2 (player, npc, response) == SCRIPT_CONTINUE)
|
|
return SCRIPT_CONTINUE;
|
|
|
|
if (branchId == 3 && npe_medic_guard_handleBranch3 (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_medic_guard.branchId");
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
// ======================================================================
|
|
|