mirror of
https://github.com/SWG-Source/dsrc.git
synced 2026-07-31 00:15:54 -04:00
611 lines
17 KiB
Plaintext
611 lines
17 KiB
Plaintext
// ======================================================================
|
|
//
|
|
// npe_medic_wounded2.script
|
|
//
|
|
//
|
|
//
|
|
// Created with SwgConversationEditor 1.35 - 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_wounded2";
|
|
|
|
// ======================================================================
|
|
// Script Conditions
|
|
// ======================================================================
|
|
|
|
boolean npe_medic_wounded2_condition__defaultCondition (obj_id player, obj_id npc)
|
|
{
|
|
return true;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
boolean npe_medic_wounded2_condition_hasNotHealed (obj_id player, obj_id npc)
|
|
{
|
|
return groundquests.isTaskActive(player, "npe_medic2", "npe_medic2_heal");
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
boolean npe_medic_wounded2_condition_isBackWithToxin (obj_id player, obj_id npc)
|
|
{
|
|
return groundquests.isTaskActive(player, "npe_medic2", "return_technician");
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
boolean npe_medic_wounded2_condition_allHealed (obj_id player, obj_id npc)
|
|
{
|
|
return (groundquests.hasCompletedTask(player, "npe_medic2", "return_technician") || groundquests.hasCompletedQuest(player, "npe_medic2"));
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
boolean npe_medic_wounded2_condition_wasHealed1 (obj_id player, obj_id npc)
|
|
{
|
|
return groundquests.isTaskActive(player, "npe_medic2", "talk_technician");
|
|
}
|
|
|
|
// ======================================================================
|
|
// Script Actions
|
|
// ======================================================================
|
|
|
|
void npe_medic_wounded2_action_sendSignalHealed (obj_id player, obj_id npc)
|
|
{
|
|
groundquests.sendSignal(player, "npe_medic_heal_worker_1");
|
|
return;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
void npe_medic_wounded2_action_facePlayer (obj_id player, obj_id npc)
|
|
{
|
|
faceTo(npc, player);
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
void npe_medic_wounded2_action_sendSignalGoBack (obj_id player, obj_id npc)
|
|
{
|
|
groundquests.sendSignal(player, "npe_technician1");
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
void npe_medic_wounded2_action_sendSignalToxinDone (obj_id player, obj_id npc)
|
|
{
|
|
groundquests.sendSignal(player, "npe_technician2");
|
|
}
|
|
|
|
// ======================================================================
|
|
// Script %TO Tokens
|
|
// ======================================================================
|
|
|
|
// ======================================================================
|
|
// Script %DI Tokens
|
|
// ======================================================================
|
|
|
|
// ======================================================================
|
|
// Script %DF Tokens
|
|
// ======================================================================
|
|
|
|
// ======================================================================
|
|
// handleBranch<n> Functions
|
|
// ======================================================================
|
|
|
|
int npe_medic_wounded2_handleBranch1 (obj_id player, obj_id npc, string_id response)
|
|
{
|
|
//-- [BRANCH NOTE]
|
|
//-- NPC: I'm starting to feel better, but I still don't think I can go anywhere.
|
|
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: Just rest. That will fade.
|
|
if (response == "s_29")
|
|
{
|
|
//-- [NOTE]
|
|
if (npe_medic_wounded2_condition__defaultCondition (player, npc))
|
|
{
|
|
//-- NPC: Thank you.
|
|
string_id message = new string_id (c_stringFile, "s_30");
|
|
utils.removeScriptVar (player, "conversation.npe_medic_wounded2.branchId");
|
|
|
|
npcEndConversationWithMessage (player, message);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
}
|
|
|
|
return SCRIPT_DEFAULT;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
int npe_medic_wounded2_handleBranch3 (obj_id player, obj_id npc, string_id response)
|
|
{
|
|
//-- [BRANCH NOTE]
|
|
//-- NPC: I've been feeling worse since you left.
|
|
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: Not to worry...I have an antitoxin for you.
|
|
if (response == "s_25")
|
|
{
|
|
//-- [NOTE]
|
|
if (npe_medic_wounded2_condition__defaultCondition (player, npc))
|
|
{
|
|
npe_medic_wounded2_action_sendSignalToxinDone (player, npc);
|
|
|
|
//-- NPC: Thank you. I will take it right now!
|
|
string_id message = new string_id (c_stringFile, "s_27");
|
|
utils.removeScriptVar (player, "conversation.npe_medic_wounded2.branchId");
|
|
|
|
npcEndConversationWithMessage (player, message);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
}
|
|
|
|
return SCRIPT_DEFAULT;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
int npe_medic_wounded2_handleBranch5 (obj_id player, obj_id npc, string_id response)
|
|
{
|
|
//-- [BRANCH NOTE]
|
|
//-- NPC: My eyes don't hurt anymore, but I still can't see and I'm still woozy.
|
|
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: What were you doing before the monitor repairs?
|
|
if (response == "s_24")
|
|
{
|
|
//-- [NOTE]
|
|
if (npe_medic_wounded2_condition__defaultCondition (player, npc))
|
|
{
|
|
//-- NPC: All I did was handle some cargo that was recently unloaded onto the station.
|
|
string_id message = new string_id (c_stringFile, "s_26");
|
|
int numberOfResponses = 0;
|
|
|
|
boolean hasResponse = false;
|
|
|
|
//-- PLAYER: It must have something to do with that cargo.
|
|
boolean hasResponse0 = false;
|
|
if (npe_medic_wounded2_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_wounded2.branchId", 6);
|
|
|
|
npcSpeak (player, message);
|
|
npcSetConversationResponses (player, responses);
|
|
}
|
|
else
|
|
{
|
|
utils.removeScriptVar (player, "conversation.npe_medic_wounded2.branchId");
|
|
|
|
npcEndConversationWithMessage (player, message);
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
}
|
|
|
|
return SCRIPT_DEFAULT;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
int npe_medic_wounded2_handleBranch6 (obj_id player, obj_id npc, string_id response)
|
|
{
|
|
//-- [BRANCH NOTE]
|
|
//-- NPC: All I did was handle some cargo that was recently unloaded onto the station.
|
|
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: It must have something to do with that cargo.
|
|
if (response == "s_13")
|
|
{
|
|
//-- [NOTE]
|
|
if (npe_medic_wounded2_condition__defaultCondition (player, npc))
|
|
{
|
|
//-- NPC: What do I do? I'm feeling worse.
|
|
string_id message = new string_id (c_stringFile, "s_15");
|
|
int numberOfResponses = 0;
|
|
|
|
boolean hasResponse = false;
|
|
|
|
//-- PLAYER: Stay here while I get help.
|
|
boolean hasResponse0 = false;
|
|
if (npe_medic_wounded2_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_18");
|
|
|
|
utils.setScriptVar (player, "conversation.npe_medic_wounded2.branchId", 7);
|
|
|
|
npcSpeak (player, message);
|
|
npcSetConversationResponses (player, responses);
|
|
}
|
|
else
|
|
{
|
|
utils.removeScriptVar (player, "conversation.npe_medic_wounded2.branchId");
|
|
|
|
npcEndConversationWithMessage (player, message);
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
}
|
|
|
|
return SCRIPT_DEFAULT;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
int npe_medic_wounded2_handleBranch7 (obj_id player, obj_id npc, string_id response)
|
|
{
|
|
//-- [BRANCH NOTE]
|
|
//-- NPC: What do I do? I'm feeling worse.
|
|
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: Stay here while I get help.
|
|
if (response == "s_18")
|
|
{
|
|
//-- [NOTE]
|
|
if (npe_medic_wounded2_condition__defaultCondition (player, npc))
|
|
{
|
|
npe_medic_wounded2_action_sendSignalGoBack (player, npc);
|
|
|
|
//-- NPC: Okay. Thank you.
|
|
string_id message = new string_id (c_stringFile, "s_20");
|
|
utils.removeScriptVar (player, "conversation.npe_medic_wounded2.branchId");
|
|
|
|
npcEndConversationWithMessage (player, message);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
}
|
|
|
|
return SCRIPT_DEFAULT;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
int npe_medic_wounded2_handleBranch9 (obj_id player, obj_id npc, string_id response)
|
|
{
|
|
//-- [BRANCH NOTE]
|
|
//-- NPC: My eyes! I burned my eyes!
|
|
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: Don't worry...I can help you.
|
|
if (response == "s_32")
|
|
{
|
|
//-- [NOTE]
|
|
if (npe_medic_wounded2_condition__defaultCondition (player, npc))
|
|
{
|
|
//-- NPC: Please hurry!
|
|
string_id message = new string_id (c_stringFile, "s_34");
|
|
utils.removeScriptVar (player, "conversation.npe_medic_wounded2.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_wounded2");
|
|
|
|
setCondition (self, CONDITION_CONVERSABLE);
|
|
setInvulnerable( self, true );
|
|
setName( self, "Injured Technician");
|
|
//setPosture(self, POSTURE_UPRIGHT);
|
|
ai_lib.setCustomIdleAnimation(self, "npc_dead_03");
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
trigger OnAttach ()
|
|
{
|
|
setCondition (self, CONDITION_CONVERSABLE);
|
|
setInvulnerable( self, true );
|
|
setName( self, "Injured Technician");
|
|
//setPosture(self, POSTURE_UPRIGHT);
|
|
ai_lib.setCustomIdleAnimation(self, "npc_dead_03");
|
|
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_wounded2");
|
|
|
|
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_wounded2_condition_allHealed (player, npc))
|
|
{
|
|
//-- NPC: I'm starting to feel better, but I still don't think I can go anywhere.
|
|
string_id message = new string_id (c_stringFile, "s_28");
|
|
int numberOfResponses = 0;
|
|
|
|
boolean hasResponse = false;
|
|
|
|
//-- PLAYER: Just rest. That will fade.
|
|
boolean hasResponse0 = false;
|
|
if (npe_medic_wounded2_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_29");
|
|
|
|
utils.setScriptVar (player, "conversation.npe_medic_wounded2.branchId", 1);
|
|
|
|
npcStartConversation (player, npc, "npe_medic_wounded2", message, responses);
|
|
}
|
|
else
|
|
{
|
|
chat.chat (npc, player, message);
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//-- [NOTE]
|
|
if (npe_medic_wounded2_condition_isBackWithToxin (player, npc))
|
|
{
|
|
//-- NPC: I've been feeling worse since you left.
|
|
string_id message = new string_id (c_stringFile, "s_23");
|
|
int numberOfResponses = 0;
|
|
|
|
boolean hasResponse = false;
|
|
|
|
//-- PLAYER: Not to worry...I have an antitoxin for you.
|
|
boolean hasResponse0 = false;
|
|
if (npe_medic_wounded2_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_25");
|
|
|
|
utils.setScriptVar (player, "conversation.npe_medic_wounded2.branchId", 3);
|
|
|
|
npcStartConversation (player, npc, "npe_medic_wounded2", message, responses);
|
|
}
|
|
else
|
|
{
|
|
chat.chat (npc, player, message);
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//-- [NOTE]
|
|
if (npe_medic_wounded2_condition_wasHealed1 (player, npc))
|
|
{
|
|
//-- NPC: My eyes don't hurt anymore, but I still can't see and I'm still woozy.
|
|
string_id message = new string_id (c_stringFile, "s_16");
|
|
int numberOfResponses = 0;
|
|
|
|
boolean hasResponse = false;
|
|
|
|
//-- PLAYER: What were you doing before the monitor repairs?
|
|
boolean hasResponse0 = false;
|
|
if (npe_medic_wounded2_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_24");
|
|
|
|
utils.setScriptVar (player, "conversation.npe_medic_wounded2.branchId", 5);
|
|
|
|
npcStartConversation (player, npc, "npe_medic_wounded2", message, responses);
|
|
}
|
|
else
|
|
{
|
|
chat.chat (npc, player, message);
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//-- [NOTE]
|
|
if (npe_medic_wounded2_condition_hasNotHealed (player, npc))
|
|
{
|
|
//-- NPC: My eyes! I burned my eyes!
|
|
string_id message = new string_id (c_stringFile, "s_22");
|
|
int numberOfResponses = 0;
|
|
|
|
boolean hasResponse = false;
|
|
|
|
//-- PLAYER: Don't worry...I can help you.
|
|
boolean hasResponse0 = false;
|
|
if (npe_medic_wounded2_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_32");
|
|
|
|
utils.setScriptVar (player, "conversation.npe_medic_wounded2.branchId", 9);
|
|
|
|
npcStartConversation (player, npc, "npe_medic_wounded2", message, responses);
|
|
}
|
|
else
|
|
{
|
|
chat.chat (npc, player, message);
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//-- [NOTE]
|
|
if (npe_medic_wounded2_condition__defaultCondition (player, npc))
|
|
{
|
|
//-- NPC: Ohh, it hurts...
|
|
string_id message = new string_id (c_stringFile, "s_40");
|
|
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_wounded2")
|
|
return SCRIPT_CONTINUE;
|
|
|
|
obj_id npc = self;
|
|
|
|
int branchId = utils.getIntScriptVar (player, "conversation.npe_medic_wounded2.branchId");
|
|
|
|
if (branchId == 1 && npe_medic_wounded2_handleBranch1 (player, npc, response) == SCRIPT_CONTINUE)
|
|
return SCRIPT_CONTINUE;
|
|
|
|
if (branchId == 3 && npe_medic_wounded2_handleBranch3 (player, npc, response) == SCRIPT_CONTINUE)
|
|
return SCRIPT_CONTINUE;
|
|
|
|
if (branchId == 5 && npe_medic_wounded2_handleBranch5 (player, npc, response) == SCRIPT_CONTINUE)
|
|
return SCRIPT_CONTINUE;
|
|
|
|
if (branchId == 6 && npe_medic_wounded2_handleBranch6 (player, npc, response) == SCRIPT_CONTINUE)
|
|
return SCRIPT_CONTINUE;
|
|
|
|
if (branchId == 7 && npe_medic_wounded2_handleBranch7 (player, npc, response) == SCRIPT_CONTINUE)
|
|
return SCRIPT_CONTINUE;
|
|
|
|
if (branchId == 9 && npe_medic_wounded2_handleBranch9 (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_wounded2.branchId");
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
// ======================================================================
|
|
|