Files
dsrc/sku.0/sys.server/compiled/game/script/conversation/imperial_general.script
T

2293 lines
71 KiB
Plaintext

// ======================================================================
//
// imperial_general.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.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/imperial_general";
// ======================================================================
// Script Conditions
// ======================================================================
boolean imperial_general_condition__defaultCondition (obj_id player, obj_id npc)
{
return true;
}
// ----------------------------------------------------------------------
boolean imperial_general_condition_isEntertainerPlayer (obj_id player, obj_id npc)
{
faceTo(npc, player);
return utils.isProfession(player, utils.ENTERTAINER);
}
// ----------------------------------------------------------------------
boolean imperial_general_condition_isPlayerImperial (obj_id player, obj_id npc)
{
faceTo(npc, player);
return (factions.isImperial(player) || factions.isPlayerSameGcwFactionAsSchedulerObject(player, npc));
}
// ----------------------------------------------------------------------
boolean imperial_general_condition_isPlayerRebel (obj_id player, obj_id npc)
{
faceTo(npc, player);
return (factions.isRebel(player) || factions.isPlayerSameGcwFactionAsSchedulerObject(player, npc));
}
// ----------------------------------------------------------------------
boolean imperial_general_condition_isPlayerNeutral (obj_id player, obj_id npc)
{
faceTo(npc, player);
return(!factions.isImperial(player) && !factions.isRebel(player) && pvpNeutralGetMercenaryFaction(player) == 0);
}
// ----------------------------------------------------------------------
boolean imperial_general_condition_isTraderPlayer (obj_id player, obj_id npc)
{
faceTo(npc, player);
return utils.isProfession(player, utils.TRADER);
}
// ----------------------------------------------------------------------
boolean imperial_general_condition_isForceSensitivePlayer (obj_id player, obj_id npc)
{
faceTo(npc, player);
return utils.isProfession(player, utils.FORCE_SENSITIVE);
}
// ----------------------------------------------------------------------
boolean imperial_general_condition_isSmugglerPlayer (obj_id player, obj_id npc)
{
faceTo(npc, player);
return utils.isProfession(player, utils.SMUGGLER);
}
// ----------------------------------------------------------------------
boolean imperial_general_condition_isMedicPlayer (obj_id player, obj_id npc)
{
faceTo(npc, player);
return utils.isProfession(player, utils.MEDIC);
}
// ----------------------------------------------------------------------
boolean imperial_general_condition_isOfficerPlayer (obj_id player, obj_id npc)
{
faceTo(npc, player);
return utils.isProfession(player, utils.OFFICER);
}
// ----------------------------------------------------------------------
boolean imperial_general_condition_isSpyPlayer (obj_id player, obj_id npc)
{
faceTo(npc, player);
return utils.isProfession(player, utils.SPY);
}
// ----------------------------------------------------------------------
boolean imperial_general_condition_isBountyHunterPlayer (obj_id player, obj_id npc)
{
faceTo(npc, player);
return utils.isProfession(player, utils.BOUNTY_HUNTER);
}
// ----------------------------------------------------------------------
boolean imperial_general_condition_isCommandoPlayer (obj_id player, obj_id npc)
{
faceTo(npc, player);
return utils.isProfession(player, utils.COMMANDO);
}
// ----------------------------------------------------------------------
boolean imperial_general_condition_generalIsOffensive (obj_id player, obj_id npc)
{
return (hasObjVar(npc, "offense") && getIntObjVar(npc, "offense") == 1);
}
// ----------------------------------------------------------------------
boolean imperial_general_condition_generalIsImperial (obj_id player, obj_id npc)
{
return (hasObjVar(npc, "factionFlag") && getIntObjVar(npc, "factionFlag") == factions.FACTION_FLAG_IMPERIAL);
}
// ----------------------------------------------------------------------
boolean imperial_general_condition_generalIsDefensive (obj_id player, obj_id npc)
{
return (hasObjVar(npc, "offense") && getIntObjVar(npc, "offense") == 0);
}
// ----------------------------------------------------------------------
boolean imperial_general_condition_generalIsRebel (obj_id player, obj_id npc)
{
return (hasObjVar(npc, "factionFlag") && getIntObjVar(npc, "factionFlag") == factions.FACTION_FLAG_REBEL);
}
// ----------------------------------------------------------------------
boolean imperial_general_condition_isGeneralRebAndOffense (obj_id player, obj_id npc)
{
return imperial_general_condition_isPlayerRebel(player, npc) && imperial_general_condition_generalIsRebel(player, npc) && imperial_general_condition_generalIsOffensive(player, npc);
}
// ----------------------------------------------------------------------
boolean imperial_general_condition_isConstructionPhase (obj_id player, obj_id npc)
{
return (gcw.getGcwCityInvasionPhase(npc) == gcw.GCW_CITY_PHASE_CONSTRUCTION);
}
// ----------------------------------------------------------------------
boolean imperial_general_condition_isCombatPhase (obj_id player, obj_id npc)
{
return (gcw.getGcwCityInvasionPhase(npc) == gcw.GCW_CITY_PHASE_COMBAT);
}
// ----------------------------------------------------------------------
boolean imperial_general_condition_isGeneralRebAndDefense (obj_id player, obj_id npc)
{
return imperial_general_condition_isPlayerRebel(player, npc) && imperial_general_condition_generalIsRebel(player, npc) && imperial_general_condition_generalIsDefensive(player, npc);
}
// ----------------------------------------------------------------------
boolean imperial_general_condition_isGeneralImpAndOffense (obj_id player, obj_id npc)
{
return imperial_general_condition_isPlayerImperial(player, npc) && imperial_general_condition_generalIsImperial(player, npc) && imperial_general_condition_generalIsOffensive(player, npc);
}
// ----------------------------------------------------------------------
boolean imperial_general_condition_isGeneralImpAndDefense (obj_id player, obj_id npc)
{
return imperial_general_condition_isPlayerImperial(player, npc) && imperial_general_condition_generalIsImperial(player, npc) && imperial_general_condition_generalIsDefensive(player, npc);
}
// ----------------------------------------------------------------------
boolean imperial_general_condition_hasImperialQuest (obj_id player, obj_id npc)
{
return imperial_general_condition_isPlayerImperial(player, npc)
&& (imperial_general_condition_hasSpyScoutPatrolQuest(player, npc)
|| imperial_general_condition_hasSpyDestroyPatrolQuest(player, npc)
|| imperial_general_condition_hasSpyDestroyPatrolQuestNeedsExplosives(player, npc)
|| imperial_general_condition_hasDestroyBarricadeQuest(player, npc)
|| imperial_general_condition_hasDestroyTurretQuest(player, npc)
);
}
// ----------------------------------------------------------------------
boolean imperial_general_condition_hasSpyScoutPatrolQuest (obj_id player, obj_id npc)
{
return imperial_general_condition_isSpyPlayer(player, npc)
&& groundquests.isQuestActive(player, gcw.GCW_SPY_PATROL_SCOUT_QUEST);
}
// ----------------------------------------------------------------------
boolean imperial_general_condition_hasSpyDestroyPatrolQuestNeedsExplosives (obj_id player, obj_id npc)
{
return imperial_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 imperial_general_condition_hasSpyDestroyPatrolQuest (obj_id player, obj_id npc)
{
return imperial_general_condition_isSpyPlayer(player, npc)
&& groundquests.isQuestActive(player, gcw.GCW_SPY_PATROL_DESTROY_QUEST);
}
// ----------------------------------------------------------------------
boolean imperial_general_condition_hasDestroyTurretQuest (obj_id player, obj_id npc)
{
return groundquests.isQuestActive(player, gcw.GCW_DESTROY_TURRET);
}
// ----------------------------------------------------------------------
boolean imperial_general_condition_hasDestroyBarricadeQuest (obj_id player, obj_id npc)
{
return groundquests.isQuestActive(player, gcw.GCW_DESTROY_BARRICADE);
}
// ----------------------------------------------------------------------
boolean imperial_general_condition_hasDestroyQuest (obj_id player, obj_id npc)
{
return imperial_general_condition_hasSpyDestroyPatrolQuest(player, npc)
|| imperial_general_condition_hasDestroyTurretQuest(player, npc)
|| imperial_general_condition_hasDestroyBarricadeQuest(player, npc);
}
// ----------------------------------------------------------------------
boolean imperial_general_condition_enemyPatrolPointsExist (obj_id player, obj_id npc)
{
obj_id parent = trial.getParent(npc);
if(!isValidId(parent) || !exists(parent))
{
return false;
}
if(imperial_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(imperial_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 imperial_general_condition_enemyPatrolsExistAndIsCombatPhase (obj_id player, obj_id npc)
{
return (imperial_general_condition_enemyPatrolPointsExist(player, npc) && imperial_general_condition_isCombatPhase(player, npc));
}
// ----------------------------------------------------------------------
boolean imperial_general_condition_enemyPatrolPointsDestroyed (obj_id player, obj_id npc)
{
return (imperial_general_condition_isCombatPhase(player, npc) && !imperial_general_condition_enemyPatrolPointsExist(player, npc));
}
// ----------------------------------------------------------------------
boolean imperial_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 imperial_general_condition_patrolPointsExistNoScoutQuest (obj_id player, obj_id npc)
{
return imperial_general_condition_enemyPatrolPointsExist(player, npc)
&& !groundquests.isQuestActive(player, gcw.GCW_SPY_PATROL_SCOUT_QUEST);
}
// ----------------------------------------------------------------------
boolean imperial_general_condition_patrolPointsExistNoDestroyQuest (obj_id player, obj_id npc)
{
return imperial_general_condition_enemyPatrolPointsExist(player, npc)
&& !groundquests.isQuestActive(player, gcw.GCW_SPY_PATROL_DESTROY_QUEST);
}
// ======================================================================
// Script Actions
// ======================================================================
void imperial_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 imperial_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 imperial_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 imperial_general_action_grantMoreSpyDestroyPatrolExplosives (obj_id player, obj_id npc)
{
buff.applyBuffWithStackCount(player, gcw.BUFF_SPY_EXPLOSIVES, 5);
}
// ----------------------------------------------------------------------
void imperial_general_action_grantCombatDestroyBarricade (obj_id player, obj_id npc)
{
if(groundquests.isQuestActive(player, gcw.GCW_DESTROY_BARRICADE))
return;
if(groundquests.hasCompletedQuest(player, gcw.GCW_DESTROY_BARRICADE))
{
groundquests.clearQuest(player, gcw.GCW_DESTROY_BARRICADE);
}
groundquests.grantQuest(player, gcw.GCW_DESTROY_BARRICADE);
}
// ----------------------------------------------------------------------
void imperial_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 imperial_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 imperial_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 imperial_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 imperial_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_REBELS))
{
if(groundquests.hasCompletedQuest(player, gcw.GCW_ELIMINATE_REBELS))
{
groundquests.clearQuest(player, gcw.GCW_ELIMINATE_REBELS);
}
groundquests.grantQuest(player, gcw.GCW_ELIMINATE_REBELS);
}
}
// ----------------------------------------------------------------------
void imperial_general_action_makeImpMercCombatant (obj_id player, obj_id npc)
{
factions.setNeturalMercenaryCovert(player, factions.FACTION_FLAG_IMPERIAL);
}
// ----------------------------------------------------------------------
void imperial_general_action_makeImpMercSF (obj_id player, obj_id npc)
{
factions.setNeturalMercenaryOvert(player, factions.FACTION_FLAG_IMPERIAL);
}
// ----------------------------------------------------------------------
void imperial_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_REBELS))
{
if(groundquests.hasCompletedQuest(player, gcw.GCW_ELIMINATE_REBELS))
{
groundquests.clearQuest(player, gcw.GCW_ELIMINATE_REBELS);
}
groundquests.grantQuest(player, gcw.GCW_ELIMINATE_REBELS);
}
if(!groundquests.isQuestActive(player, gcw.GCW_SPY_PATROL_DESTROY_QUEST) && imperial_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) && imperial_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 imperial_general_action_grantDefensiveSpyQuests (obj_id player, obj_id npc)
{
if(!groundquests.isQuestActive(player, gcw.GCW_ELIMINATE_REBELS))
{
if(groundquests.hasCompletedQuest(player, gcw.GCW_ELIMINATE_REBELS))
{
groundquests.clearQuest(player, gcw.GCW_ELIMINATE_REBELS);
}
groundquests.grantQuest(player, gcw.GCW_ELIMINATE_REBELS);
}
if(!groundquests.isQuestActive(player, gcw.GCW_SPY_PATROL_DESTROY_QUEST) && imperial_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) && imperial_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 imperial_general_handleBranch1 (obj_id player, obj_id npc, string_id response)
{
//-- [BRANCH NOTE]
//-- NPC: Yes, citizen?
//-- [RESPONSE NOTE]
//-- PLAYER: I'd like to help the Empire but remain neutral.
if (response == "s_28")
{
//-- [NOTE]
if (imperial_general_condition__defaultCondition (player, npc))
{
//-- NPC: There is no such thing as neutral in this conflict. You either support terrorism or abhor it. As far as incentives, we reward those who support the Empire.
string_id message = new string_id (c_stringFile, "s_30");
int numberOfResponses = 0;
boolean hasResponse = false;
//-- PLAYER: Can I temporarily help the Empire?
boolean hasResponse0 = false;
if (imperial_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_111");
utils.setScriptVar (player, "conversation.imperial_general.branchId", 2);
npcSpeak (player, message);
npcSetConversationResponses (player, responses);
}
else
{
utils.removeScriptVar (player, "conversation.imperial_general.branchId");
npcEndConversationWithMessage (player, message);
}
return SCRIPT_CONTINUE;
}
}
return SCRIPT_DEFAULT;
}
// ----------------------------------------------------------------------
int imperial_general_handleBranch2 (obj_id player, obj_id npc, string_id response)
{
//-- [BRANCH NOTE]
//-- NPC: There is no such thing as neutral in this conflict. You either support terrorism or abhor it. As far as incentives, we reward those who support the Empire.
//-- [RESPONSE NOTE]
//-- PLAYER: Can I temporarily help the Empire?
if (response == "s_111")
{
//-- [NOTE]
if (imperial_general_condition_canBeMerc (player, npc))
{
//-- NPC: We encourage volunteers to pledge support by joining our ranks...but, if that feels like too much a commitment we also hire mercenaries.
string_id message = new string_id (c_stringFile, "s_112");
int numberOfResponses = 0;
boolean hasResponse = false;
//-- PLAYER: I'm interested in being a mercenary.
boolean hasResponse0 = false;
if (imperial_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_113");
utils.setScriptVar (player, "conversation.imperial_general.branchId", 3);
npcSpeak (player, message);
npcSetConversationResponses (player, responses);
}
else
{
utils.removeScriptVar (player, "conversation.imperial_general.branchId");
npcEndConversationWithMessage (player, message);
}
return SCRIPT_CONTINUE;
}
//-- [NOTE]
if (imperial_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_125");
utils.removeScriptVar (player, "conversation.imperial_general.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
}
return SCRIPT_DEFAULT;
}
// ----------------------------------------------------------------------
int imperial_general_handleBranch3 (obj_id player, obj_id npc, string_id response)
{
//-- [BRANCH NOTE]
//-- NPC: We encourage volunteers to pledge support by joining our ranks...but, if that feels like too much a commitment we also hire mercenaries.
//-- [RESPONSE NOTE]
//-- PLAYER: I'm interested in being a mercenary.
if (response == "s_113")
{
//-- [NOTE]
if (imperial_general_condition__defaultCondition (player, npc))
{
//-- NPC: If you join us as a mercenary you will not receive Imperial Rank. On the other hand, you will be eligible for any rewards we sell our troops. Are you still interested?
string_id message = new string_id (c_stringFile, "s_115");
int numberOfResponses = 0;
boolean hasResponse = false;
//-- PLAYER: Yes.
boolean hasResponse0 = false;
if (imperial_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_116");
utils.setScriptVar (player, "conversation.imperial_general.branchId", 4);
npcSpeak (player, message);
npcSetConversationResponses (player, responses);
}
else
{
utils.removeScriptVar (player, "conversation.imperial_general.branchId");
npcEndConversationWithMessage (player, message);
}
return SCRIPT_CONTINUE;
}
}
return SCRIPT_DEFAULT;
}
// ----------------------------------------------------------------------
int imperial_general_handleBranch4 (obj_id player, obj_id npc, string_id response)
{
//-- [BRANCH NOTE]
//-- NPC: If you join us as a mercenary you will not receive Imperial Rank. On the other hand, you will be eligible for any rewards we sell our troops. Are you still interested?
//-- [RESPONSE NOTE]
//-- PLAYER: Yes.
if (response == "s_116")
{
//-- [NOTE]
if (imperial_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_118");
int numberOfResponses = 0;
boolean hasResponse = false;
//-- PLAYER: Special Forces
boolean hasResponse0 = false;
if (imperial_general_condition__defaultCondition (player, npc))
{
++numberOfResponses;
hasResponse = true;
hasResponse0 = true;
}
//-- PLAYER: Combatant
boolean hasResponse1 = false;
if (imperial_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_119");
if (hasResponse1)
responses [responseIndex++] = new string_id (c_stringFile, "s_120");
utils.setScriptVar (player, "conversation.imperial_general.branchId", 5);
npcSpeak (player, message);
npcSetConversationResponses (player, responses);
}
else
{
utils.removeScriptVar (player, "conversation.imperial_general.branchId");
npcEndConversationWithMessage (player, message);
}
return SCRIPT_CONTINUE;
}
//-- [NOTE]
if (imperial_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_130");
utils.removeScriptVar (player, "conversation.imperial_general.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
}
return SCRIPT_DEFAULT;
}
// ----------------------------------------------------------------------
int imperial_general_handleBranch5 (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_119")
{
//-- [NOTE]
if (imperial_general_condition_canBeMerc (player, npc))
{
imperial_general_action_makeImpMercSF (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_123");
utils.removeScriptVar (player, "conversation.imperial_general.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
//-- [NOTE]
if (imperial_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_131");
utils.removeScriptVar (player, "conversation.imperial_general.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
}
//-- [RESPONSE NOTE]
//-- PLAYER: Combatant
if (response == "s_120")
{
//-- [NOTE]
if (imperial_general_condition_canBeMerc (player, npc))
{
doAnimationAction (npc, "handshake_tandem");
doAnimationAction (player, "handshake_tandem");
imperial_general_action_makeImpMercCombatant (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_122");
utils.removeScriptVar (player, "conversation.imperial_general.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
//-- [NOTE]
if (imperial_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_132");
utils.removeScriptVar (player, "conversation.imperial_general.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
}
return SCRIPT_DEFAULT;
}
// ----------------------------------------------------------------------
int imperial_general_handleBranch12 (obj_id player, obj_id npc, string_id response)
{
//-- [BRANCH NOTE]
//-- NPC: Imperial 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_23")
{
//-- [NOTE]
if (imperial_general_condition_isCombatPhase (player, npc))
{
imperial_general_action_grantEntertainerQuests (player, npc);
//-- NPC: Performing at a patrol point will help our forces. Use a patrol point and you will be issued orders and details on what needs to be done. We also need entertainers to rally any troops who are losing heart in the battlefield and we still need fatigue removed from the people building and repairing our structures.
string_id message = new string_id (c_stringFile, "s_26");
utils.removeScriptVar (player, "conversation.imperial_general.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
//-- [NOTE]
if (imperial_general_condition_isConstructionPhase (player, npc))
{
imperial_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_185");
utils.removeScriptVar (player, "conversation.imperial_general.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
}
//-- [RESPONSE NOTE]
//-- PLAYER: What can Traders do?
if (response == "s_34")
{
//-- [NOTE]
if (imperial_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_36");
utils.removeScriptVar (player, "conversation.imperial_general.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
//-- [NOTE]
if (imperial_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.imperial_general.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
}
//-- [RESPONSE NOTE]
//-- PLAYER: I'm a commando, what can I do?
if (response == "s_39")
{
//-- [NOTE]
if (imperial_general_condition_isCombatPhase (player, npc))
{
imperial_general_action_grantCombatQuests (player, npc);
//-- NPC: You will crush these rebel scumbags with impunity, Soldier! Destroy their turrets and barricades to soften their defenses!
string_id message = new string_id (c_stringFile, "s_172");
utils.removeScriptVar (player, "conversation.imperial_general.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
//-- [NOTE]
if (imperial_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_213");
utils.removeScriptVar (player, "conversation.imperial_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 (imperial_general_condition_isCombatPhase (player, npc))
{
imperial_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_187");
utils.removeScriptVar (player, "conversation.imperial_general.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
//-- [NOTE]
if (imperial_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_215");
utils.removeScriptVar (player, "conversation.imperial_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 (imperial_general_condition_isCombatPhase (player, npc))
{
imperial_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_190");
utils.removeScriptVar (player, "conversation.imperial_general.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
//-- [NOTE]
if (imperial_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_217");
utils.removeScriptVar (player, "conversation.imperial_general.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
}
//-- [RESPONSE NOTE]
//-- PLAYER: Where's my target?
if (response == "s_71")
{
//-- [NOTE]
if (imperial_general_condition_isCombatPhase (player, npc))
{
imperial_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_193");
utils.removeScriptVar (player, "conversation.imperial_general.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
//-- [NOTE]
if (imperial_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_219");
utils.removeScriptVar (player, "conversation.imperial_general.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
}
//-- [RESPONSE NOTE]
//-- PLAYER: Need intelligence on the enemy, sir?
if (response == "s_81")
{
//-- [NOTE]
if (imperial_general_condition_isCombatPhase (player, npc))
{
imperial_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_196");
utils.removeScriptVar (player, "conversation.imperial_general.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
//-- [NOTE]
if (imperial_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_221");
utils.removeScriptVar (player, "conversation.imperial_general.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
}
//-- [RESPONSE NOTE]
//-- PLAYER: Medic reporting, sir!
if (response == "s_102")
{
//-- [NOTE]
if (imperial_general_condition_isCombatPhase (player, npc))
{
imperial_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_201");
utils.removeScriptVar (player, "conversation.imperial_general.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
//-- [NOTE]
if (imperial_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_223");
utils.removeScriptVar (player, "conversation.imperial_general.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
}
//-- [RESPONSE NOTE]
//-- PLAYER: Reporting, sir!
if (response == "s_114")
{
//-- [NOTE]
if (imperial_general_condition_isCombatPhase (player, npc))
{
imperial_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_204");
utils.removeScriptVar (player, "conversation.imperial_general.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
//-- [NOTE]
if (imperial_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_225");
utils.removeScriptVar (player, "conversation.imperial_general.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
}
//-- [RESPONSE NOTE]
//-- PLAYER: I need more explosives.
if (response == "s_312")
{
//-- [NOTE]
if (imperial_general_condition_enemyPatrolPointsDestroyed (player, npc))
{
imperial_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_134");
utils.removeScriptVar (player, "conversation.imperial_general.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
//-- [NOTE]
if (imperial_general_condition__defaultCondition (player, npc))
{
imperial_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.imperial_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 (imperial_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_135");
utils.removeScriptVar (player, "conversation.imperial_general.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
//-- [NOTE]
if (imperial_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.imperial_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 (imperial_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.imperial_general.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
//-- [NOTE]
if (imperial_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.imperial_general.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
//-- [NOTE]
if (imperial_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_136");
utils.removeScriptVar (player, "conversation.imperial_general.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
//-- [NOTE]
if (imperial_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.imperial_general.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
}
return SCRIPT_DEFAULT;
}
// ----------------------------------------------------------------------
int imperial_general_handleBranch39 (obj_id player, obj_id npc, string_id response)
{
//-- [BRANCH NOTE]
//-- NPC: Imperial Command has issued a directive enabling me to recruit any personnel to lend a hand for the defense of this city.
//-- [RESPONSE NOTE]
//-- PLAYER: What can Entertainers do?
if (response == "s_126")
{
//-- [NOTE]
if (imperial_general_condition_isCombatPhase (player, npc))
{
imperial_general_action_grantEntertainerQuests (player, npc);
//-- NPC: Performing at a patrol point will help our forces. Use a patrol point and you will be issued orders and details on what needs to be done. We also need entertainers to rally any troops who are losing heart in the battlefield and we still need fatigue removed from the people building and repairing our structures.
string_id message = new string_id (c_stringFile, "s_157");
utils.removeScriptVar (player, "conversation.imperial_general.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
//-- [NOTE]
if (imperial_general_condition_isConstructionPhase (player, npc))
{
imperial_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_159");
utils.removeScriptVar (player, "conversation.imperial_general.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
}
//-- [RESPONSE NOTE]
//-- PLAYER: What can Traders do?
if (response == "s_146")
{
//-- [NOTE]
if (imperial_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.imperial_general.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
//-- [NOTE]
if (imperial_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_181");
utils.removeScriptVar (player, "conversation.imperial_general.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
}
//-- [RESPONSE NOTE]
//-- PLAYER: What can Commandos do?
if (response == "s_151")
{
//-- [NOTE]
if (imperial_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.imperial_general.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
//-- [NOTE]
if (imperial_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_209");
utils.removeScriptVar (player, "conversation.imperial_general.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
}
//-- [RESPONSE NOTE]
//-- PLAYER: What can Jedi do?
if (response == "s_156")
{
//-- [NOTE]
if (imperial_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.imperial_general.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
//-- [NOTE]
if (imperial_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_211");
utils.removeScriptVar (player, "conversation.imperial_general.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
}
//-- [RESPONSE NOTE]
//-- PLAYER: What can Smugglers do?
if (response == "s_161")
{
//-- [NOTE]
if (imperial_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.imperial_general.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
//-- [NOTE]
if (imperial_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_227");
utils.removeScriptVar (player, "conversation.imperial_general.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
}
//-- [RESPONSE NOTE]
//-- PLAYER: What can Bounty Hunters do?
if (response == "s_166")
{
//-- [NOTE]
if (imperial_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_168");
utils.removeScriptVar (player, "conversation.imperial_general.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
//-- [NOTE]
if (imperial_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_229");
utils.removeScriptVar (player, "conversation.imperial_general.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
}
//-- [RESPONSE NOTE]
//-- PLAYER: What can Medics do?
if (response == "s_276")
{
//-- [NOTE]
if (imperial_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_286");
utils.removeScriptVar (player, "conversation.imperial_general.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
//-- [NOTE]
if (imperial_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_288");
utils.removeScriptVar (player, "conversation.imperial_general.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
}
//-- [RESPONSE NOTE]
//-- PLAYER: Need intelligence on the enemy, sir?
if (response == "s_139")
{
//-- [NOTE]
if (imperial_general_condition_isCombatPhase (player, npc))
{
imperial_general_action_grantDefensiveSpyQuests (player, npc);
//-- NPC: Your mission is to scout and sabotage patrol points.
string_id message = new string_id (c_stringFile, "s_140");
utils.removeScriptVar (player, "conversation.imperial_general.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
//-- [NOTE]
if (imperial_general_condition_isConstructionPhase (player, npc))
{
//-- NPC: Right now we are constructing defensive assets and waiting for reinforcements. You may assist our supply engineers with their construction.
string_id message = new string_id (c_stringFile, "s_141");
utils.removeScriptVar (player, "conversation.imperial_general.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
}
//-- [RESPONSE NOTE]
//-- PLAYER: What can Officers do?
if (response == "s_299")
{
//-- [NOTE]
if (imperial_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.imperial_general.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
//-- [NOTE]
if (imperial_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.imperial_general.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
}
//-- [RESPONSE NOTE]
//-- PLAYER: I need more explosives.
if (response == "s_142")
{
//-- [NOTE]
if (imperial_general_condition_enemyPatrolPointsDestroyed (player, npc))
{
imperial_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_127");
utils.removeScriptVar (player, "conversation.imperial_general.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
//-- [NOTE]
if (imperial_general_condition__defaultCondition (player, npc))
{
imperial_general_action_grantMoreSpyDestroyPatrolExplosives (player, npc);
//-- NPC: No problem...but try not to waste them alright?
string_id message = new string_id (c_stringFile, "s_149");
utils.removeScriptVar (player, "conversation.imperial_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_145")
{
//-- [NOTE]
if (imperial_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_133");
utils.removeScriptVar (player, "conversation.imperial_general.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
//-- [NOTE]
if (imperial_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_150");
utils.removeScriptVar (player, "conversation.imperial_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_147")
{
//-- [NOTE]
if (imperial_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_144");
utils.removeScriptVar (player, "conversation.imperial_general.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
//-- [NOTE]
if (imperial_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_154");
utils.removeScriptVar (player, "conversation.imperial_general.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
}
return SCRIPT_DEFAULT;
}
// ----------------------------------------------------------------------
// ======================================================================
// User Script Triggers
// ======================================================================
trigger OnInitialize ()
{
if ((!isTangible (self)) || (isPlayer (self)))
detachScript(self, "conversation.imperial_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.imperial_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 (imperial_general_condition_isPlayerNeutral (player, npc))
{
//-- NPC: Yes, citizen?
string_id message = new string_id (c_stringFile, "s_25");
int numberOfResponses = 0;
boolean hasResponse = false;
//-- PLAYER: I'd like to help the Empire but remain neutral.
boolean hasResponse0 = false;
if (imperial_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_28");
utils.setScriptVar (player, "conversation.imperial_general.branchId", 1);
npcStartConversation (player, npc, "imperial_general", message, responses);
}
else
{
chat.chat (npc, player, message);
}
return SCRIPT_CONTINUE;
}
//-- [NOTE]
if (imperial_general_condition_isGeneralImpAndOffense (player, npc))
{
//-- NPC: Imperial 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_21");
int numberOfResponses = 0;
boolean hasResponse = false;
//-- PLAYER: I'm here for my orders!
boolean hasResponse0 = false;
if (imperial_general_condition_isEntertainerPlayer (player, npc))
{
++numberOfResponses;
hasResponse = true;
hasResponse0 = true;
}
//-- PLAYER: What can Traders do?
boolean hasResponse1 = false;
if (imperial_general_condition_isTraderPlayer (player, npc))
{
++numberOfResponses;
hasResponse = true;
hasResponse1 = true;
}
//-- PLAYER: I'm a commando, what can I do?
boolean hasResponse2 = false;
if (imperial_general_condition_isCommandoPlayer (player, npc))
{
++numberOfResponses;
hasResponse = true;
hasResponse2 = true;
}
//-- PLAYER: May I lend a hand in the assault?
boolean hasResponse3 = false;
if (imperial_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 (imperial_general_condition_isSmugglerPlayer (player, npc))
{
++numberOfResponses;
hasResponse = true;
hasResponse4 = true;
}
//-- PLAYER: Where's my target?
boolean hasResponse5 = false;
if (imperial_general_condition_isBountyHunterPlayer (player, npc))
{
++numberOfResponses;
hasResponse = true;
hasResponse5 = true;
}
//-- PLAYER: Need intelligence on the enemy, sir?
boolean hasResponse6 = false;
if (imperial_general_condition_isSpyPlayer (player, npc))
{
++numberOfResponses;
hasResponse = true;
hasResponse6 = true;
}
//-- PLAYER: Medic reporting, sir!
boolean hasResponse7 = false;
if (imperial_general_condition_isMedicPlayer (player, npc))
{
++numberOfResponses;
hasResponse = true;
hasResponse7 = true;
}
//-- PLAYER: Reporting, sir!
boolean hasResponse8 = false;
if (imperial_general_condition_isOfficerPlayer (player, npc))
{
++numberOfResponses;
hasResponse = true;
hasResponse8 = true;
}
//-- PLAYER: I need more explosives.
boolean hasResponse9 = false;
if (imperial_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 (imperial_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 (imperial_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_23");
if (hasResponse1)
responses [responseIndex++] = new string_id (c_stringFile, "s_34");
if (hasResponse2)
responses [responseIndex++] = new string_id (c_stringFile, "s_39");
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.imperial_general.branchId", 12);
npcStartConversation (player, npc, "imperial_general", message, responses);
}
else
{
chat.chat (npc, player, message);
}
return SCRIPT_CONTINUE;
}
//-- [NOTE]
if (imperial_general_condition_isGeneralImpAndDefense (player, npc))
{
//-- NPC: Imperial 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: What can Entertainers do?
boolean hasResponse0 = false;
if (imperial_general_condition_isEntertainerPlayer (player, npc))
{
++numberOfResponses;
hasResponse = true;
hasResponse0 = true;
}
//-- PLAYER: What can Traders do?
boolean hasResponse1 = false;
if (imperial_general_condition_isTraderPlayer (player, npc))
{
++numberOfResponses;
hasResponse = true;
hasResponse1 = true;
}
//-- PLAYER: What can Commandos do?
boolean hasResponse2 = false;
if (imperial_general_condition_isCommandoPlayer (player, npc))
{
++numberOfResponses;
hasResponse = true;
hasResponse2 = true;
}
//-- PLAYER: What can Jedi do?
boolean hasResponse3 = false;
if (imperial_general_condition_isForceSensitivePlayer (player, npc))
{
++numberOfResponses;
hasResponse = true;
hasResponse3 = true;
}
//-- PLAYER: What can Smugglers do?
boolean hasResponse4 = false;
if (imperial_general_condition_isSmugglerPlayer (player, npc))
{
++numberOfResponses;
hasResponse = true;
hasResponse4 = true;
}
//-- PLAYER: What can Bounty Hunters do?
boolean hasResponse5 = false;
if (imperial_general_condition_isBountyHunterPlayer (player, npc))
{
++numberOfResponses;
hasResponse = true;
hasResponse5 = true;
}
//-- PLAYER: What can Medics do?
boolean hasResponse6 = false;
if (imperial_general_condition_isMedicPlayer (player, npc))
{
++numberOfResponses;
hasResponse = true;
hasResponse6 = true;
}
//-- PLAYER: Need intelligence on the enemy, sir?
boolean hasResponse7 = false;
if (imperial_general_condition_isSpyPlayer (player, npc))
{
++numberOfResponses;
hasResponse = true;
hasResponse7 = true;
}
//-- PLAYER: What can Officers do?
boolean hasResponse8 = false;
if (imperial_general_condition_isOfficerPlayer (player, npc))
{
++numberOfResponses;
hasResponse = true;
hasResponse8 = true;
}
//-- PLAYER: I need more explosives.
boolean hasResponse9 = false;
if (imperial_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 (imperial_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 (imperial_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_126");
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_276");
if (hasResponse7)
responses [responseIndex++] = new string_id (c_stringFile, "s_139");
if (hasResponse8)
responses [responseIndex++] = new string_id (c_stringFile, "s_299");
if (hasResponse9)
responses [responseIndex++] = new string_id (c_stringFile, "s_142");
if (hasResponse10)
responses [responseIndex++] = new string_id (c_stringFile, "s_145");
if (hasResponse11)
responses [responseIndex++] = new string_id (c_stringFile, "s_147");
utils.setScriptVar (player, "conversation.imperial_general.branchId", 39);
npcStartConversation (player, npc, "imperial_general", message, responses);
}
else
{
chat.chat (npc, player, message);
}
return SCRIPT_CONTINUE;
}
//-- [NOTE]
if (imperial_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 != "imperial_general")
return SCRIPT_CONTINUE;
obj_id npc = self;
int branchId = utils.getIntScriptVar (player, "conversation.imperial_general.branchId");
if (branchId == 1 && imperial_general_handleBranch1 (player, npc, response) == SCRIPT_CONTINUE)
return SCRIPT_CONTINUE;
if (branchId == 2 && imperial_general_handleBranch2 (player, npc, response) == SCRIPT_CONTINUE)
return SCRIPT_CONTINUE;
if (branchId == 3 && imperial_general_handleBranch3 (player, npc, response) == SCRIPT_CONTINUE)
return SCRIPT_CONTINUE;
if (branchId == 4 && imperial_general_handleBranch4 (player, npc, response) == SCRIPT_CONTINUE)
return SCRIPT_CONTINUE;
if (branchId == 5 && imperial_general_handleBranch5 (player, npc, response) == SCRIPT_CONTINUE)
return SCRIPT_CONTINUE;
if (branchId == 12 && imperial_general_handleBranch12 (player, npc, response) == SCRIPT_CONTINUE)
return SCRIPT_CONTINUE;
if (branchId == 39 && imperial_general_handleBranch39 (player, npc, response) == SCRIPT_CONTINUE)
return SCRIPT_CONTINUE;
chat.chat (npc, "Error: Fell through all branches and responses for OnNpcConversationResponse.");
utils.removeScriptVar (player, "conversation.imperial_general.branchId");
return SCRIPT_CONTINUE;
}
// ======================================================================