Page tree
Skip to end of metadata
Go to start of metadata

The player object is considered a special kind of OBJECT_TYPE_CREATURE. There are a number of caveats and some fun things you can do to players.

The player objects are stored on disk as .BIC and are more complex GFF files than usual. Players can also export their own characters in the menu.

Player Characteristics

Players differ to monsters in some key ways, in case you ever make some generic scripts to deal with party members and assume things are equivalent between a PC and their, say, companions.

  • Obvious difference to other creatures is GetIsPC() is TRUE
    • However this sometimes is FALSE, see the Lexicon entry - the "ghosts" left as a player leaves may be FALSE.
    • Player object IDs are counted down from 7fffffff instead of being incremented from 00000000
  • Players trigger encounters marked as "Player Triggered Only"
    • Likely possessed familiars also count as a player for this check
  • GetChallengeRating() returns 0.0 for players. The game assumes GetHitDice() is equivalent for a player.
    • Players can hide their "true level" (by not levelling up) but you can get what their level should be with GetXP and calculating what the level should be.
  • Players can lose XP to the point they de-level. Their character file (.bic) actually contains a complete history of their levelups which is actually really helpful and makes this possible.
  • A players faction can change rather quickly - the faction is essentially their "party" which of course has a different leader, members depending on in MP and even SP who is added to it. The faction and reputation system is...rather quirky and not really able to handle things too well at the best of times. Most PW's make anything that stays friendly plot, and anything that is an enemy always an enemy, to make things simpler.
  • There are differences in the frequency of Spot and Listen checks compared to NPCs (detailed TBC)
  • GetTag defaults to a blank tag for players.

Players act differently when dominated / charmed compared to usual creatures:

  • (Needs more testing) Dominated or charmed acts more like a stun
  • The default game spells "scale" the effect on difficulty, and alters it when the target is a PC so it's rare anyway that they are dominated

Players can possess familiars, which is itself a very interesting mechanic and also something to be aware of:

  • GetIsPossessedFamiliar() returns TRUE in these cases. The PC object will still run scripts but essentially not be commandable by the player.
  • Can force it off (eg; pre-cutscene) with UnpossessFamiliar()

Players can have creature weapons and hides equipped (which are sometimes used to add feats or effects to the player permanently, in lieu of having any AddFeat() or EffectAddFeat() or something. The players hide needs equipping through scripts otherwise it just sits in a PCs inventory. They can't view these afterwards (Similarly a DM can't see a possessed creatures hides or weapons annoyingly!). Polymorph can sometimes mess these up.

Effects on Players

Effects have a varierty of state changes on things. Players however seem to have some exceptions from the normal changes these effects do.

The main changes appear to be around EffectCharmed and EffectDominated.

These will be documented in time - essentially though they appear to not run any statescript.2da file, and just cause the player to stand there (which itself is sometimes worse than doing a hostile action since they're considered flat footed!)

Most spell scripts change EffectDominated to the EffectDaze effect in the routine GetScaledEffect in nw_i0_spells (although this is sometimes applied improperly/wrongly).

Dungeon Masters Characteristics

A special note on dungeon master (DM) characters. These have some special properties in addition to most of the PC ones above;

  • Obviously are plot / invincible in addtion have some exceptions to any kind of effect just from being a DM
  • Will not be returned in checks of GetFirst/NextObjectInArea(), GetFirst/NextObjectInShape() or GetNearestCreature().
    • To get around this (Eg; making sure an area is clear before calling DestroyArea()) use GetFirst/NextPC() and check the area they are in. In addition use GetIsDMPossessed for anything else to make sure they're not a DM in diguise.
    • You also still have perfectly valid GetIsObjectSeen between objects if you can find them. The spells and creature AI therefore tends to ignore DMs, mostly (they can be picked up by last damager etc.)
  • Everything considers the DM faction neutral, and this can never change - the DM faction is hardcoded in th egame to be always neutral.
  • Will not trigger encounters at all
  • When possessing another creature (so GetIsDMPossessed() is true for that creature) the actual DM body is sent to Limbo which is an invalid area just storing it as a reference (check the Chooser screen for what it means here)
  • Still can show in perception events for creatures (and other events), but these are weird - don't rely on them

They of course have additional powers to create things/see triggers and traps/grant XP and gold/teleport things around/make things invincible or immortal. They also get access to most spell lists, which cheat-cast the spell to some degree (and act a bit weirdly if done from the DM themselves since they're neutral to everything). Full possessing an NPC to cast hostile spells fixes this somewhat.

The DM can also importantly disable AI of creatures - this stops the scripts of theirs running (equivalent to GetEventScript() == "") so be wary if the DM is messing with things that spawn or do stuff on death such as being plot related. There is an additional attribute that records this state in-game but it's unavailable to NWscript.

Cloning Players

A potentially useful note is you can actually use CopyObject on a PC to get a complete "clone" of them, for instance for cutscenes or even to fight against or fight with. It likely is one of the most expensive uses of the function.

The copy is converted into a storable creature object and loses the PC aspects of their original. They can be added as a henchman, and with SetEventScript can essentially be identical to a normal NPC once AI scripts are sorted. There are some likely caveats with this that need to be documented however.

  • No labels