Most of the settings of the doors are set automatically by the fixupmodule script. It will fill up the script names, set the HP, and Plot settings, add Appearance and GenericType variables and make sure each door has unique tag. It will also set all nonlocked nonlockable door to be lockable, and requiring key dm_quest_key. This way dm can lock any door and players cannot open them.
Note! Do not make any other door scripts, but use the default scripts and use the Hooks to modify the behavior of the standard scripts.
Script Slot | Script |
---|---|
OnClick | cp_g_d_click |
OnClosed | cp_g_d_closed |
OnDamaged | cp_g_d_damaged |
OnFailToOpen | cp_g_d_failtoopen |
OnLock | cp_g_d_lock |
OnOpen | cp_g_d_open |
OnUnlock | cp_g_d_unlock |
cp_g_d_click
can also be used in the OnUsed slot in case the item is placeable instead of door. All those scripts are set automatically by the fixupmodule, but you can also manually set them if you do not want to run the fixupmodule script before testing.
Following variables can be put on the doors:
Variable | Type | Description |
---|---|---|
door_keep_open | int | Setting this on door will keep the door open, i.e. no automatic closing of door. |
door_radius | float | Distance from door which is checked to see if there is someone, and if so then doors is not closed. Default is 20.0 meters. If it is < 0, then players near door are not checked at all. |
door_delay | float | Number of seconds to wait before checking whether the door should be closed. If not set then default is 180.0 seconds. If it is < 0, then doors will never be closed. |
Variable | Type | Description |
---|---|---|
destination | location | Location where you transfer when you click on the open door. This is used first if set. Then destination string tag is used next, and then the WP_ + tag of the door third. |
destination | string | Waypoint / object / door tag to where to transfer when the door is used. The nearest object is used if it is on the same area, if no object is found from the same area, then use the first object on other areas. |
adjust_distance | float | Number of meters to adjust the position of player after the jump. Default is 2.0 meters for doors, and 0.0 for others. |
adjust_direction | float | Direction where to adjust the player after the jump. Default is towards the facing of the object or away from it for doors. |
adjust_facing | float | Number of degrees to adjust the player facing after the transfer. Default is set the player facing towards to same direction as object, and then adjust it with this. For doors default is 180.0 so player is turned away from door. For other objects this is 0.0, so player is left facing to same direction as object. |
direct_transfer | int | If set on placeable then player is transfered directly to the target, otherwise the open animation is played first. For doors, trapdoors etc this should not be set, as they require the open animation, but for the tents, portals etc the open animation does not do anything so setting this will cause players to transfer on the first click. |
Variable | Type | Description |
---|---|---|
key_tags | string | Comma separated list of tags which can be used as keys. The list is checked in the order. If the tag ends with *, then any tag starting with that prefix is accepted (note, that do not put too many of those on the list, and put them as last items on the list, as those require going through the full inventory of player every time). The list can also have :baseitem at the end to limit the tag for specific baseitem type. |
key_tags_remove | string | Same as key_tags, but the object is removed after it is used as a key. Key_tags is checked first and then this. |
takekey | int | If this is set true then the KeyTag set on the door is removed after it is used to open door. |
door_lock_delay | float | Timeout after which the door is locked again in seconds. Default is 240. If it is < 0 then doors are not locked again. |
door_keep_unlocked | int | If set then door is not relocked. |
door_keep_locked | int | Door will automatically relock itself immediately when it is unlocked. |
damage_limit | int | Number of hits required to break the lock. Default is DC*DC*DC/80. If < 0, then player cannot break the lock regardless of damage. |
Variable | Type | Description |
---|---|---|
door_notice_distance | float | Number of meters how far the creatures will try to detect player if he is invisible. Default is 10.0 meters. |
door_notice_multiplier | float | Multipler for the distance in meters from the door to creature to get the DC of the SPOT check. Default is 2.0. If creature is 7 meters from door, and this is set to 2, then the DC for the creature to SPOT the door opening is 14. |
Variable | Type | Description |
---|---|---|
placeable_delay | float | Number of seconds after which the placeable is closed when open. Default is 60 seconds. |
placeable_entry_delay | float | Number of seconds after which the placeable is closed when someone enters it. Default is 10 seconds. |
open_animation | int | Animation to use to open door, defaults to ANIMATION_LOOPING_GET_MID (13), _GET_LOW = 12. |
Variable | Type | Description |
---|---|---|
door_unlock_unlinked | int | If set then do not unlock the linked door when this door is unlocked. |
door_lock_unlinked | int | If set then do not lock the linked door when this door is locked. |
Variable | Type | Description |
---|---|---|
transfer_vfx | int | Visual effect number to apply on the door when player goes through it. If 0, then no visual effect is played. |
transfer_vfx_type | int | Type of the visual effect 0 == DURATION_TYPE_INSTANT (default), 1 == DURATION_TYPE_TEMPORARY, 2 == DURATION_TYPE_PERMANENT |
transfer_vfx_duration | float | Duration of the effect (only for DURATION_TYPE_TEMPORARY, default is 0.0 seconds). |
transfer_vfx_delay | float | How much the effect is delayed. Default is 0.0 seconds. |
transfer_vfx_target* | * | Same as transfer_vfx*, but for the target door / placeable (does not work for the location). |
transfer_vfx_player* | * | Same as transfer_vfx*, but for the player going through. |
force_vfx* | * | Similar than transfer_vfx*, but for door, when player succeeds breaking the lock. |
force_vfx_player* | * | Similar than force_vfx*, but for player, when player succeeds breaking the lock. |
damage_vfx* | * | Similar than force_vfx*, but for door, when player damages it, but does not break it yet. |
damage_vfx_player* | * | Similar than damage_vfx*, but for player. |
open_vfx* | * | Similar than transfer_vfx*, but for door, when player opens it. |
open_vfx_player* | * | Similar than open_vfx*, but for player. |
lock_vfx* | * | Similar than transfer_vfx*, but for door when player locks it. |
lock_vfx_player* | * | Similar than transfer_vfx*, but for player. |
unlock_vfx* | * | Similar than transfer_vfx*, but for door when player unlocks it. |
unlock_vfx_player* | * | Similar than transfer_vfx*, but for player. |
Following variables can be on the door, and they set the hooks that will be called before the actual operation happens.
OnUsed, OnAreaTransitionClick, OnClose, OnDamaged, OnDestroyed, OnFailToOpen, OnLock, OnOpen, OnUnLock.
See hooks for more information.
Following variables are on the trigger of secret door:
Variable | Type | Description |
---|---|---|
secret_dc | int | DC of the secret, if not set use the KeyTag of trigger |
secret_skill | int | Default skill number to use for searching the secret if not set, then use SKILL_SEARCH. Cannot use ANIMAL_EMPATHY |
secret_class | int | Class who can easily detect. Use for example the numeric value of CLASS_TYPE_RANGER. |
secret_class_dc | int | DC (class level + d4) for that class to detect, must be set if secret_class is set. |
secret_locked | int | Should the secret object be revealed as locked (set to 1), or should it be left as it is now (i.e keep the status from the resref) |
secret_announce | int | if set to true, then play voice chat when the secret is found (cp_g_d_secret does this) |
secret_announce_vfx* | * | Similar than transfer_vfx*, but for player who notices the secret. |
secret_henchman_vfx* | * | Similar than transfer_vfx*, but for henchman who notices the secret. |
secret_reveal_vfx* | * | Similar than transfer_vfx*, but for secret door when it appear |
secret_reset_vfx* | * | Similar than transfer_vfx*, but for secret door when it disappears |
secret_delay | float | Amount of seconds after the door is again hidden. If < 0, then it is not hidden again. If 0 then default of 30 seconds is used. |
secret_keep | int | If set then do not hide the door. |
secret_radius | float | If player is closer than this do not hide door. If 0.0 then use default of 5.0 meters. |
location | location | Location where the secret object is created. |
location | string | Name of the waypoint where the secret object is created |
location_adj_z | float | Adjustment of the z axis for the location waypoint. |
secret_resref | string | ResRef of the secret revealed. XXX for wall doors, and cp_tk_secret_trapdoor (z-adjustment = -1.25) for trap doors (none yet) |
secret_vars | string | Comma separated list of variables to be copied from the trigger to the item created. All door related variables above are automatically copied from the trigger to door. |
reveal_tags | string | Comma separated list of tags of the items, which reveals the trigger to user without skill check if posessed by the user |
secret_tag | string | New tag for the item created. |
Variable | Type | Description |
---|---|---|
door_keep_open | int | Setting this on area will keep all doors open in the area. |
door_radius | float | Distance from door which is checked to see if there is someone, and if so then doors is not closed. Default is 20.0 meters. If it is < 0, then players near door are not checked at all. |
door_delay | float | Number of seconds to wait before checking whether the door should be closed. If not set then default is 180.0 seconds. If it is < 0, then doors will never be closed. |
door_lock_delay | float | Timeout after which the doors in the area are locked again again in seconds. Default is 240. If it is < 0 then doors are not locked again. |
door_keep_unlocked | int | Setting this on the are will keep door from locking. |
door_notice_distance | float | Number of meters how far the creatures will try to detect player if he is invisible. Default is 10.0 meters. |
door_notice_multiplier | float | Multipler for the distance in meters from the door to creature to get the DC of the SPOT check. Default is 2.0. If creature is 7 meters from door, and this is set to 2, then the DC for the creature to SPOT the door opening is 14. |
door_keep_locked | int | Door will automatically relock itself immediately when it is unlocked. |
damage_limit | int | Number of hits required to break the lock. Default is DC*DC*DC/80. If < 0, then player cannot break the lock regardless of damage. |
secret_delay | float | Amount of seconds after the door is again hidden. If < 0, then it is not hidden again. If 0 then default of 30 seconds is used. |
secret_keep | int | If set then do not hide the door. |
secret_radius | float | If player is closer than this do not hide door. If 0.0 then use default of 5.0 meters. |