item_key
Jump to navigation
Jump to search
Note: Targets are fired when the key is picked up.
item_key is a model entity available in
Cry of Fear.
A variant of item_security that supports displaying a custom model. When a player collects it, it can trigger another entity (like a door) or fire targets with a specified delay.
Keyvalues
- Name (targetname) <string>
- The targetname that other entities refer to this entity by, usually via the target, killtarget, and TriggerTarget KVs.
- Target (target) <targetname>
- The targetname of an entity this entity will trigger when activated.
- Delay before trigger (delay) <integer>
- Delay in seconds before firing the targeted entity.
- Killtarget (killtarget) <targetname>
- Entity to remove when activated.
- Name of .txt for the key (message) <file path>
- The name of the text file associated with the key (e.g., inventoryitems/basementkey.txt). Used for displaying a notification with the key's name at the bottom of the screen.
- Model (model) <model path>
- Model to display (MDL, BSP, or SPR). Relative to mod folder.
- Colormap (colormap) <integer>
-
Works like the deathmatch recolor system, wherein this KV equals
(bottomcolor * 256) + topcolor. This value can be calculated using
.
How to use
To set up a global puzzle logic where a door requires a key and tracking via a global variable:
- Place the item_key entity somewhere on your map where the player can collect it. Set its
targetvalue to match your env_global name (e.g., key_global_trigger). - Place the entity that you want to open, such as a func_door. In its Master field, type the targetname of your multisource (e.g., my_multisource).
- Place a multisource entity anywhere on the map. Set its
targetnameto my_multisource. - Place an env_global entity on your map.
- Configure the env_global parameters using the following settings:
| Keyvalue | SmartEdit Name | Value | Description |
|---|---|---|---|
targetname
|
Name | key_global_trigger | The name that matches the key's target. |
globalstate
|
Global State To Set | my_key_picked_up | A unique name for your custom global state. |
triggermode
|
Trigger To Send | 1: On | Turns the global state ON when triggered by the key. |
initialstate
|
Initial State | 0: Off | The state is disabled by default until the player finds the key. |
- Go back to your multisource entity and in its Global State Master field, type the exact name of the global state you defined in the env_global (e.g., my_key_picked_up).
When the player picks up the key, it will trigger the env_global, changing the global state to ON. The multisource detects this global state change and unlocks the master controlled func_door.
Creating Custom Notifications
You can create your own custom notification file by simply copying basementkey.txt from the mod files and modifying its content to suit your needs.