x0_i0_henchman

This include file REPLACES the original henchman include file (nw_i0_henchman) from campaign one; both should not be included in the same script.

Many functions here have the same names/parameters as functions as nw_i0_henchman to facilitate code reuse, so dual includes will result in major compile errors due to function redefinition.

Function behavior may, and does, differ from the originals.

The primary difference is that X0 henchmen can be hired by more than one person during the course of the game. The current master of the henchman will be stored in a local variable on the henchman itself; campaign variables on the player will indicate whether the player has ever hired the henchman.

NOTE: This file includes nw_i0_generic, nw_i0_plot, nw_i0_spells and x0_i0_common.

Constants

NameValueBrief Description
DELAY_BETWEEN_RESPAWN_CHECKS3.0Amount of time to pass between respawn checks.
HENCHMEN_DIE_ANIM_DURATION6500000000.0Duration henchmen play their die animations.
MAX_RESPAWN_WAIT60.0The maximum length of time to wait before respawn.
sDeekinX0_HEN_DEEXP1 Henchmen tag.
sDornaX0_HEN_DORXP1 Henchmen tag.
sGoHomeScriptx0_ch_hen_gohomeScript name.
sHenchmanDeathVarnameNW_L_HEN_I_DIED
sHenchmanDyingVarnameX0_HEN_IS_DYING
sHenchmanKilledSuffix_GOTKILLED
sHenchmanResurrectedSuffix_RESURRECTED
sIsHiredVarnameX0_IS_CURRENTLY_HIRED
sLastMasterVarnameX0_LAST_MASTER_TAG
sStoredHenchmanVarnameX0_HEN_STORED
sXandosX0_HEN_XANXP1 Henchmen tag.
X0_NUMBER_HENCHMEN3Number of henchmen.
X2_NUMBER_HENCHMEN2This won't be the same as the GetMaxHenchmen() function due to followers.

Functions

NameBrief Description
AdjustXP2LevelsInternal function. Adjusts the levels for the henchmen.
brentDebugInternal function. Commented out SendMessageToPC message to GetFirstPC.
CopyHenchmanLocalsCopy all henchman-related local variables from source to target. Used when henchmen level up to keep variables consistent between the two copies of the henchman. This is a good function to look at to see what the local variables used on henchmen are.
DoLevelUpIf you want a function that will return OBJECT_INVALID no matter what parameters you send it, this one is for you!

There is a different version located in nw_i0_henchman.
DoRespawnThis function actually invokes the respawn.
DoRespawnCheckPerform a single respawn check -- this function works in a circle with RespawnCheck.
FireHenchmanUse to fire the henchman.
GetCanLevelUpIf you want a function that will return FALSE no matter what parameters you send it, this one is for you!

There is a different version located in nw_i0_henchman.
GetDidDieReturns TRUE if the henchman died. UNLIKE original in nw_i0_henchman, does NOT reset the value -- use SetDidDie(FALSE) to do that.
GetDidQuitDetermine if the henchman quit.
GetDialogFileInternal function. Returns dialog file to use based on the state of the henchmen.
GetDialogFileToUseInternal function. Returns the filename for the appropriate dialog file to be used. Henchmen have various dialog files throughout the game.
GetHasMaxWaitPassedSee if our maximum wait time has passed.
GetHasMetReturns TRUE if the player has met this henchman. This uses local variables, not campaign variables.
GetIsFollowerReturns TRUE if oHench is a follower.
GetIsHenchmanDyingDetermine if this henchman is currently dying.
GetIsHiredReturns TRUE if the henchman is currently hired.
GetKilledDetermine if this PC got the henchman killed.
GetLastMasterReturns the last master of this henchman (useful for death situations).
GetPlayerHasHiredDetermine whether the player has ever hired this henchman.
GetPlayerHasHiredInCampaignIndicate whether the player has ever hired this henchman in this campaign.
GetResurrectedDetermine if this PC resurrected the henchman.
GetWorkingForPlayerDetermine whether the henchman is currently working for this PC.

Returns FALSE if(!GetIsObjectValid(oHench) || !GetIsObjectValid(oPC)).

Returns TRUE if(GetMaster(oHench) == oPC).
HireHenchmanCan be used for both initial hiring and rejoining.
KeepDeadKeep dead by playing the appropriate death animation for the maximum wait until respawn.
LevelHenchmanUpToLevels a henchman up to the given level, alternating between the first and second classes if they are multiclassed.
LevelUpAribethInternal function. Initial Aribeth you meet in Chapter 3. Levels her up to level 16 Paladin, Level 6 Blackguard.
LevelUpXP1HenchmanLevels up the henchman assigned to oPC.
PartialResInternal function. Does a partial restoration to get rid of negative effects.
PostRespawnCleanupClean up after the respawn.
PreRespawnSetupSet up before the respawn.
QuitHenchmanUsed when the henchman quits.
RaiseForRespawnRaise and freeze henchman to 1 hp so they can be stabilized.
RemoveAllFollowersRemoves all followers. If bRemoveAll = TRUE then remove normal henchies too.
RespawnCheckDo the checking to see if we respawn -- this function works in a circle with DoRespawnCheck.
RespawnHenchmanRespawn the henchman, by preference at the master's current respawn point, or at the henchman's starting location otherwise.
RetrieveCampaignHenchmanCall this function when a PC enters a sequel module to restore the henchman (complete with inventory). The function StoreCampaignHenchman must have been called first, and both modules must use the same campaign database. (See notes in x0_i0_campaign.)

The restored henchman will automatically be re-hired and will be created next to the PC.
RetrieveHenchmanItemsRetrieve (and then delete) all henchman inventory items out of the campaign database, putting them in the inventory of the henchman. This is paired with StoreHenchmanItems for the leveling-up process.
SetDidDieSet on the henchman to indicate they died; can also be used to unset this variable.
SetDidQuitSet whether the henchman quit this player's employ.
SetHasMetUse when the player first meets the henchman/NPC. This uses local variables, not campaign variables.
SetHenchmanDyingWrapper function added to fix bugs in the dying-state process. Need to figure out whenever his value changes.
SetIsFollowerSets whether oHench is a follower or not.
SetKilledSet got killed.
SetLastMasterSet the last master.
SetNumberOfRandomInternal function. Sets the number of random popups or interjections that the henchman has. Should be called in henchman spawn scripts.
SetPlayerHasHiredIndicate whether the player has ever hired this henchman.
SetPlayerHasHiredInCampaignIndicate whether the player has ever hired this henchman in this campaign.
SetResurrectedSet that this PC resurrected the henchman.
StopKeepingDeadStop keeping dead by playing the 'woozy' standing animation.
StoreCampaignHenchmanCall this function when the PC is about to leave a module to enable restoration of the henchman on re-entry into the sequel module. Both modules must use the same campaign database for this to work.
StoreHenchmanItemsStore all items in the henchman's inventory in the campaign database, skipping those items which have the henchman's tag in their name. This is paired with RetrieveHenchmanItems for the leveling-up process.
WrapCommandableInternal function. Toggles the henchman's commandable status.
X2_GetNumberOfHenchmenInternal function. Count number of henchman.
X2_FireFirstHenchmanInternal function. Fires the first henchman who is not a follower.


  author: Mistress, contributor: Graewerld