Scripting:TWTrapAIBreath

Building pieces of another world.
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

This script controls a particle attachment to an AI that allows the simulation of visible breath in cold areas. Note that this script only provides a general approximation of the effect: it does not attempt to sync up with AI vocalisations (speech, whistles, etc), and probably never will be able to. No message is sent to a script when an AI begins vocalising, and in the absence of such a message there's no way to sync emission and vocalisation.

This script does the following:

  • Enables and disabled the attached particles automatically when the AI enters and leaves concrete rooms listed as 'cold' in the script's design note.
  • Scales the breath rate based on alertness level (the AI appears to breathe faster at higher alert levels).
  • AIs continue breathing when knocked out, and the breath particles will be enabled and disabled automatically when the body is carried into or out of cold areas.
  • When the AI is killed the particle group is disabled.

The full setup for the effect is somewhat complicated - please see the AI Breath Tutorial for an example setup.

Design Note Parameters

This script supports all the following arguments in the Editor -> Design Note in addition to the arguments given in the TWBaseScript and TWBaseTrap documentation.

TWTrapAIBreathRate0
Type: integer
Default: 3s
This controls the the base breathing rate, the rate used when the AI is at rest (alertness level 0). This is how long, in milliseconds, between one inhale and another. For a normal human at rest that's generally about 3 to 5 seconds (3000 to 5000 milliseconds). As AIs will usually be walking around doing things even 'at rest', going for the lower value is probably better, but you should experiment to see what feels best for you. The base rate is used to calculate the default values for the other three alertness levels (1, 2, and 3).
TWTrapAIBreathRate1, TWTrapAIBreathRate2, TWTrapAIBreathRate3
Type: integer
These parameters allow the default values calculated from the base rate to be overridden with rates you feel more appropriate to the alertness levels. Rate1 is used when the AI is at low alertness, Rate2 when the AI is at medium, and Rate3 is used when the AI is at high altertness and actively searching, pursuing, or attacking the player. If the AI is at high alterness but is not actively searching, pursuing, or attacking then Rate2 is used instead.
TWTrapAIBreathInCold
Type: boolean
Default: false
If the AI starts out in a cold room, the script may not correctly detect this fact. If you set this parameter to true, the AI is initialised as being in a cold room, and everything should work as expected. Basically: if the AI is in a cold room at the start of the mission, set this to true, otherwise you can leave it out.
TWTrapAIBreathImmediate
Type: boolean
Default: true
If this is set to true, the breath particle group is deactivated as soon as the AI exits from a cold room into a warm one. If it is false, the normal exhale time will elapse before the group is deactivated. You might want to set this to false if, for example, there is a very significant difference in temperature between the cold and not-cold rooms, to simulate cold air entering with the AI. This is something you should probably play around with to see what works best for your mission.
TWTrapAIBreathColdRooms
Type: string
Default: none
If you want to use the automatic activate/deactivate feature of this script (which you do), rather that relying on a Heath Robinson/Rube Goldberg setup to send the script TurnOn/TurnOff messages (which you don't want to do), you need to list the rooms that should be considered to be cold rooms here. You can specify multiple rooms by separating them with commas, and you can use concrete room IDs or concrete room names here (use the ID if the name contains a comma!). Note that you must set up concrete rooms for all your designated cold areas.
TWTrapAIBreathStopOnKO
Type: boolean
Default: false
If this is false, the particle group attached to the AI continues to work as normal when the AI has been knocked out (as knocked-out AIs need to breathe too!). If set to true, the particle group is deactivated permanently when the AI is knocked out.
TWTrapAIBreathExhaleTime
Type: time
Default: 0.5s
The amount of time, in milliseconds, that the AI will exhale for at rest. This is the amount of time that the particle group will remain active for during every breath cycle. It is hard limited so that you can not set it to more than half of the breathing rate.

Advanced options

The following options are only needed if you deviate from the standard breath setup for some reason, which I recommend you do not do unless you're really sure you know what you're doing!

TWTrapAIBreathProxy
Type: target
Default: BreathProxy
This should be the *archetype name* of the proxy object attached to the AI that the breath particles will be attached to. If you followed the AI Breath Tutorial you do not need to specify this, but if you are using a different archetype for the breath proxy object you need to give the name of the archetype here.
TWTrapAIBreathProxyLink
Type: string
Default: ~DetailAttachement
The link type used to attach the proxy marker to the AI.
TWTrapAIBreathSFX
Type: target
Default: AIBreath
This should be the *archetype name* of the particle group attached to the AI that should be used as the breath particles. If you followed the AI Breath Tutorial you do not need to specify this, but if you are using a different particle group for the breath you need to give the name of its archetype here.
TWTrapAIBreathLinkType
Type: string
Default: ~ParticleAttachement
Allows the link type used to attach the particle group to the AI to be changed from the default "~ParticleAttachement" to something else.


Authors

  • gravatar The Watcher [userbureaucratsysopPHRhYmxlIGNsYXNzPSJ0d3BvcHVwIj48dHI+PHRkIGNsYXNzPSJ0d3BvcHVwLWVudHJ5dGl0bGUiPkdyb3Vwczo8L3RkPjx0ZD51c2VyPGJyIC8+YnVyZWF1Y3JhdDxiciAvPnN5c29wPGJyIC8+PC90ZD48L3RyPjwvdGFibGU+]