Building Doors

From ALFA
Jump to: navigation, search

While the basemod contains every door listed in the DMG with appropriate settings, builders may wish to create their own doors. ALFA has scripts which provide a number of mechanics not ordinarily found in NWN, and every door has an extra set of options because of this.

As with creating new creatures, items, and so forth, the easiest way to make a new door is to copy/edit an existing one. For information on editing the settings of an existing door, skip the next section.

Creating a New Door

If you aren't editing an existing door, you will have to configure a number of options. To start off with, you'll need to make sure all of the door's event scripts are set correctly. ALFA's event scripts for doors are as follows: // Update for longer NWN2 file names

  • acf_door_onclosed
  • acf_door_onconversation
  • acf_door_ondamaged
  • acf_door_ondeath
  • acf_door_ondisarm
  • acf_door_onheartbeat
  • acf_door_onlock
  • acf_door_onmeleeattacked
  • acf_door_onopen
  • acf_door_onspellcastat
  • acf_door_ontraptriggered
  • acf_door_onunlock
  • acf_door_onused
  • acf_door_onuserdefined
  • acf_door_onclick
  • acf_door_onfailtoopen

If you want to add custom event scripts to your doors, you can of course do so. Just make sure each event script includes the file acr_door_i.nss, and calls the appropriate function for that event, listed here.

  • ACR_DoorOnClosed()
  • ACR_DoorOnConversation()
  • ACR_DoorOnDamaged()
  • ACR_DoorOnDeath()
  • ACR_DoorOnDisarm()
  • ACR_DoorOnHeartbeat()
  • ACR_DoorOnLock()
  • ACR_DoorOnMeleeAttacked()
  • ACR_DoorOnOpen()
  • ACR_DoorOnSpellCastAt()
  • ACR_DoorOnTrapTriggered()
  • ACR_DoorOnUnlock()
  • ACR_DoorOnUsed()
  • ACR_DoorOnUserDefined()
  • ACR_DoorOnClick()
  • ACR_DoorOnFailToOpen()

Again, the easiest way to do this is to edit an existing acr_door_* file and save it under a different name. Failure to properly call ALFA's door scripts can break multiple systems of the ACR. So make sure you've got them in there.

Editing Door Settings

See also: Using Local Variables

Aside from the standard NWN options of doors, we've provided a few more to give PCs and builders more options. These options can be accessed by editing the door's local variables.

  • ACR_DOOR_CLOSE_DELAY (float) The number of seconds a door will stay open before automatically closing itself. If set to zero or less than zero, the door will not close itself automatically.
  • ACR_DOOR_CLOSE_NEAR_PCS (integer) If set to 1, the door will auto-close regardless of any nearby PCs. If set to 0 (the default), the door will wait until PCs are out of visual range before closing itself.
  • ACR_DOOR_STUCK_DC (integer) If non-zero, the door is considered "stuck", and therefore cannot be opened unless forced. The value defined is the strength-check DC to "un-stick" the door. If someone tries to force a locked and stuck door open, the strength DC used is the higher of this value and ACR_DOOR_BREAK_DC. The default value is 0.
  • ACR_DOOR_BREAK_DC (integer) The DC to break open this door, as per DMG rules. Breaking open a door does not destroy it like doing damage to it would in NWN, but it does keep the door from being able to be locked again. If this value is zero, the door cannot be forced open. Valid values are from 0 to 255.
  • ACR_DOOR_FAIL_OPEN_MESSAGE (string) This is a custom message sent to PCs who try to open the door and fail. This can be used in conjunction with * ACR_DOOR_UNLOCK_PASSWORD to setup doors that require a spoken password to access (even useful for door riddles).
  • ACR_DOOR_OPEN_MESSAGE (string) This message is "spoken" by the door when it is opened. It is usually used to give the PCs a description of the area beyond an AT, if any.
  • ACR_DOOR_UNLOCK_HOUR (integer) This is the time of day (in hours) the door unlocks itself. Generally used for shops and things which are only open during certain hours of the day. It will only unlock once, so if something else locks it afterwards, it will remain locked until either another creature unlocks it, or its next unlock time. Valid values are 0 to 23. If you don't wish the door locking or unlocking itself automatically, leave both this variable and ACR_DOOR_LOCK_HOUR set to 0 (the default value).
  • ACR_DOOR_LOCK_HOUR (integer) This is the time of day (in hours) the door locks itself. Generally used for shops and things which are only open during certain hours of the day. It will only lock once, so if something else unlocks it afterwards, it will remain unlocked until either another creature locks it, or its next lock time. Valid values are 0 to 23. If you don't wish the door locking or unlocking itself automatically, leave both this variable and ACR_DOOR_UNLOCK_HOUR set to 0 (the default value).
  • ACR_DOOR_UNLOCK_SPELLID (int) This is the Spell ID for doors that require a specific spell to unlock. This will only work for spell IDs greater than 0. Be sure to set the door's default lock status to locked.
  • ACR_DOOR_UNLOCK_PASSWORD (string) This is what a player must speak to gain access to a password protected door. Leave this empty to require no password. Otherwise, be sure to set the door's default lock status to locked.
  • ACR_DOOR_AUTO_LOCK (integer) If non-zero, the door will automatically lock itself each time it is shut.
  • ACR_DOOR_LISTEN_DC_MOD (integer) This modifier is applied to creatures trying to listen to conversations occuring behind a closed doors. The DMG lists this a +5 for every door, but some customization is allowed for different door types. If undefined or set to 0, the door cannot be listened through.
  • ACR_DOOR_KNOCK_IMMUNE (integer) If nonzero, this door is immune to the spell knock. If zero, it is not immune.
  • ACR_DOOR_UNMOVABLE (integer) If nonzero, the door cannot be opened or closed by a non-DM creature, even if unlocked. Scripts can still open or close it, however. This setting is often used to represent large doors which a PC could not realistically close on their own even if they were unlocked, like the huge gates on castles and other fortifications.
  • ACR_AT_SIZE (integer) If nonzero, this setting specifies the maximum sized creature which can fit through this doorway. Anything large will be given a message saying it is too large to fit inside. Valid values are as follows:
    1. Fine
    2. Diminutive
    3. Tiny
    4. Small
    5. Medium
    6. Large
    7. Huge
    8. Gargantuan
    9. Colossal

