Stim/Response Editor
Stim / Response Editor
The Stim/Response Editor was introduced to save typing each arg for every stim and response on the page, Stim/Response Key/Values that also contains more specific descriptions as to what each Stim/Response arg does.
For more general reading on stims and responses, please see also the pages Stim/Response and Stim/Response Key/Values.
Stims
To add a stim or response to an entity, open the Stim/Response editor: Select the entity and - from the menu bar - go to Entity > Stim/Response. The Stim/Response Editor has three tabs: Stims, Responses and Custom Stims. As stated on the Stim/Response page, an entity can have either or both Stims and Responses, but is not able to crate a Response through a Stim fired on itself.
To add a non-custom Stim, select the "Stims" tab. From here, it is possible to add a Stim from the drop-down menu next to the "Add" button, clicking the Add button and choosing a stim from the "Type" drop-down menu at the top ("Frob" being the default) or using a keyboard shortcut by pressing the initial letter of the Stim type you'd like to add.
Select the Stim to edit from the numbered list on the left. If no Stim type is selected, all options presented on the right are greyed out. The options on the right side of the editor allow changes to all key values of the Stim, removing the need to type and enter manually all key values as listed and described in Stim/Response Key/Values.
Responses
The Response Editor is a simplified way to create basic scripts without need for deeper knowledge in scripting for TDM. It works similar to the Stim Editor, but for adding Stims that will act as entity Responses. In the Responses tab, the Stim to which the selected entity should respond is selected in the same way as the Stims tab.
However, this only tells the entity that it must show a Response to a certain Stim type. For a Response to happen, there must be an effect.
To add an effect, right-click in the "Response Effects" window and press, "Add new Effect".
Double-clicking the numbered Response (or right-clicking it and choosing "Edit") will open the "Edit Response Effect" box, in which it is possible to select the target entity, type of Stim (as args) and the Response effect itself.
Available effects
- Activate Response: Activates the Response for the stated Stim Type on the stated Entity.
- E.g. the player must give a fire stim to a furnace in order to have a door react to a frob Stim.
- Activate Shooter: Activates the named Shooter entity.
- E.g. Can be used to activate a trap.
- Activate Stim: Activates the Stim for the stated Stim Type on the named Entity.
- E.g. Adds a damage stim to the furnace after a fire stim is given.
- Add Target: Adds the stated Target to the named Entity.
- E.g. Add a new path_corner to a patrol route.
- Apply Stim: Fires a Stim of the stated Stim Type to the named Target.
- The Source can be changed, but is not necessary.
- Blind AI: Blinds the named AI as if a flash bomb has been used on it.
- Clear Targets: Removes all Target-args from the named Entity.
- Damage: Applies a damage type to the stated Target.
- Damage Defs can be found in the def file "darkmod/tdm_defs01.pk4/defs/tdm_damage.def".
- Deactivate Response: Deactivates the Response for the stated Stim Type on the named Entity.
- Deactivate Shooter: Deactivates the stated Shooter.
- E.g. Can be used to disarm a trap.
- Deactivate Stim: Deactivates the Stim for the stated Stim Type on the named Entity.
- Disable Effect: Disables only one Effect on the named Entity.
- The Effect is defined by two numbers (e.g. 2_3), meaning that the Effect numbered 3 on the Response number 2 is disabled. The respective numbers can be found in the first column of the Response Effects window.
- Enable Effect: Enables only one Effect on the stated Entity.
- The Effect is defined by two numbers (e.g. 2_3), meaning that the Effect numbered 3 on the Response numbered 2 is enabled. The respective numbers can be found in the first column of the Response Effects window.
- Fade Light Color: Changes the colour of the named Target Light to the stated Color over a time of Fade Time seconds.
- Frob: Frobs the named Entity as if it had been frobbed by the player.
- Gas Knockout: Knocks out the named Target as if it had been hit with a gas arrow.
- Heal: Heals the named Target by the stated Amount.
- Kill: Kills the named Target.
- Knockout: Knocks out the named Target as if it had been hit with the blackjack.
- Turn extinguishable Light Off: Extinguishes the named extinguishable Light.
- Turn extinguishable Light On: (Re)ignites the named extinguishable Light.
- Turn Light Off: Turns off the named Light.
- Turn Light On: Turns on the named Light.
- Move To Position: Moves the named Entity to the stated Position (coordinates: X Y Z).
- If the box "Relative to old origin" is ticked, the Entity is moved (X Y Z) units from its current location.
- Move To Random Position: Moves the named Entity to a random position inside the "Within Radius" range.
- Play Animation: Plays the stated Animation for the stated Entity.
- The Animation can be limited to only one channel (such as only the head or similar), but is best left this blank, unless sure of intent.
- Play Sound: Play the named entity's stated Sound.
- The channel can be limited (e.g. to the player voice or ambient), but this can also be left blank.
- Play Sound Shader: Plays the named Sound Shader on the stated channel (as before the channel does not need not be defined). This is not limited to inherited sounds of the entity.
- Remove: Removes the named Target from the map.
- Run Script: Runs the named Script. For more information on scripts refer to Scripting basics.
- Set AI Team: Change the named AI's team to the stated Team.
- For a list of which AI belongs to which team by default, refer to AI Relations
- Set Angles: Set the named Target's rotation to the stated Angles (in pitch/yaw/roll).
- As with Move To Position, this is also possible relative to the entity's current angles.
- Set Frobable: Sets the named Entity as frobable (box checked) or unfrobable (box unchecked).
- Set Light Color: Changes the colour of the named Target Light to the stated Color.
- In contrast to "Fade to Color", this happens without any transition.
- Set Model: Changes the current model of the named Target to the stated Model.
- E.g. Can be used to change a model to a broken model after recieving damage.
- Set Skin: Changes the current skin of the stated Target to the stated Skin.
- Set Spawnarg: Changes the value of a Key (Spawnarg) on the stated Target to a stated Value.
- Spawn Entity: Creates an entity of the stated Entity Class at a given location Origin (X Y Z). E.g. can be used to create new loot through an event.
- Spawn Particle: Creates an emitter that will emit the named particle (including its .prt extension) at the location Origin (X Y Z) that stay there for stated Lifetime seconds. If no Lifetime is given it stays infinitely.
- Start Stim Timer: Starts the timer of the stated Stim on the named Entity.
- For information about how a timer on a Stim works, refer to Stim/Response Key/Values, E.g. Key: sr_timer_time_N.
- Stop Stim Timer: Stops the timer of the stated Stim on the named Entity.
- For information about how a timer on a Stim works, refer to Stim/Response Key/Values, E.g. Key: sr_timer_time_N.
- Teleport (Set Origin): Moves the named Entity to the stated location's New Origin (coordinates: X Y Z).
- If the box "Relative to old origin" is checked, the Entity is moved (X Y Z) units from its current location.
- Toggle Effect: Disables the stated Effect if enabled or enables the stated Effect if disabled on the named Entity.
- The Effect is defined by two numbers (e.g. 2_3), meaning that the Effect numbered 3 on the Response numbered 2 is disabled. The respective numbers can be found in the first column of the Response Effects window.
- Toggle Light: Turns off the named Light if on or turns on the named Light if off.
- Trigger: Activates the named Target Trigger entity as if activated by the stated Activator. (If I remember correctly, this does not count as a trigger Stim. For this you would have to target a trigger entity, that then targets the entity you wish to receive the trigger Stim).
The Response list gives a variety of options that allows for many effects without the need to write scripts.
It is possible to add several effects with one response type by checking the box, "Random Effects" and entering the number of random effects to be used. Note that each effect can be used multiple times. E.g. Selecting only one effect and setting "Random Effects: 3" will use the same effect three times.
Examples
Arrow Trap
First, create an "atdm:func_shooter" entity and position it so that the arrow points in the desired direction to shoot. Note that this entity does not have a model. If a model is required, the shooter can be placed in front of the approriate model. Define the projectile to be fired (the default is a fire arrow) and check the pitch for the projectile's trajectory.
Next, it is necessary to create an activator, that can be achieved with the Stim/Response Editor as follows:
- Create a brush, giving it a NoDraw texture and convert it to a func_static.
- Place this func_static entity, where the shooter is to be activated (note that the radius of the Player Stim is 350 with a Falloff Exponent of 3 around the player. This results in an effective radius of around 100 units).
- Open the Stim/Response Editor.
- Add a Response "Player" to the NoDraw func_static entity.
- To that Response, add the Effect "Activate Shooter" with the name of the shooter as "Shooter Entity".
Now the shooter will start firing as soon as the player comes within 100 units of the NoDraw func_static entity.
There are three options:
- If the the setup is left as it is, the shooter will continuously fire.
- If the shooter is given an ammo value that is not -1, the shooter will stop firing some time, depending on if the ammo is depleted, after the player moves away from the NoDraw func_static entity.
- If the shooter is to fire only once, it is necessary to add the Effect, "Disable Effect" and target the first effect that activates the shooter or give an ammo value of 1.
It may also possible for the player to disarm the trap:
- Create a response on another entity that the player will use to do to disarm the trap.
E.g. Frob, if the player is to push a button or use a switch or lever, or a Water response if the player is to shoot a water arrow on a circuit board or a furnace. The possibilities are endless.
- Add the same "Disable Effect" effect as before.
- It is also possible to use the Effect, "Remove shooter". But if this is used, the shooter will not be reactivated (E.g. if the player re-arms the trap, as above).
Note that using this setup, where the Response is "Player", the trap will exclusively react to the player and not to any AI.
Change Patrol
An AI's behaviour, such as its patrol route, may be altered through a response. E.g. If the player has taken a specific loot item.
- Give the loot item a Response "Frob".
- Add the effect "Add Target".
- As the "Entity" do not use the AI, but the path_corner from which the AI is to leave its original path to enter the new one.
- As "Target" put in the first path_corner of the new path.
If the new path circles back to the original path, the path will fork at this point: if the new path does not target any path_corner of the original path, the AI will remain patrolling the new path.