Files
dsrc/sku.0/sys.server/compiled/game/script/conversation/rebel_general.script
T
2013-09-10 23:17:15 -07:00

2249 lines
68 KiB
Plaintext

// ======================================================================
//
// rebel_general.script
// Copyright 2004, Sony Online Entertainment
// All Rights Reserved.
//
// 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.create;
include library.factions;
include library.gcw;
include library.groundquests;
include library.holiday;
include library.trial;
include library.utils;
// ======================================================================
// Script Constants
// ======================================================================
string c_stringFile = "conversation/rebel_general";
// ======================================================================
// Script Conditions
// ======================================================================
boolean rebel_general_condition__defaultCondition (obj_id player, obj_id npc)
{
return true;
}
// ----------------------------------------------------------------------
boolean rebel_general_condition_isEntertainerPlayer (obj_id player, obj_id npc)
{
faceTo(npc, player);
return utils.isProfession(player, utils.ENTERTAINER);
}
// ----------------------------------------------------------------------
boolean rebel_general_condition_isPlayerImperial (obj_id player, obj_id npc)
{
faceTo(npc, player);
return (factions.isImperial(player) || factions.isPlayerSameGcwFactionAsSchedulerObject(player, npc));
}
// ----------------------------------------------------------------------
boolean rebel_general_condition_isPlayerRebel (obj_id player, obj_id npc)
{
faceTo(npc, player);
return (factions.isRebel(player) || factions.isPlayerSameGcwFactionAsSchedulerObject(player, npc));
}
// ----------------------------------------------------------------------
boolean rebel_general_condition_isPlayerNeutral (obj_id player, obj_id npc)
{
faceTo(npc, player);
return(!factions.isImperial(player) && !factions.isRebel(player) && pvpNeutralGetMercenaryFaction(player) == 0);
}
// ----------------------------------------------------------------------
boolean rebel_general_condition_isTraderPlayer (obj_id player, obj_id npc)
{
faceTo(npc, player);
return utils.isProfession(player, utils.TRADER);
}
// ----------------------------------------------------------------------
boolean rebel_general_condition_isForceSensitivePlayer (obj_id player, obj_id npc)
{
faceTo(npc, player);
return utils.isProfession(player, utils.FORCE_SENSITIVE);
}
// ----------------------------------------------------------------------
boolean rebel_general_condition_isSmugglerPlayer (obj_id player, obj_id npc)
{
faceTo(npc, player);
return utils.isProfession(player, utils.SMUGGLER);
}
// ----------------------------------------------------------------------
boolean rebel_general_condition_isMedicPlayer (obj_id player, obj_id npc)
{
faceTo(npc, player);
return utils.isProfession(player, utils.MEDIC);
}
// ----------------------------------------------------------------------
boolean rebel_general_condition_isOfficerPlayer (obj_id player, obj_id npc)
{
faceTo(npc, player);
return utils.isProfession(player, utils.OFFICER);
}
// ----------------------------------------------------------------------
boolean rebel_general_condition_isSpyPlayer (obj_id player, obj_id npc)
{
faceTo(npc, player);
return utils.isProfession(player, utils.SPY);
}
// ----------------------------------------------------------------------
boolean rebel_general_condition_isBountyHunterPlayer (obj_id player, obj_id npc)
{
faceTo(npc, player);
return utils.isProfession(player, utils.BOUNTY_HUNTER);
}
// ----------------------------------------------------------------------
boolean rebel_general_condition_isCommandoPlayer (obj_id player, obj_id npc)
{
faceTo(npc, player);
return utils.isProfession(player, utils.COMMANDO);
}
// ----------------------------------------------------------------------
boolean rebel_general_condition_generalIsOffensive (obj_id player, obj_id npc)
{
return (hasObjVar(npc, "offense") && getIntObjVar(npc, "offense") == 1);
}
// ----------------------------------------------------------------------
boolean rebel_general_condition_generalIsImperial (obj_id player, obj_id npc)
{
return (hasObjVar(npc, "factionFlag") && getIntObjVar(npc, "factionFlag") == factions.FACTION_FLAG_IMPERIAL);
}
// ----------------------------------------------------------------------
boolean rebel_general_condition_generalIsDefensive (obj_id player, obj_id npc)
{
return (hasObjVar(npc, "offense") && getIntObjVar(npc, "offense") == 0);
}
// ----------------------------------------------------------------------
boolean rebel_general_condition_generalIsRebel (obj_id player, obj_id npc)
{
return (hasObjVar(npc, "factionFlag") && getIntObjVar(npc, "factionFlag") == factions.FACTION_FLAG_REBEL);
}
// ----------------------------------------------------------------------
boolean rebel_general_condition_isGeneralRebAndOffense (obj_id player, obj_id npc)
{
return rebel_general_condition_isPlayerRebel(player, npc) && rebel_general_condition_generalIsRebel(player, npc) && rebel_general_condition_generalIsOffensive(player, npc);
}
// ----------------------------------------------------------------------
boolean rebel_general_condition_isCombatPhase (obj_id player, obj_id npc)
{
return (gcw.getGcwCityInvasionPhase(npc) == gcw.GCW_CITY_PHASE_COMBAT);
}
// ----------------------------------------------------------------------
boolean rebel_general_condition_isConstructionPhase (obj_id player, obj_id npc)
{
return (gcw.getGcwCityInvasionPhase(npc) == gcw.GCW_CITY_PHASE_CONSTRUCTION);
}
// ----------------------------------------------------------------------
boolean rebel_general_condition_isGeneralRebAndDefense (obj_id player, obj_id npc)
{
return rebel_general_condition_isPlayerRebel(player, npc) && rebel_general_condition_generalIsRebel(player, npc) && rebel_general_condition_generalIsDefensive(player, npc);
}
// ----------------------------------------------------------------------
boolean rebel_general_condition_isGeneralImpAndOffense (obj_id player, obj_id npc)
{
return rebel_general_condition_isPlayerImperial(player, npc) && rebel_general_condition_generalIsImperial(player, npc) && rebel_general_condition_generalIsOffensive(player, npc);
}
// ----------------------------------------------------------------------
boolean rebel_general_condition_isGeneralImpAndDefense (obj_id player, obj_id npc)
{
return rebel_general_condition_isPlayerImperial(player, npc) && rebel_general_condition_generalIsImperial(player, npc) && rebel_general_condition_generalIsDefensive(player, npc);
}
// ----------------------------------------------------------------------
boolean rebel_general_condition_hasRebelQuest (obj_id player, obj_id npc)
{
return rebel_general_condition_isPlayerRebel(player, npc)
&& (rebel_general_condition_hasSpyScoutPatrolQuest(player, npc)
|| rebel_general_condition_hasSpyDestroyPatrolQuest(player, npc)
|| rebel_general_condition_hasSpyDestroyPatrolQuestNeedsExplosives(player, npc)
|| rebel_general_condition_hasDestroyBarricadeQuest(player, npc)
|| rebel_general_condition_hasDestroyTurretQuest(player, npc)
);
}
// ----------------------------------------------------------------------
boolean rebel_general_condition_hasSpyDestroyPatrolQuestNeedsExplosives (obj_id player, obj_id npc)
{
return rebel_general_condition_isSpyPlayer(player, npc)
&& groundquests.isQuestActive(player, gcw.GCW_SPY_PATROL_DESTROY_QUEST)
&& (buff.getBuffStackCount(player, "gcw_spy_destroy_patrol_explosive_stack") < 5);
}
// ----------------------------------------------------------------------
boolean rebel_general_condition_hasSpyScoutPatrolQuest (obj_id player, obj_id npc)
{
return rebel_general_condition_isSpyPlayer(player, npc)
&& groundquests.isQuestActive(player, gcw.GCW_SPY_PATROL_SCOUT_QUEST);
}
// ----------------------------------------------------------------------
boolean rebel_general_condition_hasSpyDestroyPatrolQuest (obj_id player, obj_id npc)
{
return rebel_general_condition_isSpyPlayer(player, npc)
&& groundquests.isQuestActive(player, gcw.GCW_SPY_PATROL_DESTROY_QUEST);
}
// ----------------------------------------------------------------------
boolean rebel_general_condition_hasDestroyTurretQuest (obj_id player, obj_id npc)
{
return groundquests.isQuestActive(player, gcw.GCW_DESTROY_TURRET);
}
// ----------------------------------------------------------------------
boolean rebel_general_condition_hasDestroyBarricadeQuest (obj_id player, obj_id npc)
{
return groundquests.isQuestActive(player, gcw.GCW_DESTROY_BARRICADE);
}
// ----------------------------------------------------------------------
boolean rebel_general_condition_hasDestroyQuest (obj_id player, obj_id npc)
{
return rebel_general_condition_hasSpyDestroyPatrolQuest(player, npc)
|| rebel_general_condition_hasDestroyTurretQuest(player, npc)
|| rebel_general_condition_hasDestroyBarricadeQuest(player, npc);
}
// ----------------------------------------------------------------------
boolean rebel_general_condition_hasEntertainRallyQuest (obj_id player, obj_id npc)
{
return groundquests.isQuestActive(player, gcw.GCW_ENTERTAIN_RALLY);
}
// ----------------------------------------------------------------------
boolean rebel_general_condition_enemyPatrolPointsExist (obj_id player, obj_id npc)
{
obj_id parent = trial.getParent(npc);
if(!isValidId(parent) || !exists(parent))
{
return false;
}
if(rebel_general_condition_generalIsDefensive(player, npc))
{
obj_id[] patrols = trial.getObjectsInInstanceByObjVar(parent, "gcw.offense_patrol_spawner");
if(patrols == null || patrols.length <= 0)
return false;
return patrols.length > 0;
}
else if(rebel_general_condition_generalIsOffensive(player, npc))
{
obj_id[] patrols = trial.getObjectsInInstanceByObjVar(parent, "gcw.defense_patrol_spawner");
if(patrols == null || patrols.length <= 0)
return false;
return patrols.length > 0;
}
return false;
}
// ----------------------------------------------------------------------
boolean rebel_general_condition_enemyPatrolsExistAndIsCombatPhase (obj_id player, obj_id npc)
{
return (rebel_general_condition_enemyPatrolPointsExist(player, npc) && rebel_general_condition_isCombatPhase(player, npc));
}
// ----------------------------------------------------------------------
boolean rebel_general_condition_enemyPatrolPointsDestroyed (obj_id player, obj_id npc)
{
return (rebel_general_condition_isCombatPhase(player, npc) && !rebel_general_condition_enemyPatrolPointsExist(player, npc));
}
// ----------------------------------------------------------------------
boolean rebel_general_condition_canCommandoQuest (obj_id player, obj_id npc)
{
return rebel_general_condition_isCommandoPlayer(player, npc) && (!groundquests.isQuestActive(player, gcw.GCW_DESTROY_BARRICADE) || !groundquests.isQuestActive(player, gcw.GCW_DESTROY_TURRET));
}
// ----------------------------------------------------------------------
boolean rebel_general_condition_canEntertainerQuest (obj_id player, obj_id npc)
{
return rebel_general_condition_isEntertainerPlayer(player, npc) && (!groundquests.isQuestActive(player, gcw.GCW_ENTERTAIN_RALLY) || !groundquests.isQuestActive(player, gcw.GCW_ENTERTAIN_FATIGUE));
}
// ----------------------------------------------------------------------
boolean rebel_general_condition_canBeMerc (obj_id player, obj_id npc)
{
int faction_id = pvpGetAlignedFaction(npc);
string recruiterFaction = factions.getFactionNameByHashCode(faction_id);
return factions.canChangeNeutralMercenaryStatus(player, recruiterFaction);
}
// ----------------------------------------------------------------------
boolean rebel_general_condition_patrolPointsExistNoScoutQuest (obj_id player, obj_id npc)
{
return rebel_general_condition_enemyPatrolPointsExist(player, npc)
&& !groundquests.isQuestActive(player, gcw.GCW_SPY_PATROL_SCOUT_QUEST);
}
// ----------------------------------------------------------------------
boolean rebel_general_condition_patrolPointsExistNoDestroyQuest (obj_id player, obj_id npc)
{
return rebel_general_condition_enemyPatrolPointsExist(player, npc)
&& !groundquests.isQuestActive(player, gcw.GCW_SPY_PATROL_DESTROY_QUEST);
}
// ======================================================================
// Script Actions
// ======================================================================
void rebel_general_action_spawnGuards (obj_id player, obj_id npc)
{
//spawn some mean enemies
for (int i = 0; i < 3; i++)
{
location guardLocation = groundquests.getRandom2DLocationAroundLocation(npc, 1, 1, 5, 12);
int mobLevel = getLevel(player);
obj_id guard = create.object("rebel_emperorsday_ceremony_sentry", guardLocation, mobLevel);
attachScript(guard, "event.emp_day.factional_guard_self_destruct");
startCombat(guard, player);
}
}
// ----------------------------------------------------------------------
void rebel_general_action_grantSpyDestroyPatrol (obj_id player, obj_id npc)
{
if(groundquests.isQuestActive(player, gcw.GCW_SPY_PATROL_DESTROY_QUEST))
return;
if(groundquests.hasCompletedQuest(player, gcw.GCW_SPY_PATROL_DESTROY_QUEST))
{
groundquests.clearQuest(player, gcw.GCW_SPY_PATROL_DESTROY_QUEST);
}
buff.applyBuffWithStackCount(player, gcw.BUFF_SPY_EXPLOSIVES, 5);
groundquests.grantQuest(player, gcw.GCW_SPY_PATROL_DESTROY_QUEST);
}
// ----------------------------------------------------------------------
void rebel_general_action_grantSpyScoutPatrol (obj_id player, obj_id npc)
{
if(groundquests.isQuestActive(player, gcw.GCW_SPY_PATROL_SCOUT_QUEST))
return;
if(groundquests.hasCompletedQuest(player, gcw.GCW_SPY_PATROL_SCOUT_QUEST))
{
groundquests.clearQuest(player, gcw.GCW_SPY_PATROL_SCOUT_QUEST);
}
groundquests.grantQuest(player, gcw.GCW_SPY_PATROL_SCOUT_QUEST);
}
// ----------------------------------------------------------------------
void rebel_general_action_grantMoreSpyDestroyPatrolExplosives (obj_id player, obj_id npc)
{
buff.applyBuffWithStackCount(player, gcw.BUFF_SPY_EXPLOSIVES, 5);
}
// ----------------------------------------------------------------------
void rebel_general_action_grantCombatDestroyBarricade (obj_id player, obj_id npc)
{
}
// ----------------------------------------------------------------------
void rebel_general_action_grantCombatDestroyTurret (obj_id player, obj_id npc)
{
if(groundquests.isQuestActive(player, gcw.GCW_DESTROY_TURRET))
return;
if(groundquests.hasCompletedQuest(player, gcw.GCW_DESTROY_TURRET))
{
groundquests.clearQuest(player, gcw.GCW_DESTROY_TURRET);
}
groundquests.grantQuest(player, gcw.GCW_DESTROY_TURRET);
}
// ----------------------------------------------------------------------
void rebel_general_action_grantEntertainRallyQuest (obj_id player, obj_id npc)
{
if(groundquests.isQuestActive(player, gcw.GCW_ENTERTAIN_RALLY))
return;
if(groundquests.hasCompletedQuest(player, gcw.GCW_ENTERTAIN_RALLY))
{
groundquests.clearQuest(player, gcw.GCW_ENTERTAIN_RALLY);
}
groundquests.grantQuest(player, gcw.GCW_ENTERTAIN_RALLY);
}
// ----------------------------------------------------------------------
void rebel_general_action_grantEntertainFatigueQuest (obj_id player, obj_id npc)
{
if(groundquests.isQuestActive(player, gcw.GCW_ENTERTAIN_FATIGUE))
return;
if(groundquests.hasCompletedQuest(player, gcw.GCW_ENTERTAIN_FATIGUE))
{
groundquests.clearQuest(player, gcw.GCW_ENTERTAIN_FATIGUE);
}
groundquests.grantQuest(player, gcw.GCW_ENTERTAIN_FATIGUE);
}
// ----------------------------------------------------------------------
void rebel_general_action_grantEntertainerQuests (obj_id player, obj_id npc)
{
if(!groundquests.isQuestActive(player, gcw.GCW_ENTERTAIN_FATIGUE))
{
if(groundquests.hasCompletedQuest(player, gcw.GCW_ENTERTAIN_FATIGUE))
{
groundquests.clearQuest(player, gcw.GCW_ENTERTAIN_FATIGUE);
}
groundquests.grantQuest(player, gcw.GCW_ENTERTAIN_FATIGUE);
}
if(!groundquests.isQuestActive(player, gcw.GCW_ENTERTAIN_RALLY))
{
if(groundquests.hasCompletedQuest(player, gcw.GCW_ENTERTAIN_RALLY))
{
groundquests.clearQuest(player, gcw.GCW_ENTERTAIN_RALLY);
}
groundquests.grantQuest(player, gcw.GCW_ENTERTAIN_RALLY);
}
}
// ----------------------------------------------------------------------
void rebel_general_action_grantCombatQuests (obj_id player, obj_id npc)
{
if(!groundquests.isQuestActive(player, gcw.GCW_DESTROY_BARRICADE))
{
if(groundquests.hasCompletedQuest(player, gcw.GCW_DESTROY_BARRICADE))
{
groundquests.clearQuest(player, gcw.GCW_DESTROY_BARRICADE);
}
groundquests.grantQuest(player, gcw.GCW_DESTROY_BARRICADE);
}
if(!groundquests.isQuestActive(player, gcw.GCW_DESTROY_TURRET))
{
if(groundquests.hasCompletedQuest(player, gcw.GCW_DESTROY_TURRET))
{
groundquests.clearQuest(player, gcw.GCW_DESTROY_TURRET);
}
groundquests.grantQuest(player, gcw.GCW_DESTROY_TURRET);
}
if(!groundquests.isQuestActive(player, gcw.GCW_ELIMINATE_IMPERIALS))
{
if(groundquests.hasCompletedQuest(player, gcw.GCW_ELIMINATE_IMPERIALS))
{
groundquests.clearQuest(player, gcw.GCW_ELIMINATE_IMPERIALS);
}
groundquests.grantQuest(player, gcw.GCW_ELIMINATE_IMPERIALS);
}
}
// ----------------------------------------------------------------------
void rebel_general_action_makeRebMercCombatant (obj_id player, obj_id npc)
{
factions.setNeturalMercenaryCovert(player, factions.FACTION_FLAG_REBEL);
}
// ----------------------------------------------------------------------
void rebel_general_action_makeRebMercSF (obj_id player, obj_id npc)
{
factions.setNeturalMercenaryOvert(player, factions.FACTION_FLAG_REBEL);
}
// ----------------------------------------------------------------------
void rebel_general_action_grantCombatSpyQuests (obj_id player, obj_id npc)
{
if(!groundquests.isQuestActive(player, gcw.GCW_DESTROY_BARRICADE))
{
if(groundquests.hasCompletedQuest(player, gcw.GCW_DESTROY_BARRICADE))
{
groundquests.clearQuest(player, gcw.GCW_DESTROY_BARRICADE);
}
groundquests.grantQuest(player, gcw.GCW_DESTROY_BARRICADE);
}
if(!groundquests.isQuestActive(player, gcw.GCW_DESTROY_TURRET))
{
if(groundquests.hasCompletedQuest(player, gcw.GCW_DESTROY_TURRET))
{
groundquests.clearQuest(player, gcw.GCW_DESTROY_TURRET);
}
groundquests.grantQuest(player, gcw.GCW_DESTROY_TURRET);
}
if(!groundquests.isQuestActive(player, gcw.GCW_ELIMINATE_IMPERIALS))
{
if(groundquests.hasCompletedQuest(player, gcw.GCW_ELIMINATE_IMPERIALS))
{
groundquests.clearQuest(player, gcw.GCW_ELIMINATE_IMPERIALS);
}
groundquests.grantQuest(player, gcw.GCW_ELIMINATE_IMPERIALS);
}
if(!groundquests.isQuestActive(player, gcw.GCW_SPY_PATROL_DESTROY_QUEST) && rebel_general_condition_enemyPatrolPointsExist(player, npc))
{
if(groundquests.hasCompletedQuest(player, gcw.GCW_SPY_PATROL_DESTROY_QUEST))
{
groundquests.clearQuest(player, gcw.GCW_SPY_PATROL_DESTROY_QUEST);
}
buff.applyBuffWithStackCount(player, gcw.BUFF_SPY_EXPLOSIVES, 5);
groundquests.grantQuest(player, gcw.GCW_SPY_PATROL_DESTROY_QUEST);
}
if(!groundquests.isQuestActive(player, gcw.GCW_SPY_PATROL_SCOUT_QUEST) && rebel_general_condition_enemyPatrolPointsExist(player, npc))
{
if(groundquests.hasCompletedQuest(player, gcw.GCW_SPY_PATROL_SCOUT_QUEST))
{
groundquests.clearQuest(player, gcw.GCW_SPY_PATROL_SCOUT_QUEST);
}
groundquests.grantQuest(player, gcw.GCW_SPY_PATROL_SCOUT_QUEST);
}
}
// ----------------------------------------------------------------------
void rebel_general_action_grantDefensiveSpyQuests (obj_id player, obj_id npc)
{
if(!groundquests.isQuestActive(player, gcw.GCW_ELIMINATE_IMPERIALS))
{
if(groundquests.hasCompletedQuest(player, gcw.GCW_ELIMINATE_IMPERIALS))
{
groundquests.clearQuest(player, gcw.GCW_ELIMINATE_IMPERIALS);
}
groundquests.grantQuest(player, gcw.GCW_ELIMINATE_IMPERIALS);
}
if(!groundquests.isQuestActive(player, gcw.GCW_SPY_PATROL_DESTROY_QUEST) && rebel_general_condition_enemyPatrolPointsExist(player, npc))
{
if(groundquests.hasCompletedQuest(player, gcw.GCW_SPY_PATROL_DESTROY_QUEST))
{
groundquests.clearQuest(player, gcw.GCW_SPY_PATROL_DESTROY_QUEST);
}
buff.applyBuffWithStackCount(player, gcw.BUFF_SPY_EXPLOSIVES, 5);
groundquests.grantQuest(player, gcw.GCW_SPY_PATROL_DESTROY_QUEST);
}
if(!groundquests.isQuestActive(player, gcw.GCW_SPY_PATROL_SCOUT_QUEST) && rebel_general_condition_enemyPatrolPointsExist(player, npc))
{
if(groundquests.hasCompletedQuest(player, gcw.GCW_SPY_PATROL_SCOUT_QUEST))
{
groundquests.clearQuest(player, gcw.GCW_SPY_PATROL_SCOUT_QUEST);
}
groundquests.grantQuest(player, gcw.GCW_SPY_PATROL_SCOUT_QUEST);
}
}
// ======================================================================
// Script %TO Tokens
// ======================================================================
// ======================================================================
// Script %DI Tokens
// ======================================================================
// ======================================================================
// Script %DF Tokens
// ======================================================================
// ======================================================================
// handleBranch<n> Functions
// ======================================================================
int rebel_general_handleBranch1 (obj_id player, obj_id npc, string_id response)
{
//-- [BRANCH NOTE]
//-- NPC: Yes?
//-- [RESPONSE NOTE]
//-- PLAYER: I'd like to help the Rebellion but remain neutral.
if (response == "s_46")
{
//-- [NOTE]
if (rebel_general_condition__defaultCondition (player, npc))
{
//-- NPC: We reward those who lend their support, even if it is just temporary.
string_id message = new string_id (c_stringFile, "s_48");
int numberOfResponses = 0;
boolean hasResponse = false;
//-- PLAYER: How can I temporarily help the rebellion?
boolean hasResponse0 = false;
if (rebel_general_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_110");
utils.setScriptVar (player, "conversation.rebel_general.branchId", 2);
npcSpeak (player, message);
npcSetConversationResponses (player, responses);
}
else
{
utils.removeScriptVar (player, "conversation.rebel_general.branchId");
npcEndConversationWithMessage (player, message);
}
return SCRIPT_CONTINUE;
}
}
return SCRIPT_DEFAULT;
}
// ----------------------------------------------------------------------
int rebel_general_handleBranch2 (obj_id player, obj_id npc, string_id response)
{
//-- [BRANCH NOTE]
//-- NPC: We reward those who lend their support, even if it is just temporary.
//-- [RESPONSE NOTE]
//-- PLAYER: How can I temporarily help the rebellion?
if (response == "s_110")
{
//-- [NOTE]
if (rebel_general_condition_canBeMerc (player, npc))
{
//-- NPC: Then join us as a mercenary. You wont receive Alliance Rank but you will be eligible for any rewards we sell our troops. Are you still interested?
string_id message = new string_id (c_stringFile, "s_111");
int numberOfResponses = 0;
boolean hasResponse = false;
//-- PLAYER: Yes.
boolean hasResponse0 = false;
if (rebel_general_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_112");
utils.setScriptVar (player, "conversation.rebel_general.branchId", 3);
npcSpeak (player, message);
npcSetConversationResponses (player, responses);
}
else
{
utils.removeScriptVar (player, "conversation.rebel_general.branchId");
npcEndConversationWithMessage (player, message);
}
return SCRIPT_CONTINUE;
}
//-- [NOTE]
if (rebel_general_condition__defaultCondition (player, npc))
{
//-- NPC: I show that you are already in the process of changing your status.
string_id message = new string_id (c_stringFile, "s_123");
utils.removeScriptVar (player, "conversation.rebel_general.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
}
return SCRIPT_DEFAULT;
}
// ----------------------------------------------------------------------
int rebel_general_handleBranch3 (obj_id player, obj_id npc, string_id response)
{
//-- [BRANCH NOTE]
//-- NPC: Then join us as a mercenary. You wont receive Alliance Rank but you will be eligible for any rewards we sell our troops. Are you still interested?
//-- [RESPONSE NOTE]
//-- PLAYER: Yes.
if (response == "s_112")
{
//-- [NOTE]
if (rebel_general_condition_canBeMerc (player, npc))
{
//-- NPC: Would you like to sign on as Special Forces or Combatant?
string_id message = new string_id (c_stringFile, "s_113");
int numberOfResponses = 0;
boolean hasResponse = false;
//-- PLAYER: Special Forces
boolean hasResponse0 = false;
if (rebel_general_condition__defaultCondition (player, npc))
{
++numberOfResponses;
hasResponse = true;
hasResponse0 = true;
}
//-- PLAYER: Combatant
boolean hasResponse1 = false;
if (rebel_general_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_116");
if (hasResponse1)
responses [responseIndex++] = new string_id (c_stringFile, "s_117");
utils.setScriptVar (player, "conversation.rebel_general.branchId", 4);
npcSpeak (player, message);
npcSetConversationResponses (player, responses);
}
else
{
utils.removeScriptVar (player, "conversation.rebel_general.branchId");
npcEndConversationWithMessage (player, message);
}
return SCRIPT_CONTINUE;
}
//-- [NOTE]
if (rebel_general_condition__defaultCondition (player, npc))
{
//-- NPC: I show that you are already in the process of changing your status.
string_id message = new string_id (c_stringFile, "s_115");
utils.removeScriptVar (player, "conversation.rebel_general.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
}
return SCRIPT_DEFAULT;
}
// ----------------------------------------------------------------------
int rebel_general_handleBranch4 (obj_id player, obj_id npc, string_id response)
{
//-- [BRANCH NOTE]
//-- NPC: Would you like to sign on as Special Forces or Combatant?
//-- [RESPONSE NOTE]
//-- PLAYER: Special Forces
if (response == "s_116")
{
//-- [NOTE]
if (rebel_general_condition_canBeMerc (player, npc))
{
doAnimationAction (npc, "handshake_tandem");
doAnimationAction (player, "handshake_tandem");
rebel_general_action_makeRebMercSF (player, npc);
//-- NPC: Great! Watch your back! If you need to change your status, use the icon in your command browser named Change Neutral Status.
string_id message = new string_id (c_stringFile, "s_118");
utils.removeScriptVar (player, "conversation.rebel_general.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
//-- [NOTE]
if (rebel_general_condition__defaultCondition (player, npc))
{
//-- NPC: I show that you are already in the process of changing your status.
string_id message = new string_id (c_stringFile, "s_119");
utils.removeScriptVar (player, "conversation.rebel_general.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
}
//-- [RESPONSE NOTE]
//-- PLAYER: Combatant
if (response == "s_117")
{
//-- [NOTE]
if (rebel_general_condition_canBeMerc (player, npc))
{
doAnimationAction (npc, "handshake_tandem");
doAnimationAction (player, "handshake_tandem");
rebel_general_action_makeRebMercCombatant (player, npc);
//-- NPC: Welcome aboard. If you need to change your status, use the icon in your command browser named Change Neutral Status.
string_id message = new string_id (c_stringFile, "s_120");
utils.removeScriptVar (player, "conversation.rebel_general.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
//-- [NOTE]
if (rebel_general_condition__defaultCondition (player, npc))
{
//-- NPC: I show that you are already in the process of changing your status.
string_id message = new string_id (c_stringFile, "s_121");
utils.removeScriptVar (player, "conversation.rebel_general.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
}
return SCRIPT_DEFAULT;
}
// ----------------------------------------------------------------------
int rebel_general_handleBranch11 (obj_id player, obj_id npc, string_id response)
{
//-- [BRANCH NOTE]
//-- NPC: Alliance Command has issued a directive enabling me to recruit any personnel to lend a hand for the invasion of this city.
//-- [RESPONSE NOTE]
//-- PLAYER: I'm here for my orders!
if (response == "s_21")
{
//-- [NOTE]
if (rebel_general_condition_isCombatPhase (player, npc))
{
rebel_general_action_grantEntertainerQuests (player, npc);
//-- NPC: Good! Here are your orders. You need to rally demoralized troops, entertain patrols and our supply engineers to reduce their fatigue.
string_id message = new string_id (c_stringFile, "s_328");
utils.removeScriptVar (player, "conversation.rebel_general.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
//-- [NOTE]
if (rebel_general_condition_isConstructionPhase (player, npc))
{
rebel_general_action_grantEntertainFatigueQuest (player, npc);
//-- NPC: Right now we are constructing offensive assets and waiting for reinforcements. We need you to entertain our supply engineers to keep them from becoming too fatigued.
string_id message = new string_id (c_stringFile, "s_331");
utils.removeScriptVar (player, "conversation.rebel_general.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
}
//-- [RESPONSE NOTE]
//-- PLAYER: What can Traders do?
if (response == "s_31")
{
//-- [NOTE]
if (rebel_general_condition_isConstructionPhase (player, npc))
{
//-- NPC: We need all traders to construct offensive patrol and vehicle points. Use the Supply Terminal for more details.
string_id message = new string_id (c_stringFile, "s_33");
utils.removeScriptVar (player, "conversation.rebel_general.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
//-- [NOTE]
if (rebel_general_condition_isCombatPhase (player, npc))
{
//-- NPC: If the enemy outflanks us and damages vehicle or patrol points we'll need the trade skilled volunteers to repair those assets. Use the Supply Terminal for more details.
string_id message = new string_id (c_stringFile, "s_183");
utils.removeScriptVar (player, "conversation.rebel_general.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
}
//-- [RESPONSE NOTE]
//-- PLAYER: Reporting, Sir!
if (response == "s_36")
{
//-- [NOTE]
if (rebel_general_condition_isConstructionPhase (player, npc))
{
//-- NPC: Right now we are constructing offensive assets and waiting for reinforcements. You may assist our supply engineers with their construction.
string_id message = new string_id (c_stringFile, "s_192");
utils.removeScriptVar (player, "conversation.rebel_general.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
//-- [NOTE]
if (rebel_general_condition_isCombatPhase (player, npc))
{
rebel_general_action_grantCombatQuests (player, npc);
//-- NPC: You will crush the Imperial dogs with impunity, Soldier! Destroy their turrets and barricades to soften their defenses!
string_id message = new string_id (c_stringFile, "s_330");
utils.removeScriptVar (player, "conversation.rebel_general.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
}
//-- [RESPONSE NOTE]
//-- PLAYER: May I lend a hand in the assault?
if (response == "s_51")
{
//-- [NOTE]
if (rebel_general_condition_isConstructionPhase (player, npc))
{
//-- NPC: Right now we are constructing offensive assets and waiting for reinforcements. You may assist our supply engineers with their construction.
string_id message = new string_id (c_stringFile, "s_194");
utils.removeScriptVar (player, "conversation.rebel_general.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
//-- [NOTE]
if (rebel_general_condition_isCombatPhase (player, npc))
{
rebel_general_action_grantCombatQuests (player, npc);
//-- NPC: We have many targets of opportunity for one of your skills! Our main concerns are the turrets and barricades keeping our troops from advancing.
string_id message = new string_id (c_stringFile, "s_332");
utils.removeScriptVar (player, "conversation.rebel_general.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
}
//-- [RESPONSE NOTE]
//-- PLAYER: What makes you think I want to go near that city?
if (response == "s_61")
{
//-- [NOTE]
if (rebel_general_condition_isConstructionPhase (player, npc))
{
//-- NPC: Right now we are constructing offensive assets and waiting for reinforcements. You may assist our supply engineers with their construction.
string_id message = new string_id (c_stringFile, "s_196");
utils.removeScriptVar (player, "conversation.rebel_general.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
//-- [NOTE]
if (rebel_general_condition_isCombatPhase (player, npc))
{
rebel_general_action_grantCombatQuests (player, npc);
//-- NPC: It's a tough nut to crack, but there are some hefty rewards involved. Take down some barricades and turrets and I'll personally see that you are rewarded!
string_id message = new string_id (c_stringFile, "s_333");
utils.removeScriptVar (player, "conversation.rebel_general.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
}
//-- [RESPONSE NOTE]
//-- PLAYER: Where's my target?
if (response == "s_71")
{
//-- [NOTE]
if (rebel_general_condition_isConstructionPhase (player, npc))
{
//-- NPC: Right now we are constructing offensive assets and waiting for reinforcements. You may assist our supply engineers with their construction.
string_id message = new string_id (c_stringFile, "s_201");
utils.removeScriptVar (player, "conversation.rebel_general.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
//-- [NOTE]
if (rebel_general_condition_isCombatPhase (player, npc))
{
rebel_general_action_grantCombatQuests (player, npc);
//-- NPC: The general coordinating the defenses of the city needs to be removed. Before we can do that, we must clear the turrets and barricade defenses.
string_id message = new string_id (c_stringFile, "s_335");
utils.removeScriptVar (player, "conversation.rebel_general.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
}
//-- [RESPONSE NOTE]
//-- PLAYER: Need intelligence on the enemy, sir?
if (response == "s_81")
{
//-- [NOTE]
if (rebel_general_condition_isCombatPhase (player, npc))
{
rebel_general_action_grantCombatSpyQuests (player, npc);
//-- NPC: Your mission is to scout and sabotage patrol points. You may find other targets of opportunity such as barricades and turrets.
string_id message = new string_id (c_stringFile, "s_222");
utils.removeScriptVar (player, "conversation.rebel_general.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
//-- [NOTE]
if (rebel_general_condition_isConstructionPhase (player, npc))
{
//-- NPC: Right now we are constructing offensive assets and waiting for reinforcements. You are more than welcome to wait until this phase of the attack is over.
string_id message = new string_id (c_stringFile, "s_203");
utils.removeScriptVar (player, "conversation.rebel_general.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
}
//-- [RESPONSE NOTE]
//-- PLAYER: Medic reporting, sir!
if (response == "s_102")
{
//-- [NOTE]
if (rebel_general_condition_isConstructionPhase (player, npc))
{
//-- NPC: Right now we are constructing offensive assets and waiting for reinforcements. You may assist our supply engineers with their construction.
string_id message = new string_id (c_stringFile, "s_205");
utils.removeScriptVar (player, "conversation.rebel_general.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
//-- [NOTE]
if (rebel_general_condition_isCombatPhase (player, npc))
{
rebel_general_action_grantCombatQuests (player, npc);
//-- NPC: Excellent! We have wounded to attend to on the battlefield, turrets to destroy, and barricades to bring down. Here are your orders!
string_id message = new string_id (c_stringFile, "s_337");
utils.removeScriptVar (player, "conversation.rebel_general.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
}
//-- [RESPONSE NOTE]
//-- PLAYER: Reporting, sir!
if (response == "s_114")
{
//-- [NOTE]
if (rebel_general_condition_isConstructionPhase (player, npc))
{
//-- NPC: Right now we are constructing offensive assets and waiting for reinforcements. You may assist our supply engineers with their construction.
string_id message = new string_id (c_stringFile, "s_207");
utils.removeScriptVar (player, "conversation.rebel_general.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
//-- [NOTE]
if (rebel_general_condition_isCombatPhase (player, npc))
{
rebel_general_action_grantCombatQuests (player, npc);
//-- NPC: Ah, yes! I need you to coordinate attacks on the turrets and barricades. Bring those defenses down, so our troops can reach their general!
string_id message = new string_id (c_stringFile, "s_339");
utils.removeScriptVar (player, "conversation.rebel_general.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
}
//-- [RESPONSE NOTE]
//-- PLAYER: I need more explosives.
if (response == "s_312")
{
//-- [NOTE]
if (rebel_general_condition_enemyPatrolPointsDestroyed (player, npc))
{
rebel_general_action_grantMoreSpyDestroyPatrolExplosives (player, npc);
//-- NPC: Our intelligence suggests that all enemy patrol points have been destroyed. However, here are some more explosives in case the intelligence turns out to be incorrect.
string_id message = new string_id (c_stringFile, "s_130");
utils.removeScriptVar (player, "conversation.rebel_general.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
//-- [NOTE]
if (rebel_general_condition__defaultCondition (player, npc))
{
rebel_general_action_grantMoreSpyDestroyPatrolExplosives (player, npc);
//-- NPC: No problem...but try not to waste them alright?
string_id message = new string_id (c_stringFile, "s_314");
utils.removeScriptVar (player, "conversation.rebel_general.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
}
//-- [RESPONSE NOTE]
//-- PLAYER: What do I need to do for the scout quest again?
if (response == "s_316")
{
//-- [NOTE]
if (rebel_general_condition_enemyPatrolPointsDestroyed (player, npc))
{
//-- NPC: Normally we'd need you to scout out the enemies patrol points but other scouts have reported that all enemy patrol points have been destroyed.
string_id message = new string_id (c_stringFile, "s_129");
utils.removeScriptVar (player, "conversation.rebel_general.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
//-- [NOTE]
if (rebel_general_condition__defaultCondition (player, npc))
{
//-- NPC: All you have to do is find an enemy patrol point in the city. Once you find one, report its position to High Command.
string_id message = new string_id (c_stringFile, "s_318");
utils.removeScriptVar (player, "conversation.rebel_general.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
}
//-- [RESPONSE NOTE]
//-- PLAYER: What do I need to do for the destroy quest again?
if (response == "s_320")
{
//-- [NOTE]
if (rebel_general_condition_hasDestroyBarricadeQuest (player, npc))
{
//-- NPC: We need volunteers to destroy any enemy barricades they can find. Once the enemy defenses are down the ground forces will have an easier time pressing the attack.
string_id message = new string_id (c_stringFile, "s_324");
utils.removeScriptVar (player, "conversation.rebel_general.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
//-- [NOTE]
if (rebel_general_condition_hasDestroyTurretQuest (player, npc))
{
//-- NPC: We need volunteers to destroy any enemy turrets they can find. Once a turret is destroyed our ground forces will have an easier time pressing the attack.
string_id message = new string_id (c_stringFile, "s_326");
utils.removeScriptVar (player, "conversation.rebel_general.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
//-- [NOTE]
if (rebel_general_condition_enemyPatrolPointsDestroyed (player, npc))
{
//-- NPC: Someone else already took care of it. Our intelligence shows no remaining patrol points in the area.
string_id message = new string_id (c_stringFile, "s_131");
utils.removeScriptVar (player, "conversation.rebel_general.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
//-- [NOTE]
if (rebel_general_condition_hasSpyDestroyPatrolQuest (player, npc))
{
//-- NPC: Find an enemy patrol point in the city and place explosives to destroy it. Pretty simple.
string_id message = new string_id (c_stringFile, "s_322");
utils.removeScriptVar (player, "conversation.rebel_general.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
}
return SCRIPT_DEFAULT;
}
// ----------------------------------------------------------------------
int rebel_general_handleBranch38 (obj_id player, obj_id npc, string_id response)
{
//-- [BRANCH NOTE]
//-- NPC: Alliance Command has issued a directive enabling me to recruit any personnel to lend a hand for the defense of this city.
//-- [RESPONSE NOTE]
//-- PLAYER: I'm here for my orders!
if (response == "s_149")
{
//-- [NOTE]
if (rebel_general_condition_isCombatPhase (player, npc))
{
rebel_general_action_grantEntertainerQuests (player, npc);
//-- NPC: Good! Here are your orders. You need to rally demoralized troops, entertain patrols and our supply engineers to reduce their fatigue.
string_id message = new string_id (c_stringFile, "s_150");
utils.removeScriptVar (player, "conversation.rebel_general.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
//-- [NOTE]
if (rebel_general_condition_isConstructionPhase (player, npc))
{
rebel_general_action_grantEntertainFatigueQuest (player, npc);
//-- NPC: Right now we are constructing defensive assets and waiting for reinforcements. We need you to entertain our supply engineers to keep them from becoming too fatigued.
string_id message = new string_id (c_stringFile, "s_152");
utils.removeScriptVar (player, "conversation.rebel_general.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
}
//-- [RESPONSE NOTE]
//-- PLAYER: What can Traders do?
if (response == "s_146")
{
//-- [NOTE]
if (rebel_general_condition_isConstructionPhase (player, npc))
{
//-- NPC: We need all traders to construct defensive assets. Turrets, towers, barricades and patrol points all need to be constructed as soon as possible. Use the Supply Terminal for more details.
string_id message = new string_id (c_stringFile, "s_148");
utils.removeScriptVar (player, "conversation.rebel_general.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
//-- [NOTE]
if (rebel_general_condition_isCombatPhase (player, npc))
{
//-- NPC: If and when any a barricade, turret or patrol point takes damage we'll need the trade skilled volunteers to repair those assets. Use the Supply Terminal for details.
string_id message = new string_id (c_stringFile, "s_190");
utils.removeScriptVar (player, "conversation.rebel_general.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
}
//-- [RESPONSE NOTE]
//-- PLAYER: What can Commandos do?
if (response == "s_151")
{
//-- [NOTE]
if (rebel_general_condition_isCombatPhase (player, npc))
{
//-- NPC: Reinforce the lines! We need volunteers to slow the progress of the enemy.
string_id message = new string_id (c_stringFile, "s_153");
utils.removeScriptVar (player, "conversation.rebel_general.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
//-- [NOTE]
if (rebel_general_condition_isConstructionPhase (player, npc))
{
//-- NPC: Right now we are constructing defensive assets and waiting for reinforcements. Find a good place to defend the city and stay put.
string_id message = new string_id (c_stringFile, "s_212");
utils.removeScriptVar (player, "conversation.rebel_general.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
}
//-- [RESPONSE NOTE]
//-- PLAYER: What can Jedi do?
if (response == "s_156")
{
//-- [NOTE]
if (rebel_general_condition_isCombatPhase (player, npc))
{
//-- NPC: Reinforce the lines! We need volunteers to slow the progress of the enemy.
string_id message = new string_id (c_stringFile, "s_158");
utils.removeScriptVar (player, "conversation.rebel_general.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
//-- [NOTE]
if (rebel_general_condition_isConstructionPhase (player, npc))
{
//-- NPC: Right now we are constructing defensive assets and waiting for reinforcements. Find a good place to defend the city and stay put.
string_id message = new string_id (c_stringFile, "s_213");
utils.removeScriptVar (player, "conversation.rebel_general.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
}
//-- [RESPONSE NOTE]
//-- PLAYER: What can Smugglers do?
if (response == "s_161")
{
//-- [NOTE]
if (rebel_general_condition_isCombatPhase (player, npc))
{
//-- NPC: Reinforce the lines! We need volunteers to slow the progress of the enemy.
string_id message = new string_id (c_stringFile, "s_163");
utils.removeScriptVar (player, "conversation.rebel_general.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
//-- [NOTE]
if (rebel_general_condition_isConstructionPhase (player, npc))
{
//-- NPC: Right now we are constructing defensive assets and waiting for reinforcements. Find a good place to defend the city and stay put.
string_id message = new string_id (c_stringFile, "s_214");
utils.removeScriptVar (player, "conversation.rebel_general.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
}
//-- [RESPONSE NOTE]
//-- PLAYER: What can Bounty Hunters do?
if (response == "s_166")
{
//-- [NOTE]
if (rebel_general_condition_isCombatPhase (player, npc))
{
//-- NPC: Reinforce the lines! We need volunteers to slow the progress of the enemy.
string_id message = new string_id (c_stringFile, "s_169");
utils.removeScriptVar (player, "conversation.rebel_general.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
//-- [NOTE]
if (rebel_general_condition_isConstructionPhase (player, npc))
{
//-- NPC: Right now we are constructing defensive assets and waiting for reinforcements. Find a good place to defend the city and stay put.
string_id message = new string_id (c_stringFile, "s_216");
utils.removeScriptVar (player, "conversation.rebel_general.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
}
//-- [RESPONSE NOTE]
//-- PLAYER: Need intelligence on the enemy, sir?
if (response == "s_134")
{
//-- [NOTE]
if (rebel_general_condition_isCombatPhase (player, npc))
{
rebel_general_action_grantDefensiveSpyQuests (player, npc);
//-- NPC: Your mission is to scout and sabotage patrol points.
string_id message = new string_id (c_stringFile, "s_135");
utils.removeScriptVar (player, "conversation.rebel_general.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
//-- [NOTE]
if (rebel_general_condition_isConstructionPhase (player, npc))
{
//-- NPC: Right now we are constructing defensive assets and waiting for reinforcements. You are more than welcome to wait until this phase of the attack is over.
string_id message = new string_id (c_stringFile, "s_136");
utils.removeScriptVar (player, "conversation.rebel_general.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
}
//-- [RESPONSE NOTE]
//-- PLAYER: What can Medics do?
if (response == "s_289")
{
//-- [NOTE]
if (rebel_general_condition_isCombatPhase (player, npc))
{
//-- NPC: We have wounded in the city. Find them and tend to their injuries!
string_id message = new string_id (c_stringFile, "s_291");
utils.removeScriptVar (player, "conversation.rebel_general.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
//-- [NOTE]
if (rebel_general_condition_isConstructionPhase (player, npc))
{
//-- NPC: Right now we are constructing defensive assets and waiting for reinforcements. Find a good place to defend the city and stay put.
string_id message = new string_id (c_stringFile, "s_297");
utils.removeScriptVar (player, "conversation.rebel_general.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
}
//-- [RESPONSE NOTE]
//-- PLAYER: What can Officers do?
if (response == "s_299")
{
//-- [NOTE]
if (rebel_general_condition_isCombatPhase (player, npc))
{
//-- NPC: Reinforce the lines! We need volunteers to slow the progress of the enemy.
string_id message = new string_id (c_stringFile, "s_301");
utils.removeScriptVar (player, "conversation.rebel_general.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
//-- [NOTE]
if (rebel_general_condition_isConstructionPhase (player, npc))
{
//-- NPC: Right now we are constructing defensive assets and waiting for reinforcements. Find a good place to defend the city and stay put.
string_id message = new string_id (c_stringFile, "s_308");
utils.removeScriptVar (player, "conversation.rebel_general.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
}
//-- [RESPONSE NOTE]
//-- PLAYER: I need more explosives.
if (response == "s_137")
{
//-- [NOTE]
if (rebel_general_condition_enemyPatrolPointsDestroyed (player, npc))
{
//-- NPC: Our intelligence suggests that all enemy patrol points have been destroyed. However, here are some more explosives in case the intelligence turns out to be incorrect.
string_id message = new string_id (c_stringFile, "s_122");
utils.removeScriptVar (player, "conversation.rebel_general.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
//-- [NOTE]
if (rebel_general_condition__defaultCondition (player, npc))
{
rebel_general_action_grantMoreSpyDestroyPatrolExplosives (player, npc);
//-- NPC: No problem...but try not to waste them alright?
string_id message = new string_id (c_stringFile, "s_142");
utils.removeScriptVar (player, "conversation.rebel_general.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
}
//-- [RESPONSE NOTE]
//-- PLAYER: What do I need to do for the scout quest again?
if (response == "s_140")
{
//-- [NOTE]
if (rebel_general_condition_enemyPatrolPointsDestroyed (player, npc))
{
//-- NPC: Normally we'd need you to scout out the enemies patrol points but other scouts have reported that all enemy patrol points have been destroyed.
string_id message = new string_id (c_stringFile, "s_127");
utils.removeScriptVar (player, "conversation.rebel_general.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
//-- [NOTE]
if (rebel_general_condition__defaultCondition (player, npc))
{
//-- NPC: All you have to do is find an enemy patrol point outside the city. Once you find one, report its position to High Command.
string_id message = new string_id (c_stringFile, "s_143");
utils.removeScriptVar (player, "conversation.rebel_general.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
}
//-- [RESPONSE NOTE]
//-- PLAYER: What do I need to do for the destroy quest again?
if (response == "s_141")
{
//-- [NOTE]
if (rebel_general_condition_enemyPatrolPointsDestroyed (player, npc))
{
//-- NPC: Someone else already took care of it. Our intelligence shows no remaining patrol points in the area.
string_id message = new string_id (c_stringFile, "s_139");
utils.removeScriptVar (player, "conversation.rebel_general.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
//-- [NOTE]
if (rebel_general_condition__defaultCondition (player, npc))
{
//-- NPC: Find an enemy patrol point outside the city and place explosives to destroy it. Pretty simple.
string_id message = new string_id (c_stringFile, "s_145");
utils.removeScriptVar (player, "conversation.rebel_general.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
}
return SCRIPT_DEFAULT;
}
// ----------------------------------------------------------------------
// ======================================================================
// User Script Triggers
// ======================================================================
trigger OnInitialize ()
{
if ((!isTangible (self)) || (isPlayer (self)))
detachScript(self, "conversation.rebel_general");
setCondition (self, CONDITION_CONVERSABLE);
return SCRIPT_CONTINUE;
}
trigger OnAttach ()
{
setCondition (self, CONDITION_CONVERSABLE);
dictionary params = new dictionary();
location loc = getLocation(self);
params.put("particleLoc", loc);
int playIconTime = getGameTime();
params.put("iconMessageTime", playIconTime);
utils.setScriptVar(self, "iconMessageTime", playIconTime);
messageTo(self, "playQuestIcon", params, 1.0f, false);
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.rebel_general");
return SCRIPT_CONTINUE;
}
messageHandler playQuestIcon()
{
gcw.playQuestIconHandler(self, params);
if(!utils.hasScriptVar(self, "faction"))
{
if(!hasObjVar(self, "factionFlag"))
return SCRIPT_CONTINUE;
int faction = getIntObjVar(self, "factionFlag");
utils.setScriptVar(self, "faction", faction);
}
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 (rebel_general_condition_isPlayerNeutral (player, npc))
{
//-- NPC: Yes?
string_id message = new string_id (c_stringFile, "s_44");
int numberOfResponses = 0;
boolean hasResponse = false;
//-- PLAYER: I'd like to help the Rebellion but remain neutral.
boolean hasResponse0 = false;
if (rebel_general_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_46");
utils.setScriptVar (player, "conversation.rebel_general.branchId", 1);
npcStartConversation (player, npc, "rebel_general", message, responses);
}
else
{
chat.chat (npc, player, message);
}
return SCRIPT_CONTINUE;
}
//-- [NOTE]
if (rebel_general_condition_isGeneralRebAndOffense (player, npc))
{
//-- NPC: Alliance Command has issued a directive enabling me to recruit any personnel to lend a hand for the invasion of this city.
string_id message = new string_id (c_stringFile, "s_19");
int numberOfResponses = 0;
boolean hasResponse = false;
//-- PLAYER: I'm here for my orders!
boolean hasResponse0 = false;
if (rebel_general_condition_canEntertainerQuest (player, npc))
{
++numberOfResponses;
hasResponse = true;
hasResponse0 = true;
}
//-- PLAYER: What can Traders do?
boolean hasResponse1 = false;
if (rebel_general_condition_isTraderPlayer (player, npc))
{
++numberOfResponses;
hasResponse = true;
hasResponse1 = true;
}
//-- PLAYER: Reporting, Sir!
boolean hasResponse2 = false;
if (rebel_general_condition_isCommandoPlayer (player, npc))
{
++numberOfResponses;
hasResponse = true;
hasResponse2 = true;
}
//-- PLAYER: May I lend a hand in the assault?
boolean hasResponse3 = false;
if (rebel_general_condition_isForceSensitivePlayer (player, npc))
{
++numberOfResponses;
hasResponse = true;
hasResponse3 = true;
}
//-- PLAYER: What makes you think I want to go near that city?
boolean hasResponse4 = false;
if (rebel_general_condition_isSmugglerPlayer (player, npc))
{
++numberOfResponses;
hasResponse = true;
hasResponse4 = true;
}
//-- PLAYER: Where's my target?
boolean hasResponse5 = false;
if (rebel_general_condition_isBountyHunterPlayer (player, npc))
{
++numberOfResponses;
hasResponse = true;
hasResponse5 = true;
}
//-- PLAYER: Need intelligence on the enemy, sir?
boolean hasResponse6 = false;
if (rebel_general_condition_isSpyPlayer (player, npc))
{
++numberOfResponses;
hasResponse = true;
hasResponse6 = true;
}
//-- PLAYER: Medic reporting, sir!
boolean hasResponse7 = false;
if (rebel_general_condition_isMedicPlayer (player, npc))
{
++numberOfResponses;
hasResponse = true;
hasResponse7 = true;
}
//-- PLAYER: Reporting, sir!
boolean hasResponse8 = false;
if (rebel_general_condition_isOfficerPlayer (player, npc))
{
++numberOfResponses;
hasResponse = true;
hasResponse8 = true;
}
//-- PLAYER: I need more explosives.
boolean hasResponse9 = false;
if (rebel_general_condition_hasSpyDestroyPatrolQuestNeedsExplosives (player, npc))
{
++numberOfResponses;
hasResponse = true;
hasResponse9 = true;
}
//-- PLAYER: What do I need to do for the scout quest again?
boolean hasResponse10 = false;
if (rebel_general_condition_hasSpyScoutPatrolQuest (player, npc))
{
++numberOfResponses;
hasResponse = true;
hasResponse10 = true;
}
//-- PLAYER: What do I need to do for the destroy quest again?
boolean hasResponse11 = false;
if (rebel_general_condition_hasDestroyQuest (player, npc))
{
++numberOfResponses;
hasResponse = true;
hasResponse11 = true;
}
if (hasResponse)
{
int responseIndex = 0;
string_id responses [] = new string_id [numberOfResponses];
if (hasResponse0)
responses [responseIndex++] = new string_id (c_stringFile, "s_21");
if (hasResponse1)
responses [responseIndex++] = new string_id (c_stringFile, "s_31");
if (hasResponse2)
responses [responseIndex++] = new string_id (c_stringFile, "s_36");
if (hasResponse3)
responses [responseIndex++] = new string_id (c_stringFile, "s_51");
if (hasResponse4)
responses [responseIndex++] = new string_id (c_stringFile, "s_61");
if (hasResponse5)
responses [responseIndex++] = new string_id (c_stringFile, "s_71");
if (hasResponse6)
responses [responseIndex++] = new string_id (c_stringFile, "s_81");
if (hasResponse7)
responses [responseIndex++] = new string_id (c_stringFile, "s_102");
if (hasResponse8)
responses [responseIndex++] = new string_id (c_stringFile, "s_114");
if (hasResponse9)
responses [responseIndex++] = new string_id (c_stringFile, "s_312");
if (hasResponse10)
responses [responseIndex++] = new string_id (c_stringFile, "s_316");
if (hasResponse11)
responses [responseIndex++] = new string_id (c_stringFile, "s_320");
utils.setScriptVar (player, "conversation.rebel_general.branchId", 11);
npcStartConversation (player, npc, "rebel_general", message, responses);
}
else
{
chat.chat (npc, player, message);
}
return SCRIPT_CONTINUE;
}
//-- [NOTE]
if (rebel_general_condition_isGeneralRebAndDefense (player, npc))
{
//-- NPC: Alliance Command has issued a directive enabling me to recruit any personnel to lend a hand for the defense of this city.
string_id message = new string_id (c_stringFile, "s_124");
int numberOfResponses = 0;
boolean hasResponse = false;
//-- PLAYER: I'm here for my orders!
boolean hasResponse0 = false;
if (rebel_general_condition_isEntertainerPlayer (player, npc))
{
++numberOfResponses;
hasResponse = true;
hasResponse0 = true;
}
//-- PLAYER: What can Traders do?
boolean hasResponse1 = false;
if (rebel_general_condition_isTraderPlayer (player, npc))
{
++numberOfResponses;
hasResponse = true;
hasResponse1 = true;
}
//-- PLAYER: What can Commandos do?
boolean hasResponse2 = false;
if (rebel_general_condition_isCommandoPlayer (player, npc))
{
++numberOfResponses;
hasResponse = true;
hasResponse2 = true;
}
//-- PLAYER: What can Jedi do?
boolean hasResponse3 = false;
if (rebel_general_condition_isForceSensitivePlayer (player, npc))
{
++numberOfResponses;
hasResponse = true;
hasResponse3 = true;
}
//-- PLAYER: What can Smugglers do?
boolean hasResponse4 = false;
if (rebel_general_condition_isSmugglerPlayer (player, npc))
{
++numberOfResponses;
hasResponse = true;
hasResponse4 = true;
}
//-- PLAYER: What can Bounty Hunters do?
boolean hasResponse5 = false;
if (rebel_general_condition_isBountyHunterPlayer (player, npc))
{
++numberOfResponses;
hasResponse = true;
hasResponse5 = true;
}
//-- PLAYER: Need intelligence on the enemy, sir?
boolean hasResponse6 = false;
if (rebel_general_condition_isSpyPlayer (player, npc))
{
++numberOfResponses;
hasResponse = true;
hasResponse6 = true;
}
//-- PLAYER: What can Medics do?
boolean hasResponse7 = false;
if (rebel_general_condition_isMedicPlayer (player, npc))
{
++numberOfResponses;
hasResponse = true;
hasResponse7 = true;
}
//-- PLAYER: What can Officers do?
boolean hasResponse8 = false;
if (rebel_general_condition_isOfficerPlayer (player, npc))
{
++numberOfResponses;
hasResponse = true;
hasResponse8 = true;
}
//-- PLAYER: I need more explosives.
boolean hasResponse9 = false;
if (rebel_general_condition_hasSpyDestroyPatrolQuestNeedsExplosives (player, npc))
{
++numberOfResponses;
hasResponse = true;
hasResponse9 = true;
}
//-- PLAYER: What do I need to do for the scout quest again?
boolean hasResponse10 = false;
if (rebel_general_condition_hasSpyScoutPatrolQuest (player, npc))
{
++numberOfResponses;
hasResponse = true;
hasResponse10 = true;
}
//-- PLAYER: What do I need to do for the destroy quest again?
boolean hasResponse11 = false;
if (rebel_general_condition_hasSpyDestroyPatrolQuest (player, npc))
{
++numberOfResponses;
hasResponse = true;
hasResponse11 = true;
}
if (hasResponse)
{
int responseIndex = 0;
string_id responses [] = new string_id [numberOfResponses];
if (hasResponse0)
responses [responseIndex++] = new string_id (c_stringFile, "s_149");
if (hasResponse1)
responses [responseIndex++] = new string_id (c_stringFile, "s_146");
if (hasResponse2)
responses [responseIndex++] = new string_id (c_stringFile, "s_151");
if (hasResponse3)
responses [responseIndex++] = new string_id (c_stringFile, "s_156");
if (hasResponse4)
responses [responseIndex++] = new string_id (c_stringFile, "s_161");
if (hasResponse5)
responses [responseIndex++] = new string_id (c_stringFile, "s_166");
if (hasResponse6)
responses [responseIndex++] = new string_id (c_stringFile, "s_134");
if (hasResponse7)
responses [responseIndex++] = new string_id (c_stringFile, "s_289");
if (hasResponse8)
responses [responseIndex++] = new string_id (c_stringFile, "s_299");
if (hasResponse9)
responses [responseIndex++] = new string_id (c_stringFile, "s_137");
if (hasResponse10)
responses [responseIndex++] = new string_id (c_stringFile, "s_140");
if (hasResponse11)
responses [responseIndex++] = new string_id (c_stringFile, "s_141");
utils.setScriptVar (player, "conversation.rebel_general.branchId", 38);
npcStartConversation (player, npc, "rebel_general", message, responses);
}
else
{
chat.chat (npc, player, message);
}
return SCRIPT_CONTINUE;
}
//-- [NOTE]
if (rebel_general_condition__defaultCondition (player, npc))
{
//-- NPC: I suggest you evacuate the area citizen. This is no place to be curious.
string_id message = new string_id (c_stringFile, "s_310");
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 != "rebel_general")
return SCRIPT_CONTINUE;
obj_id npc = self;
int branchId = utils.getIntScriptVar (player, "conversation.rebel_general.branchId");
if (branchId == 1 && rebel_general_handleBranch1 (player, npc, response) == SCRIPT_CONTINUE)
return SCRIPT_CONTINUE;
if (branchId == 2 && rebel_general_handleBranch2 (player, npc, response) == SCRIPT_CONTINUE)
return SCRIPT_CONTINUE;
if (branchId == 3 && rebel_general_handleBranch3 (player, npc, response) == SCRIPT_CONTINUE)
return SCRIPT_CONTINUE;
if (branchId == 4 && rebel_general_handleBranch4 (player, npc, response) == SCRIPT_CONTINUE)
return SCRIPT_CONTINUE;
if (branchId == 11 && rebel_general_handleBranch11 (player, npc, response) == SCRIPT_CONTINUE)
return SCRIPT_CONTINUE;
if (branchId == 38 && rebel_general_handleBranch38 (player, npc, response) == SCRIPT_CONTINUE)
return SCRIPT_CONTINUE;
chat.chat (npc, "Error: Fell through all branches and responses for OnNpcConversationResponse.");
utils.removeScriptVar (player, "conversation.rebel_general.branchId");
return SCRIPT_CONTINUE;
}
// ======================================================================