Note that currently, NWN2 does not support creature sizes of fine, diminutive, gargantuan or colossal. These values are provided here for future compatibility.

Note that if none of these variables are defined, they default to zero. So a door without them would never close or lock itself, wouldn't be stuck or barred at all, would not be able to be forced open, and wouldn't have any sort of a custom message printed if a PC failed to open it.

Detect Magic

These are advanced options for doors to register as magical to Detect Magic. A door with these variables will report to the caster if the caster passes spellcraft checks based on the power of the spell. For instance: "Abjuration Dorm has a Faint aura of Transmutation."

  • ACR_SPELLSCHOOL (integer) If the door should register to Detect Magic, use integer 1 - 9 for the school of magic of the aura. See the Detect Magic: SpellSchool Variables page for which integer calls which school of magic.
  • ACR_SPELLPOWER (integer) If the door should register to Detect Magic, use integer 1 - 9 for the spell level of the aura. See the Detect Magic page for more information.
  • ACR_SPELLSCHOOL2 (integer) If the door should register a second aura to Detect Magic, use integer 1 - 9 for the school of magic of the aura. See the Detect Magic page for which integer calls which school of magic.
  • ACR_SPELLPOWER2 (integer) If the door should register a second aura to Detect Magic, use integer 1 - 9 for the spell level of the aura. See the Detect Magic page for more information.

Tips/Troubleshooting

  • If your doorway does not seem to function properly:
  • - make sure the doorway is within a walkmesh area
  • - make sure the Interruptible box is checked
  • - make sure there is no open doorway behind it, as in a tileset doorway vs a placeable doorway
  • - a door must have current hit points >0 for it to function
  • - If your static door looks fine in the toolset but does not fill the doorway ingame, the door model defaults in static mode. Instead do not make door static and set it to locked, requires key to open to get it to look right ingame. This is especially true when you have changed the size of the door to fit the doorway. Some models work better than others. There are now placeable doors also available in the toolset.
  • - If a Half-orc cannot got through your AT make sure the receiving end is not set to position lock. Also make sure there is plenty of cleared space around the receiving door. Too little space will keep orcs and half-orcs from being able to traverse the doorway.
  • When resizing doors scales 1st and 2nd should be the same size. Otherwise your door will be a weird size when it opens. This how ever might be a useful trick when you want to emulate a door folding up or to the side.