mirror of
https://github.com/SWG-Source/dsrc.git
synced 2026-08-01 01:15:59 -04:00
270 lines
7.8 KiB
Plaintext
270 lines
7.8 KiB
Plaintext
// ======================================================================
|
|
//
|
|
// medical_droid_outbreak.script
|
|
//
|
|
//
|
|
//
|
|
// Created with SwgConversationEditor 1.37 - DO NOT EDIT THIS AUTO-GENERATED FILE!
|
|
//
|
|
// ======================================================================
|
|
|
|
// ======================================================================
|
|
// Library Includes
|
|
// ======================================================================
|
|
|
|
include library.ai_lib;
|
|
include library.buff;
|
|
include library.chat;
|
|
include library.conversation;
|
|
include library.groundquests;
|
|
include library.utils;
|
|
|
|
// ======================================================================
|
|
// Script Constants
|
|
// ======================================================================
|
|
|
|
string c_stringFile = "conversation/medical_droid_outbreak";
|
|
|
|
// ======================================================================
|
|
// Script Conditions
|
|
// ======================================================================
|
|
|
|
boolean medical_droid_outbreak_condition__defaultCondition (obj_id player, obj_id npc)
|
|
{
|
|
return true;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
boolean medical_droid_outbreak_condition_hasSpokenToCody (obj_id player, obj_id npc)
|
|
{
|
|
faceTo(npc, player);
|
|
return groundquests.hasCompletedQuest(player, "outbreak_quest_01_imperial") ||
|
|
groundquests.hasCompletedQuest(player, "outbreak_quest_01_rebel") ||
|
|
groundquests.hasCompletedQuest(player, "outbreak_quest_01_neutral") ||
|
|
isGod(player);
|
|
}
|
|
|
|
// ======================================================================
|
|
// Script Actions
|
|
// ======================================================================
|
|
|
|
void medical_droid_outbreak_action_giveAntiVirus (obj_id player, obj_id npc)
|
|
{
|
|
utils.setScriptVar(player, "outbreak.innoculated", 1);
|
|
buff.applyBuff(player, "death_troopers_inoculation");
|
|
}
|
|
|
|
// ======================================================================
|
|
// Script %TO Tokens
|
|
// ======================================================================
|
|
|
|
// ======================================================================
|
|
// Script %DI Tokens
|
|
// ======================================================================
|
|
|
|
// ======================================================================
|
|
// Script %DF Tokens
|
|
// ======================================================================
|
|
|
|
// ======================================================================
|
|
// handleBranch<n> Functions
|
|
// ======================================================================
|
|
|
|
int medical_droid_outbreak_handleBranch1 (obj_id player, obj_id npc, string_id response)
|
|
{
|
|
//-- [BRANCH NOTE]
|
|
//-- NPC: Are you in need of the anti-virus?
|
|
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: Yes!
|
|
if (response == "s_96")
|
|
{
|
|
//-- [NOTE]
|
|
if (medical_droid_outbreak_condition__defaultCondition (player, npc))
|
|
{
|
|
medical_droid_outbreak_action_giveAntiVirus (player, npc);
|
|
|
|
//-- NPC: Very well. Please relax as I administer the anti-virus.
|
|
string_id message = new string_id (c_stringFile, "s_16");
|
|
utils.removeScriptVar (player, "conversation.medical_droid_outbreak.branchId");
|
|
|
|
npcEndConversationWithMessage (player, message);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
}
|
|
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: No.
|
|
if (response == "s_15")
|
|
{
|
|
//-- [NOTE]
|
|
if (medical_droid_outbreak_condition__defaultCondition (player, npc))
|
|
{
|
|
//-- NPC: Very well, then I must attend to others.
|
|
string_id message = new string_id (c_stringFile, "s_17");
|
|
utils.removeScriptVar (player, "conversation.medical_droid_outbreak.branchId");
|
|
|
|
npcEndConversationWithMessage (player, message);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
}
|
|
|
|
return SCRIPT_DEFAULT;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
// ======================================================================
|
|
// User Script Triggers
|
|
// ======================================================================
|
|
|
|
trigger OnInitialize ()
|
|
{
|
|
if ((!isTangible (self)) || (isPlayer (self)))
|
|
detachScript(self, "conversation.medical_droid_outbreak");
|
|
|
|
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, "conversation.medical_droid_outbreak");
|
|
|
|
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 (medical_droid_outbreak_condition_hasSpokenToCody (player, npc))
|
|
{
|
|
//-- NPC: Are you in need of the anti-virus?
|
|
string_id message = new string_id (c_stringFile, "s_73");
|
|
int numberOfResponses = 0;
|
|
|
|
boolean hasResponse = false;
|
|
|
|
//-- PLAYER: Yes!
|
|
boolean hasResponse0 = false;
|
|
if (medical_droid_outbreak_condition__defaultCondition (player, npc))
|
|
{
|
|
++numberOfResponses;
|
|
hasResponse = true;
|
|
hasResponse0 = true;
|
|
}
|
|
|
|
//-- PLAYER: No.
|
|
boolean hasResponse1 = false;
|
|
if (medical_droid_outbreak_condition__defaultCondition (player, npc))
|
|
{
|
|
++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_96");
|
|
|
|
if (hasResponse1)
|
|
responses [responseIndex++] = new string_id (c_stringFile, "s_15");
|
|
|
|
utils.setScriptVar (player, "conversation.medical_droid_outbreak.branchId", 1);
|
|
|
|
npcStartConversation (player, npc, "medical_droid_outbreak", message, responses);
|
|
}
|
|
else
|
|
{
|
|
chat.chat (npc, player, message);
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//-- [NOTE]
|
|
if (medical_droid_outbreak_condition__defaultCondition (player, npc))
|
|
{
|
|
//-- NPC: Please stand aside while I attend to those in need of medical assistance.
|
|
string_id message = new string_id (c_stringFile, "s_60");
|
|
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 != "medical_droid_outbreak")
|
|
return SCRIPT_CONTINUE;
|
|
|
|
obj_id npc = self;
|
|
|
|
int branchId = utils.getIntScriptVar (player, "conversation.medical_droid_outbreak.branchId");
|
|
|
|
if (branchId == 1 && medical_droid_outbreak_handleBranch1 (player, npc, response) == SCRIPT_CONTINUE)
|
|
return SCRIPT_CONTINUE;
|
|
|
|
chat.chat (npc, "Error: Fell through all branches and responses for OnNpcConversationResponse.");
|
|
|
|
utils.removeScriptVar (player, "conversation.medical_droid_outbreak.branchId");
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
// ======================================================================
|
|
|