Jump to content

Creature Scripts


Recommended Posts

All of those scripts are run by the creature, unless some state prevents them from running. These scripts have a priority order, which is almost the same as the order they appear in the creature file. Run a block in a higher-priority script, and everything later in that script or in lower-priority scripts is preempted unless the block you ran had a Continue().

That priority order: Override > Area > Specifics > Class > Race > General > Default.

Five of these appear in the CRE files. The "Specifics" slot is normally set by a creature's actor entry in an area file, when it's present. The "Area" slot is ... actually, I'm not sure here. Anything I write would be speculation. Any of these can also be set by an opcode or script action, though the "Area" and "Specifics" slots can't be used for global creatures such as party members and don't persist when loading saves.

If you want to remove a creature's script, you don't write "None". You write an empty string:

WRITE_ASCII 0x260 ~~ #8

The #8 is important here, telling you to pad the string out with nulls to a size of 8. If you write a short string without the #, you might fail to write over some later parts of what's there already, leaving unintended rubbish in the entry you're writing to and causing problems.

Another thing to note: for party members, everything but the override slot will be altered during gameplay. The "Class" slot is used for the party member's combat script, which can be altered with the in-game customization menus; the standard "advanced" script is set based on PARTYAI.2DA whenever you load a save. The "Race" and "General" slots are nulled whenever you load a save. Finally, the "Default" slot is used for DPLAYER2 (recruited NPCs) or DPLAYER3 (created party members). This is set when they join the party and unset when they leave it. Even the override slot can be altered in some circumstances; the transition from BG1 to SoD or SoA to ToB will have recruited NPCs update their dialogue scripts.

Edited by jmerry
Link to comment

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...