<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.thedarkmod.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Springheel</id>
	<title>The DarkMod Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.thedarkmod.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Springheel"/>
	<link rel="alternate" type="text/html" href="https://wiki.thedarkmod.com/index.php?title=Special:Contributions/Springheel"/>
	<updated>2026-05-01T13:16:29Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.45.3</generator>
	<entry>
		<id>https://wiki.thedarkmod.com/index.php?title=Universe&amp;diff=25931</id>
		<title>Universe</title>
		<link rel="alternate" type="text/html" href="https://wiki.thedarkmod.com/index.php?title=Universe&amp;diff=25931"/>
		<updated>2019-11-13T18:23:01Z</updated>

		<summary type="html">&lt;p&gt;Springheel: Protected &amp;quot;Universe&amp;quot; ([Edit=Allow only autoconfirmed users] (indefinite) [Move=Allow only autoconfirmed users] (indefinite))&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[image:cityscape.jpg|thumb|The Dark Mod has its own setting]]&lt;br /&gt;
Welcome to the &amp;quot;official&amp;quot; setting of The Dark Mod. While FM authors can create stories in any world they like with our tools, they have  been tailored to suit the world described below.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Disclaimer:&#039;&#039;&#039; Just to be clear, The Dark Mod does &#039;&#039;&#039;NOT&#039;&#039;&#039; take place in the same universe as the Looking Glass &#039;Thief&#039; games (or the setting of the recent Thief from Eidos Montreal).  There are no Keepers, no Hammerites, and no Garrett.  That said, the settings of both The Dark Mod and Thief are based on a steampunk-influenced version of our own history, so there will be certain similarities.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
The Dark Mod world can be viewed as an alternate, low fantasy version of our own.  It is a mixture of several historical periods, with architecture ranging from medieval castles to victorian mansions.  In this world, steam and clockwork [[technology]] were discovered much earlier in history, allowing for odd inventions and industrial warehouses to exist side-by-side with gothic cathedrals and sword-wielding city watch.  [[Magic]] is also a tangible force, though it is rare to for most people to encounter anything but subtle magical effects.  Missions have established the date of the setting as around 1630 AD.&lt;br /&gt;
&lt;br /&gt;
== Tone ==&lt;br /&gt;
The Dark Mod is set in a world that is dark, gritty and adult.  It is a setting that strives to be immersive, and to feel as believable to the player as possible. Neither campy humour nor climactic battles between good and evil fit the style of The Dark Mod world. &lt;br /&gt;
&lt;br /&gt;
Characters talk and act in ways that are appropriate to their upbringing and station. Most guards are rough, uneducated brutes who spend their lives drinking, gambling, and bedding whores.  They certainly don&#039;t recite poetry or discuss philosophy in their spare time. Aristocrats are often just as brutish, but with a slightly more educated veneer.  &lt;br /&gt;
&lt;br /&gt;
With plagues, infection, and drunken brawls spilling into the streets on a regular basis, life is much cheaper in this world than ours.  The heads and corpses of criminals line the roads, and public torture and hangings are one of the most popular forms of entertainment--watching criminals have their entrails cut out and burned while still alive is considered a good way to teach children moral lessons.  Even the Church, the main provider of hope and beauty in this age, enthusiastically tortures and burns heretics.&lt;br /&gt;
&lt;br /&gt;
== Places ==&lt;br /&gt;
Although much of the setting material for The Dark Mod focuses around the city of Bridgeport, that city does not exist in isolation. It is part of a larger world, with political connections, trading agreements, and hostile neighbours that could be possible plots for FM missions.&lt;br /&gt;
* [[The City]] of Bridgeport&lt;br /&gt;
* [[Builder Roads]]&lt;br /&gt;
* [[Other Cities and Towns]]&lt;br /&gt;
* [[The World at Large]]&lt;br /&gt;
* [[The Empire]]&lt;br /&gt;
* [[Choosing Place Names]]&lt;br /&gt;
&lt;br /&gt;
== &amp;quot;Factions&amp;quot; ==&lt;br /&gt;
&amp;quot;Factions&amp;quot; are not necessarily organized groups, and should not be thought of as homogeneous.  Even within factions there are plenty of disagreements and sometimes outright conflicts.&lt;br /&gt;
* [[Builders]]&lt;br /&gt;
* [[Pagans]]&lt;br /&gt;
* [[Inventor&#039;s Guild]]&lt;br /&gt;
* [[Mages]]&lt;br /&gt;
* [[Necromancers]]&lt;br /&gt;
* [[Thieves]]&lt;br /&gt;
&lt;br /&gt;
== Creatures ==&lt;br /&gt;
While the TDM setting generally looks like our own world, there are strange and unusual creatures in existence.  The stranger the beast, the further from civilization it is generally found.&lt;br /&gt;
&lt;br /&gt;
* [[Giant Spiders]]&lt;br /&gt;
* [[Undead]]&lt;br /&gt;
* [[Fire Elementals]]&lt;br /&gt;
&lt;br /&gt;
== Notable Characters ==&lt;br /&gt;
A catalogue of significant characters from the TDM setting.  These include important figures as well as characters drawn from existing Fan Missions.&lt;br /&gt;
* [[Thief Characters]]&lt;br /&gt;
* [[Noble/Wealthy Characters]]&lt;br /&gt;
* [[Clergy/Builder Characters]]&lt;br /&gt;
&lt;br /&gt;
== Daily Life ==&lt;br /&gt;
A few historical details can go a long way towards making a mission seem more &amp;quot;real&amp;quot;.&lt;br /&gt;
* The kinds of [[Food]] people eat&lt;br /&gt;
* The importance of [[Letter Writing]]&lt;br /&gt;
* The running of a [[Wealthy Household]]&lt;br /&gt;
* Types of [[Jobs]] people might have&lt;br /&gt;
&lt;br /&gt;
== Other ==&lt;br /&gt;
Other information about the setting.&lt;br /&gt;
* The invention of several unique [[arrows]] &lt;br /&gt;
* What kind of [[technology]] is available?&lt;br /&gt;
* What about [[magic]]?&lt;br /&gt;
* How to choose good-sounding [[Names]]&lt;br /&gt;
* [[Glossary of terms]]&lt;/div&gt;</summary>
		<author><name>Springheel</name></author>
	</entry>
	<entry>
		<id>https://wiki.thedarkmod.com/index.php?title=Clergy/Builder_Characters&amp;diff=25930</id>
		<title>Clergy/Builder Characters</title>
		<link rel="alternate" type="text/html" href="https://wiki.thedarkmod.com/index.php?title=Clergy/Builder_Characters&amp;diff=25930"/>
		<updated>2019-11-13T18:22:46Z</updated>

		<summary type="html">&lt;p&gt;Springheel: Protected &amp;quot;Clergy/Builder Characters&amp;quot; ([Edit=Allow only autoconfirmed users] (indefinite) [Move=Allow only autoconfirmed users] (indefinite))&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
= Historical Figures =&lt;br /&gt;
&lt;br /&gt;
== The Prophet Amos ==&lt;br /&gt;
&lt;br /&gt;
The main prophet of Builder theology, who was said to communicate directly with the Master Builder himself.  He was responsible for the founding of the Builder Church, in the year 0.  The &amp;quot;Book of Amos&amp;quot; is the most significant part of the Builder Gospels, and establishes that each person will be judged after death according to the work they have done and the things they have built.&lt;br /&gt;
&lt;br /&gt;
== Patriarch Gregory IX ==&lt;br /&gt;
&lt;br /&gt;
Instituted the papal Inquisition in 1231 to bring order and legality to the process of dealing with heresy.&lt;br /&gt;
&lt;br /&gt;
== Patriarch Sixtus IV ==&lt;br /&gt;
&lt;br /&gt;
Granted ecclesiastical courts the right to execute heretics in 1478, giving the Inquisitors full power over the detection, judgement and punishment of heresy.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Bernard of Clairvaux ==&lt;br /&gt;
&lt;br /&gt;
Author of &amp;quot;The Pagan Problem&amp;quot;, a work that describes pagans as inferior and evil.  Frequently used to justify discriminatory laws against Pagans. (from &amp;quot;Tears of St. Lucia&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Current Characters =&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Paschal Murnerus ==&lt;br /&gt;
&lt;br /&gt;
Inquisitor General of Bridgeport (from &amp;quot;Tears of St. Lucia&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
== Cardinal Laurenti ==&lt;br /&gt;
&lt;br /&gt;
Another Inquisitor General, and a puritan.  Brought the Courts of the Inquisition to Braeden. (from &amp;quot;Builders&#039; Influence&amp;quot;)&lt;br /&gt;
[[Category:Universe]]&lt;/div&gt;</summary>
		<author><name>Springheel</name></author>
	</entry>
	<entry>
		<id>https://wiki.thedarkmod.com/index.php?title=Clergy/Builder_Characters&amp;diff=25929</id>
		<title>Clergy/Builder Characters</title>
		<link rel="alternate" type="text/html" href="https://wiki.thedarkmod.com/index.php?title=Clergy/Builder_Characters&amp;diff=25929"/>
		<updated>2019-11-13T18:21:18Z</updated>

		<summary type="html">&lt;p&gt;Springheel: Removed protection from &amp;quot;Clergy/Builder Characters&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
= Historical Figures =&lt;br /&gt;
&lt;br /&gt;
== The Prophet Amos ==&lt;br /&gt;
&lt;br /&gt;
The main prophet of Builder theology, who was said to communicate directly with the Master Builder himself.  He was responsible for the founding of the Builder Church, in the year 0.  The &amp;quot;Book of Amos&amp;quot; is the most significant part of the Builder Gospels, and establishes that each person will be judged after death according to the work they have done and the things they have built.&lt;br /&gt;
&lt;br /&gt;
== Patriarch Gregory IX ==&lt;br /&gt;
&lt;br /&gt;
Instituted the papal Inquisition in 1231 to bring order and legality to the process of dealing with heresy.&lt;br /&gt;
&lt;br /&gt;
== Patriarch Sixtus IV ==&lt;br /&gt;
&lt;br /&gt;
Granted ecclesiastical courts the right to execute heretics in 1478, giving the Inquisitors full power over the detection, judgement and punishment of heresy.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Bernard of Clairvaux ==&lt;br /&gt;
&lt;br /&gt;
Author of &amp;quot;The Pagan Problem&amp;quot;, a work that describes pagans as inferior and evil.  Frequently used to justify discriminatory laws against Pagans. (from &amp;quot;Tears of St. Lucia&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Current Characters =&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Paschal Murnerus ==&lt;br /&gt;
&lt;br /&gt;
Inquisitor General of Bridgeport (from &amp;quot;Tears of St. Lucia&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
== Cardinal Laurenti ==&lt;br /&gt;
&lt;br /&gt;
Another Inquisitor General, and a puritan.  Brought the Courts of the Inquisition to Braeden. (from &amp;quot;Builders&#039; Influence&amp;quot;)&lt;br /&gt;
[[Category:Universe]]&lt;/div&gt;</summary>
		<author><name>Springheel</name></author>
	</entry>
	<entry>
		<id>https://wiki.thedarkmod.com/index.php?title=Universe&amp;diff=25928</id>
		<title>Universe</title>
		<link rel="alternate" type="text/html" href="https://wiki.thedarkmod.com/index.php?title=Universe&amp;diff=25928"/>
		<updated>2019-11-13T18:20:17Z</updated>

		<summary type="html">&lt;p&gt;Springheel: Removed protection from &amp;quot;Universe&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[image:cityscape.jpg|thumb|The Dark Mod has its own setting]]&lt;br /&gt;
Welcome to the &amp;quot;official&amp;quot; setting of The Dark Mod. While FM authors can create stories in any world they like with our tools, they have  been tailored to suit the world described below.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Disclaimer:&#039;&#039;&#039; Just to be clear, The Dark Mod does &#039;&#039;&#039;NOT&#039;&#039;&#039; take place in the same universe as the Looking Glass &#039;Thief&#039; games (or the setting of the recent Thief from Eidos Montreal).  There are no Keepers, no Hammerites, and no Garrett.  That said, the settings of both The Dark Mod and Thief are based on a steampunk-influenced version of our own history, so there will be certain similarities.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
The Dark Mod world can be viewed as an alternate, low fantasy version of our own.  It is a mixture of several historical periods, with architecture ranging from medieval castles to victorian mansions.  In this world, steam and clockwork [[technology]] were discovered much earlier in history, allowing for odd inventions and industrial warehouses to exist side-by-side with gothic cathedrals and sword-wielding city watch.  [[Magic]] is also a tangible force, though it is rare to for most people to encounter anything but subtle magical effects.  Missions have established the date of the setting as around 1630 AD.&lt;br /&gt;
&lt;br /&gt;
== Tone ==&lt;br /&gt;
The Dark Mod is set in a world that is dark, gritty and adult.  It is a setting that strives to be immersive, and to feel as believable to the player as possible. Neither campy humour nor climactic battles between good and evil fit the style of The Dark Mod world. &lt;br /&gt;
&lt;br /&gt;
Characters talk and act in ways that are appropriate to their upbringing and station. Most guards are rough, uneducated brutes who spend their lives drinking, gambling, and bedding whores.  They certainly don&#039;t recite poetry or discuss philosophy in their spare time. Aristocrats are often just as brutish, but with a slightly more educated veneer.  &lt;br /&gt;
&lt;br /&gt;
With plagues, infection, and drunken brawls spilling into the streets on a regular basis, life is much cheaper in this world than ours.  The heads and corpses of criminals line the roads, and public torture and hangings are one of the most popular forms of entertainment--watching criminals have their entrails cut out and burned while still alive is considered a good way to teach children moral lessons.  Even the Church, the main provider of hope and beauty in this age, enthusiastically tortures and burns heretics.&lt;br /&gt;
&lt;br /&gt;
== Places ==&lt;br /&gt;
Although much of the setting material for The Dark Mod focuses around the city of Bridgeport, that city does not exist in isolation. It is part of a larger world, with political connections, trading agreements, and hostile neighbours that could be possible plots for FM missions.&lt;br /&gt;
* [[The City]] of Bridgeport&lt;br /&gt;
* [[Builder Roads]]&lt;br /&gt;
* [[Other Cities and Towns]]&lt;br /&gt;
* [[The World at Large]]&lt;br /&gt;
* [[The Empire]]&lt;br /&gt;
* [[Choosing Place Names]]&lt;br /&gt;
&lt;br /&gt;
== &amp;quot;Factions&amp;quot; ==&lt;br /&gt;
&amp;quot;Factions&amp;quot; are not necessarily organized groups, and should not be thought of as homogeneous.  Even within factions there are plenty of disagreements and sometimes outright conflicts.&lt;br /&gt;
* [[Builders]]&lt;br /&gt;
* [[Pagans]]&lt;br /&gt;
* [[Inventor&#039;s Guild]]&lt;br /&gt;
* [[Mages]]&lt;br /&gt;
* [[Necromancers]]&lt;br /&gt;
* [[Thieves]]&lt;br /&gt;
&lt;br /&gt;
== Creatures ==&lt;br /&gt;
While the TDM setting generally looks like our own world, there are strange and unusual creatures in existence.  The stranger the beast, the further from civilization it is generally found.&lt;br /&gt;
&lt;br /&gt;
* [[Giant Spiders]]&lt;br /&gt;
* [[Undead]]&lt;br /&gt;
* [[Fire Elementals]]&lt;br /&gt;
&lt;br /&gt;
== Notable Characters ==&lt;br /&gt;
A catalogue of significant characters from the TDM setting.  These include important figures as well as characters drawn from existing Fan Missions.&lt;br /&gt;
* [[Thief Characters]]&lt;br /&gt;
* [[Noble/Wealthy Characters]]&lt;br /&gt;
* [[Clergy/Builder Characters]]&lt;br /&gt;
&lt;br /&gt;
== Daily Life ==&lt;br /&gt;
A few historical details can go a long way towards making a mission seem more &amp;quot;real&amp;quot;.&lt;br /&gt;
* The kinds of [[Food]] people eat&lt;br /&gt;
* The importance of [[Letter Writing]]&lt;br /&gt;
* The running of a [[Wealthy Household]]&lt;br /&gt;
* Types of [[Jobs]] people might have&lt;br /&gt;
&lt;br /&gt;
== Other ==&lt;br /&gt;
Other information about the setting.&lt;br /&gt;
* The invention of several unique [[arrows]] &lt;br /&gt;
* What kind of [[technology]] is available?&lt;br /&gt;
* What about [[magic]]?&lt;br /&gt;
* How to choose good-sounding [[Names]]&lt;br /&gt;
* [[Glossary of terms]]&lt;/div&gt;</summary>
		<author><name>Springheel</name></author>
	</entry>
	<entry>
		<id>https://wiki.thedarkmod.com/index.php?title=Swimmable_Water&amp;diff=25425</id>
		<title>Swimmable Water</title>
		<link rel="alternate" type="text/html" href="https://wiki.thedarkmod.com/index.php?title=Swimmable_Water&amp;diff=25425"/>
		<updated>2019-07-17T00:25:56Z</updated>

		<summary type="html">&lt;p&gt;Springheel: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;written by angua&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Create some walls ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Watertutorial1.jpg]]&lt;br /&gt;
&lt;br /&gt;
In this example, I made this little rectangular pool, but you can also use differently shaped structures.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Fill in your water ==&lt;br /&gt;
&lt;br /&gt;
Draw a brush that is going to be your water volume and texture it with common/nodraw&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Watertutorial2.jpg]]&lt;br /&gt;
&lt;br /&gt;
== Create the entity ==&lt;br /&gt;
&lt;br /&gt;
In [[DarkRadiant]]: Select your brush, {{RMB}} -&amp;gt; Create Entity -&amp;gt; &#039;&#039;&#039;atdm:liquid_water&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[Image:Watertutorial5.jpg]]&lt;br /&gt;
&lt;br /&gt;
In the Entity Inspector you can see that the classname is now &#039;&#039;&#039;atdm:liquid_water&#039;&#039;&#039;, and the name &#039;&#039;&#039;atdm:liquid_water_1&#039;&#039;&#039; (or similiar). It should also have a blue outline in the orthographic view (The XZ Front in this case).&lt;br /&gt;
&lt;br /&gt;
Note: If you use &amp;quot;func_liquid&amp;quot; instead of &amp;quot;atdm:liquid_water&amp;quot;, your water will not function correctly. It will f.i. not extinguish flames.&lt;br /&gt;
&lt;br /&gt;
== Texture the surface ==&lt;br /&gt;
&lt;br /&gt;
Select the face that is going to be the surface ({{key|CTRL}} + {{key|SHIFT}} + {{LMB}}) and texture it with a nice water texture, for example &#039;&#039;&#039;water_source/water_clear&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
[[Image:Watertutorial6.jpg]]&lt;br /&gt;
&lt;br /&gt;
Do not assign the water texture to the whole brush, or you will see this: (You can also get rid of that z-fighting by dragging the brush into the wall so that it insersects with it.)&lt;br /&gt;
&lt;br /&gt;
[[Image:Watertutorial4.jpg]]&lt;br /&gt;
&lt;br /&gt;
However, if you don&#039;t want clear water then you need to choose another surface, say water_green or water_colored, include an extra overlay plus an underwater overlay. For this, see the next section.&lt;br /&gt;
&lt;br /&gt;
==Coloured and Murky Water==&lt;br /&gt;
&lt;br /&gt;
This is a method for providing water that is coloured or murky underwater and a surface that matches.&lt;br /&gt;
&lt;br /&gt;
You can use this with different water surfaces but I recommend you first try:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;textures/water_source/water_colored.&#039;&#039; (this can be coloured but by default it is not so won&#039;t confuse the issue - the colour will be added by the overlay below.)&lt;br /&gt;
&lt;br /&gt;
To your water entity give the property:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;underwater_gui&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Now give the property the name of one of the overlay guis. The names are fairly descriptive so you can choose which type you want suitable for a river, a cave pool, or a sewer, etc.:&lt;br /&gt;
&lt;br /&gt;
 guis/underwater/underwater_green_midmurk.gui&lt;br /&gt;
 guis/underwater/underwater_green_thickmurk.gui&lt;br /&gt;
 guis/underwater/underwater_green_thinmurk.gui&lt;br /&gt;
&lt;br /&gt;
 guis/underwater/underwater_blue_midmurk.gui&lt;br /&gt;
 guis/underwater/underwater_blue_thickmurk.gui&lt;br /&gt;
 guis/underwater/underwater_blue_thinmurk.gui&lt;br /&gt;
&lt;br /&gt;
 guis/underwater/underwater_bluegrey_midmurk.gui&lt;br /&gt;
 guis/underwater/underwater_bluegrey_thickmurk.gui&lt;br /&gt;
 guis/underwater/underwater_bluegrey_thinmurk.gui&lt;br /&gt;
&lt;br /&gt;
 guis/underwater/underwater_greengrey_midmurk.gui&lt;br /&gt;
 guis/underwater/underwater_greengrey_thickmurk.gui&lt;br /&gt;
 guis/underwater/underwater_greengrey_thinmurk.gui&lt;br /&gt;
&lt;br /&gt;
Now with the water entity still selected:&lt;br /&gt;
&lt;br /&gt;
* Choose Top view in Dark Radiant&#039;s orthoview&lt;br /&gt;
* Create a simple patch from the patch menu.&lt;br /&gt;
* Move this up flush with the surface of the water.&lt;br /&gt;
* Give it the texture that matches the gui you chose above. For example, if you chose &#039;&#039; guis/underwater/underwater_bluegrey_thinmurk.gui&#039;&#039; from the above then give the overlay the texture: &#039;&#039;textures/water_source/bluegrey_plain_flat_thinmurk&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Using the above method you should find the surface opacity and colour matches how it looks when the players goes underwater.&lt;br /&gt;
&lt;br /&gt;
== Underwater fog ==&lt;br /&gt;
&lt;br /&gt;
Your water looks much more believable if it has an underwater fog. Create a light, select as texture &amp;quot;fog/basicfog&amp;quot;, give it a very dark color and resize the light so it covers the entire underwater area. This will make your water darker the deeper it is, just like in real-life!&lt;br /&gt;
&lt;br /&gt;
== Test your water ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Watertutorial3.jpg]]&lt;br /&gt;
&lt;br /&gt;
And there it is!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Current Flow==&lt;br /&gt;
&lt;br /&gt;
There is at least one flowing stream surface texture at the time of writing. If you want to create your own variations then just examine that material shader, copy and modify it. Probably it can be used with other existing surface texture images or you can create new ones.&lt;br /&gt;
&lt;br /&gt;
==Flow Force==&lt;br /&gt;
&lt;br /&gt;
A force field can be placed in water to apply a tangible flow, eg, to push the player and/or other objects along.&lt;br /&gt;
&lt;br /&gt;
See [[Func Forcefields]]&lt;br /&gt;
&lt;br /&gt;
==Wave Frequency and Direction== &lt;br /&gt;
&lt;br /&gt;
You can set the frequency of the surface waves from tiny undulations to large slow ones just by changing the surface texture scale in Surface Inspector. Flowing surfaces such as stream textures can of course be rotated to get the direction you want.&lt;br /&gt;
&lt;br /&gt;
A better way to influence the wave speed and wave hight is via [[List_of_shaderParm_variables|shaderParms]]. Set the following spawnargs on your water entity:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
shaderParm5 0.05&lt;br /&gt;
shaderParm6 0.75&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
parm5 controls the wave speed, parm6 the wave height. The defaults are 0.1 and 1.5, respectively. Experiment a bit, values lower than the defaults look more believable for still waterbodies, higher values for when you have a lot of wind.&lt;br /&gt;
&lt;br /&gt;
==Sound==&lt;br /&gt;
&lt;br /&gt;
If the water level is less than 1, you get normal footsteps.&lt;br /&gt;
&lt;br /&gt;
Between 1 and 34, you get splash sounds.&lt;br /&gt;
&lt;br /&gt;
Between 34 and 77, you get wading sounds.&lt;br /&gt;
&lt;br /&gt;
If 77 or more, you get swimming sounds.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Troubleshooting Problems==&lt;br /&gt;
&lt;br /&gt;
===Visible Joints Between Water Brushes===&lt;br /&gt;
&lt;br /&gt;
If you place brushes of water against one another, eg, along a channel, round corners, to form a canal, etc. and you can &#039;see the joins&#039; then the most likely cause of the problem is that the surface textures do not align. We are used to aligning static textures but it is not so obvious with the dynamic translucent surface of water that we might not think of it. Just copy and paste shader one of the surface textures to all the others to get the same scroll and scale alignment and it should be OK.&lt;br /&gt;
&lt;br /&gt;
NOTE: If you want to use the NoDraw Solid texture, be sure NOT to use it between water entities, otherwise you won&#039;t be able to swim between them.&lt;br /&gt;
&lt;br /&gt;
{{tutorial-water}}&lt;br /&gt;
[[Category:Mapping Tutorials]]&lt;/div&gt;</summary>
		<author><name>Springheel</name></author>
	</entry>
	<entry>
		<id>https://wiki.thedarkmod.com/index.php?title=Objects_Floating_in_Water&amp;diff=25424</id>
		<title>Objects Floating in Water</title>
		<link rel="alternate" type="text/html" href="https://wiki.thedarkmod.com/index.php?title=Objects_Floating_in_Water&amp;diff=25424"/>
		<updated>2019-07-17T00:25:21Z</updated>

		<summary type="html">&lt;p&gt;Springheel: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;Written by Geep, 2019&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Entities found in the “Movables” folder will float dynamically in water if their calculated density is light enough. But there are issues.&lt;br /&gt;
&lt;br /&gt;
== Adjust the “Mass”, Ignore “Density” ==&lt;br /&gt;
&lt;br /&gt;
To control floating and underwater behavior (detailed below), you may wish to inspect and override the inherited “mass” spawnarg value. If a mass value is defined - and it always is if you use a standard moveable class - then the “density” spawnarg is algorithmically ignored… so you can ignore it too.&lt;br /&gt;
&lt;br /&gt;
Remember that the mass of an object can affect non-water aspects of game play.&lt;br /&gt;
&lt;br /&gt;
== Desired Initial Placement of an Object ==&lt;br /&gt;
&lt;br /&gt;
This restates general considerations when placing a Moveable in the map, but in a water context.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;In the Water, but Above the Sea Floor.&#039;&#039;  By “sea floor”, we just mean the first solid object encountered directly below the object. Place the movable object where you wish (below, at, or slightly above the water surface), and set its “nodrop” spawnarg to “1”. On worldspawn, it will stay where you placed it, awaiting activation by the player.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;On the Sea Floor.&#039;&#039;  Like the above, but make sure nodrop = 0 (the usual default). On worldspawn, the movable will move immediately to the sea floor (without special effects), awaiting activation by the player.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Far Above the Water.&#039;&#039;  If the object is placed far above the water or any other floor, it just hangs there (awaiting player activation), no matter the nodrop value. If the player is swimming, the object will be out of reach.&lt;br /&gt;
&lt;br /&gt;
== Getting the Placed Object to Activate ==&lt;br /&gt;
&lt;br /&gt;
Unfortunately, the object will not rise off the sea floor, or if at the surface, begin bobbing, until after the player activates it by bumping and/or frobbing it.&lt;br /&gt;
&lt;br /&gt;
Clever game design may get around this, e.g., in the case of a floating rowboat, spawning the player directly into it.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;[Is there a way to activate objects by triggers/scripting?]&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Plausible Behaviors When First Activated ==&lt;br /&gt;
&lt;br /&gt;
Objects initially placed above the water surface or higher in the water than they would normally float may trigger splash sound and visual effects, and plunge below the surface (before arising if buoyant). Similarly, initially underwater objects that are highly buoyant may pop above the surface, with effects.&lt;br /&gt;
&lt;br /&gt;
As in real life, the presence and extent of such behaviors is presumably influenced by the momentum at surface penetration. But the engine likely scants object shape and orientation.&lt;br /&gt;
&lt;br /&gt;
== Effect of Mass on Buoyancy and Floating Behavior ==&lt;br /&gt;
&lt;br /&gt;
The mass divided by the calculated (or estimated) volume gives a calculated density, which affects how high in the water an object sits and (along with mass) how vigorous any bobbing and roll-about may be.&lt;br /&gt;
&lt;br /&gt;
The following summary table gives rules of thumb, based on experiments detailed further below. For box-shaped objects it is possible for both you and the physics engine to easily calculate the volume, and from that (given the mass) the density. For other shapes, the engine likely deploys shortcut estimates (perhaps using the collision model) with ad-hoc fudge factors. Rather than attempt to mimic that (or guesstimate appropriate volumes for corpses or complex prefabs), you might use the table as follows:&lt;br /&gt;
&lt;br /&gt;
# Observe the object’s floating behavior, and from that, impute its approximate density.&lt;br /&gt;
# Compare that to the desired behavior, and scale the mass value proportionally.&lt;br /&gt;
# Iterate until happy.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
! style=&amp;quot;text-align:left;&amp;quot;| Estimated Density&lt;br /&gt;
! Underwater: Sink (&amp;amp;dArr;) or Rise (&amp;amp;uArr;)&lt;br /&gt;
! Float Behavior at Surface&lt;br /&gt;
|-&lt;br /&gt;
|1.8&lt;br /&gt;
|&amp;amp;dArr;&amp;amp;dArr;&amp;amp;dArr;&lt;br /&gt;
|Doesn’t float&lt;br /&gt;
|-&lt;br /&gt;
[[Category:Editing]] [[Category:Water]] [[Category:Tutorial]]&lt;/div&gt;</summary>
		<author><name>Springheel</name></author>
	</entry>
	<entry>
		<id>https://wiki.thedarkmod.com/index.php?title=Objects_Floating_in_Water&amp;diff=25423</id>
		<title>Objects Floating in Water</title>
		<link rel="alternate" type="text/html" href="https://wiki.thedarkmod.com/index.php?title=Objects_Floating_in_Water&amp;diff=25423"/>
		<updated>2019-07-17T00:23:58Z</updated>

		<summary type="html">&lt;p&gt;Springheel: Created page with &amp;quot;&amp;#039;&amp;#039;Written by Geep, 2019&amp;#039;&amp;#039;  Entities found in the “Movables” folder will float dynamically in water if their calculated density is light enough. But there are issues.  == A...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;Written by Geep, 2019&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Entities found in the “Movables” folder will float dynamically in water if their calculated density is light enough. But there are issues.&lt;br /&gt;
&lt;br /&gt;
== Adjust the “Mass”, Ignore “Density” ==&lt;br /&gt;
&lt;br /&gt;
To control floating and underwater behavior (detailed below), you may wish to inspect and override the inherited “mass” spawnarg value. If a mass value is defined - and it always is if you use a standard moveable class - then the “density” spawnarg is algorithmically ignored… so you can ignore it too.&lt;br /&gt;
&lt;br /&gt;
Remember that the mass of an object can affect non-water aspects of game play.&lt;br /&gt;
&lt;br /&gt;
== Desired Initial Placement of an Object ==&lt;br /&gt;
&lt;br /&gt;
This restates general considerations when placing a Moveable in the map, but in a water context.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;In the Water, but Above the Sea Floor.&#039;&#039;  By “sea floor”, we just mean the first solid object encountered directly below the object. Place the movable object where you wish (below, at, or slightly above the water surface), and set its “nodrop” spawnarg to “1”. On worldspawn, it will stay where you placed it, awaiting activation by the player.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;On the Sea Floor.&#039;&#039;  Like the above, but make sure nodrop = 0 (the usual default). On worldspawn, the movable will move immediately to the sea floor (without special effects), awaiting activation by the player.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Far Above the Water.&#039;&#039;  If the object is placed far above the water or any other floor, it just hangs there (awaiting player activation), no matter the nodrop value. If the player is swimming, the object will be out of reach.&lt;br /&gt;
&lt;br /&gt;
== Getting the Placed Object to Activate ==&lt;br /&gt;
&lt;br /&gt;
Unfortunately, the object will not rise off the sea floor, or if at the surface, begin bobbing, until after the player activates it by bumping and/or frobbing it.&lt;br /&gt;
&lt;br /&gt;
Clever game design may get around this, e.g., in the case of a floating rowboat, spawning the player directly into it.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;[Is there a way to activate objects by triggers/scripting?]&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Plausible Behaviors When First Activated ==&lt;br /&gt;
&lt;br /&gt;
Objects initially placed above the water surface or higher in the water than they would normally float may trigger splash sound and visual effects, and plunge below the surface (before arising if buoyant). Similarly, initially underwater objects that are highly buoyant may pop above the surface, with effects.&lt;br /&gt;
&lt;br /&gt;
As in real life, the presence and extent of such behaviors is presumably influenced by the momentum at surface penetration. But the engine likely scants object shape and orientation.&lt;br /&gt;
&lt;br /&gt;
== Effect of Mass on Buoyancy and Floating Behavior ==&lt;br /&gt;
&lt;br /&gt;
The mass divided by the calculated (or estimated) volume gives a calculated density, which affects how high in the water an object sits and (along with mass) how vigorous any bobbing and roll-about may be.&lt;br /&gt;
&lt;br /&gt;
The following summary table gives rules of thumb, based on experiments detailed further below. For box-shaped objects it is possible for both you and the physics engine to easily calculate the volume, and from that (given the mass) the density. For other shapes, the engine likely deploys shortcut estimates (perhaps using the collision model) with ad-hoc fudge factors. Rather than attempt to mimic that (or guesstimate appropriate volumes for corpses or complex prefabs), you might use the table as follows:&lt;br /&gt;
&lt;br /&gt;
# Observe the object’s floating behavior, and from that, impute its approximate density.&lt;br /&gt;
# Compare that to the desired behavior, and scale the mass value proportionally.&lt;br /&gt;
# Iterate until happy.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
! style=&amp;quot;text-align:left;&amp;quot;| Estimated Density&lt;br /&gt;
! Underwater: Sink (&amp;amp;dArr;) or Rise (&amp;amp;uArr;)&lt;br /&gt;
! Float Behavior at Surface&lt;br /&gt;
|-&lt;br /&gt;
|1.8&lt;br /&gt;
|&amp;amp;dArr;&amp;amp;dArr;&amp;amp;dArr;&lt;br /&gt;
|Doesn’t float&lt;br /&gt;
|-&lt;/div&gt;</summary>
		<author><name>Springheel</name></author>
	</entry>
	<entry>
		<id>https://wiki.thedarkmod.com/index.php?title=Swimmable_Water&amp;diff=25422</id>
		<title>Swimmable Water</title>
		<link rel="alternate" type="text/html" href="https://wiki.thedarkmod.com/index.php?title=Swimmable_Water&amp;diff=25422"/>
		<updated>2019-07-17T00:23:47Z</updated>

		<summary type="html">&lt;p&gt;Springheel: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;written by angua&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
See [[Objects Floating in Water]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Create some walls ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Watertutorial1.jpg]]&lt;br /&gt;
&lt;br /&gt;
In this example, I made this little rectangular pool, but you can also use differently shaped structures.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Fill in your water ==&lt;br /&gt;
&lt;br /&gt;
Draw a brush that is going to be your water volume and texture it with common/nodraw&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Watertutorial2.jpg]]&lt;br /&gt;
&lt;br /&gt;
== Create the entity ==&lt;br /&gt;
&lt;br /&gt;
In [[DarkRadiant]]: Select your brush, {{RMB}} -&amp;gt; Create Entity -&amp;gt; &#039;&#039;&#039;atdm:liquid_water&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[Image:Watertutorial5.jpg]]&lt;br /&gt;
&lt;br /&gt;
In the Entity Inspector you can see that the classname is now &#039;&#039;&#039;atdm:liquid_water&#039;&#039;&#039;, and the name &#039;&#039;&#039;atdm:liquid_water_1&#039;&#039;&#039; (or similiar). It should also have a blue outline in the orthographic view (The XZ Front in this case).&lt;br /&gt;
&lt;br /&gt;
Note: If you use &amp;quot;func_liquid&amp;quot; instead of &amp;quot;atdm:liquid_water&amp;quot;, your water will not function correctly. It will f.i. not extinguish flames.&lt;br /&gt;
&lt;br /&gt;
== Texture the surface ==&lt;br /&gt;
&lt;br /&gt;
Select the face that is going to be the surface ({{key|CTRL}} + {{key|SHIFT}} + {{LMB}}) and texture it with a nice water texture, for example &#039;&#039;&#039;water_source/water_clear&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
[[Image:Watertutorial6.jpg]]&lt;br /&gt;
&lt;br /&gt;
Do not assign the water texture to the whole brush, or you will see this: (You can also get rid of that z-fighting by dragging the brush into the wall so that it insersects with it.)&lt;br /&gt;
&lt;br /&gt;
[[Image:Watertutorial4.jpg]]&lt;br /&gt;
&lt;br /&gt;
However, if you don&#039;t want clear water then you need to choose another surface, say water_green or water_colored, include an extra overlay plus an underwater overlay. For this, see the next section.&lt;br /&gt;
&lt;br /&gt;
==Coloured and Murky Water==&lt;br /&gt;
&lt;br /&gt;
This is a method for providing water that is coloured or murky underwater and a surface that matches.&lt;br /&gt;
&lt;br /&gt;
You can use this with different water surfaces but I recommend you first try:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;textures/water_source/water_colored.&#039;&#039; (this can be coloured but by default it is not so won&#039;t confuse the issue - the colour will be added by the overlay below.)&lt;br /&gt;
&lt;br /&gt;
To your water entity give the property:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;underwater_gui&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Now give the property the name of one of the overlay guis. The names are fairly descriptive so you can choose which type you want suitable for a river, a cave pool, or a sewer, etc.:&lt;br /&gt;
&lt;br /&gt;
 guis/underwater/underwater_green_midmurk.gui&lt;br /&gt;
 guis/underwater/underwater_green_thickmurk.gui&lt;br /&gt;
 guis/underwater/underwater_green_thinmurk.gui&lt;br /&gt;
&lt;br /&gt;
 guis/underwater/underwater_blue_midmurk.gui&lt;br /&gt;
 guis/underwater/underwater_blue_thickmurk.gui&lt;br /&gt;
 guis/underwater/underwater_blue_thinmurk.gui&lt;br /&gt;
&lt;br /&gt;
 guis/underwater/underwater_bluegrey_midmurk.gui&lt;br /&gt;
 guis/underwater/underwater_bluegrey_thickmurk.gui&lt;br /&gt;
 guis/underwater/underwater_bluegrey_thinmurk.gui&lt;br /&gt;
&lt;br /&gt;
 guis/underwater/underwater_greengrey_midmurk.gui&lt;br /&gt;
 guis/underwater/underwater_greengrey_thickmurk.gui&lt;br /&gt;
 guis/underwater/underwater_greengrey_thinmurk.gui&lt;br /&gt;
&lt;br /&gt;
Now with the water entity still selected:&lt;br /&gt;
&lt;br /&gt;
* Choose Top view in Dark Radiant&#039;s orthoview&lt;br /&gt;
* Create a simple patch from the patch menu.&lt;br /&gt;
* Move this up flush with the surface of the water.&lt;br /&gt;
* Give it the texture that matches the gui you chose above. For example, if you chose &#039;&#039; guis/underwater/underwater_bluegrey_thinmurk.gui&#039;&#039; from the above then give the overlay the texture: &#039;&#039;textures/water_source/bluegrey_plain_flat_thinmurk&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Using the above method you should find the surface opacity and colour matches how it looks when the players goes underwater.&lt;br /&gt;
&lt;br /&gt;
== Underwater fog ==&lt;br /&gt;
&lt;br /&gt;
Your water looks much more believable if it has an underwater fog. Create a light, select as texture &amp;quot;fog/basicfog&amp;quot;, give it a very dark color and resize the light so it covers the entire underwater area. This will make your water darker the deeper it is, just like in real-life!&lt;br /&gt;
&lt;br /&gt;
== Test your water ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Watertutorial3.jpg]]&lt;br /&gt;
&lt;br /&gt;
And there it is!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Current Flow==&lt;br /&gt;
&lt;br /&gt;
There is at least one flowing stream surface texture at the time of writing. If you want to create your own variations then just examine that material shader, copy and modify it. Probably it can be used with other existing surface texture images or you can create new ones.&lt;br /&gt;
&lt;br /&gt;
==Flow Force==&lt;br /&gt;
&lt;br /&gt;
A force field can be placed in water to apply a tangible flow, eg, to push the player and/or other objects along.&lt;br /&gt;
&lt;br /&gt;
See [[Func Forcefields]]&lt;br /&gt;
&lt;br /&gt;
==Wave Frequency and Direction== &lt;br /&gt;
&lt;br /&gt;
You can set the frequency of the surface waves from tiny undulations to large slow ones just by changing the surface texture scale in Surface Inspector. Flowing surfaces such as stream textures can of course be rotated to get the direction you want.&lt;br /&gt;
&lt;br /&gt;
A better way to influence the wave speed and wave hight is via [[List_of_shaderParm_variables|shaderParms]]. Set the following spawnargs on your water entity:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
shaderParm5 0.05&lt;br /&gt;
shaderParm6 0.75&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
parm5 controls the wave speed, parm6 the wave height. The defaults are 0.1 and 1.5, respectively. Experiment a bit, values lower than the defaults look more believable for still waterbodies, higher values for when you have a lot of wind.&lt;br /&gt;
&lt;br /&gt;
==Sound==&lt;br /&gt;
&lt;br /&gt;
If the water level is less than 1, you get normal footsteps.&lt;br /&gt;
&lt;br /&gt;
Between 1 and 34, you get splash sounds.&lt;br /&gt;
&lt;br /&gt;
Between 34 and 77, you get wading sounds.&lt;br /&gt;
&lt;br /&gt;
If 77 or more, you get swimming sounds.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Troubleshooting Problems==&lt;br /&gt;
&lt;br /&gt;
===Visible Joints Between Water Brushes===&lt;br /&gt;
&lt;br /&gt;
If you place brushes of water against one another, eg, along a channel, round corners, to form a canal, etc. and you can &#039;see the joins&#039; then the most likely cause of the problem is that the surface textures do not align. We are used to aligning static textures but it is not so obvious with the dynamic translucent surface of water that we might not think of it. Just copy and paste shader one of the surface textures to all the others to get the same scroll and scale alignment and it should be OK.&lt;br /&gt;
&lt;br /&gt;
NOTE: If you want to use the NoDraw Solid texture, be sure NOT to use it between water entities, otherwise you won&#039;t be able to swim between them.&lt;br /&gt;
&lt;br /&gt;
{{tutorial-water}}&lt;br /&gt;
[[Category:Mapping Tutorials]]&lt;/div&gt;</summary>
		<author><name>Springheel</name></author>
	</entry>
	<entry>
		<id>https://wiki.thedarkmod.com/index.php?title=Model_Scaling&amp;diff=25418</id>
		<title>Model Scaling</title>
		<link rel="alternate" type="text/html" href="https://wiki.thedarkmod.com/index.php?title=Model_Scaling&amp;diff=25418"/>
		<updated>2019-07-02T13:44:39Z</updated>

		<summary type="html">&lt;p&gt;Springheel: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Page Title: Rescaling Models with Dark Radiant&#039;s “Model Scaler”&lt;br /&gt;
&lt;br /&gt;
[This page is a draft. Please help make it better. Geep]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Basic Operation ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;Model Scaler&amp;quot; button, on the left side of the DR screen, is the best way to resize a model symmetrically. As its name implies, it works with models, NOT entities, brushes, patches, or AI.&lt;br /&gt;
&lt;br /&gt;
After creating or selecting a model instance in the grid, pressing “Model Scaler” encloses it in a rectangular box. Drag any of the box vertices (blue dots) with a mouse to enlarge or shrink it. The vertex movement may not stay aligned perfectly with the mouse cursor movement, so you may need to interrupt the drag and reposition.&lt;br /&gt;
&lt;br /&gt;
Scaling by a Fixed Amount&lt;br /&gt;
&lt;br /&gt;
Usually the scaling is simply done by eye.  But if it is important to scale up or down by an (approximately) fixed factor:&lt;br /&gt;
•	Select a relatively fine grid size, so Model Scaler handles move more fluidly.&lt;br /&gt;
•	Before scaling, note the size of some dimension (e.g., x width) in a DR orthogonal view&lt;br /&gt;
•	Calculate what that “target dimension” should be once the factor is applied.&lt;br /&gt;
•	As you resize with Model Scaler, keep an eye on the target dimension.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== How the Model Scaler Works ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Using the Model Scaler clones the original distributed model, resizes it by changing all the edge lengths, and saves the result as a new file in the models/map_specific folder/scaled/ folder of your FM.  So if you create a grammaphone instance by picking…&lt;br /&gt;
	darkmod/musical/grammo3.ase&lt;br /&gt;
…and use Model Scaler, the result in the Entity Viewer for “model” might be:&lt;br /&gt;
	models/map_specific/scaled/grammo3_scaled1.ase&lt;br /&gt;
If you create multiple objects with different scale factors, multiple files are created, with trailing number bumped.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Alternative Techniques ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Outside Dark Radiant ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The most obvious alternative is to do model scaling outside of DR, e.g., in Blender. The appeal of this roundtripping may vary.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Matrix Editing ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As for DR-only methods, generally, with a model, if you try the DR’s top menu “Modify/Rotate and scale…”, the Scale controls are grayed out. This is to discourage you from making scaling changes to the transformation matrix.  The TDM/Doom 3 engine has significant runtime shortcomings in using the transformation (aka “rotation”) matrix for scaling. This includes problems with lighting, rendering, and collisions. If you REALLY need to use this older technique by hand-editing the matrix, see [Rescaling,_Resizing,_Models_in_Dark_Radiant] and [Resizing_Models].&lt;br /&gt;
&lt;br /&gt;
Remaining use cases for this older problematic technique might be:&lt;br /&gt;
•	For non-symmetric scaling (in which case you use different factors for X, Y, and Z matrix entries).&lt;br /&gt;
•	When you can’t use Modify Scaler because, say, you don’t have a model available, only an Entity (e.g., turnip stub).&lt;/div&gt;</summary>
		<author><name>Springheel</name></author>
	</entry>
	<entry>
		<id>https://wiki.thedarkmod.com/index.php?title=Model_Scaling&amp;diff=25417</id>
		<title>Model Scaling</title>
		<link rel="alternate" type="text/html" href="https://wiki.thedarkmod.com/index.php?title=Model_Scaling&amp;diff=25417"/>
		<updated>2019-07-02T13:44:19Z</updated>

		<summary type="html">&lt;p&gt;Springheel: Created page with &amp;quot;Page Title: Rescaling Models with Dark Radiant&amp;#039;s “Model Scaler”  [This page is a draft. Please help make it better. Geep]  Basic Operation  The &amp;quot;Model Scaler&amp;quot; button, on t...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Page Title: Rescaling Models with Dark Radiant&#039;s “Model Scaler”&lt;br /&gt;
&lt;br /&gt;
[This page is a draft. Please help make it better. Geep]&lt;br /&gt;
&lt;br /&gt;
Basic Operation&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;Model Scaler&amp;quot; button, on the left side of the DR screen, is the best way to resize a model symmetrically. As its name implies, it works with models, NOT entities, brushes, patches, or AI.&lt;br /&gt;
&lt;br /&gt;
After creating or selecting a model instance in the grid, pressing “Model Scaler” encloses it in a rectangular box. Drag any of the box vertices (blue dots) with a mouse to enlarge or shrink it. The vertex movement may not stay aligned perfectly with the mouse cursor movement, so you may need to interrupt the drag and reposition.&lt;br /&gt;
&lt;br /&gt;
Scaling by a Fixed Amount&lt;br /&gt;
&lt;br /&gt;
Usually the scaling is simply done by eye.  But if it is important to scale up or down by an (approximately) fixed factor:&lt;br /&gt;
•	Select a relatively fine grid size, so Model Scaler handles move more fluidly.&lt;br /&gt;
•	Before scaling, note the size of some dimension (e.g., x width) in a DR orthogonal view&lt;br /&gt;
•	Calculate what that “target dimension” should be once the factor is applied.&lt;br /&gt;
•	As you resize with Model Scaler, keep an eye on the target dimension.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== How the Model Scaler Works ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Using the Model Scaler clones the original distributed model, resizes it by changing all the edge lengths, and saves the result as a new file in the models/map_specific folder/scaled/ folder of your FM.  So if you create a grammaphone instance by picking…&lt;br /&gt;
	darkmod/musical/grammo3.ase&lt;br /&gt;
…and use Model Scaler, the result in the Entity Viewer for “model” might be:&lt;br /&gt;
	models/map_specific/scaled/grammo3_scaled1.ase&lt;br /&gt;
If you create multiple objects with different scale factors, multiple files are created, with trailing number bumped.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Alternative Techniques ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Outside Dark Radiant ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The most obvious alternative is to do model scaling outside of DR, e.g., in Blender. The appeal of this roundtripping may vary.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Matrix Editing ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As for DR-only methods, generally, with a model, if you try the DR’s top menu “Modify/Rotate and scale…”, the Scale controls are grayed out. This is to discourage you from making scaling changes to the transformation matrix.  The TDM/Doom 3 engine has significant runtime shortcomings in using the transformation (aka “rotation”) matrix for scaling. This includes problems with lighting, rendering, and collisions. If you REALLY need to use this older technique by hand-editing the matrix, see [Rescaling,_Resizing,_Models_in_Dark_Radiant] and [Resizing_Models].&lt;br /&gt;
&lt;br /&gt;
Remaining use cases for this older problematic technique might be:&lt;br /&gt;
•	For non-symmetric scaling (in which case you use different factors for X, Y, and Z matrix entries).&lt;br /&gt;
•	When you can’t use Modify Scaler because, say, you don’t have a model available, only an Entity (e.g., turnip stub).&lt;/div&gt;</summary>
		<author><name>Springheel</name></author>
	</entry>
	<entry>
		<id>https://wiki.thedarkmod.com/index.php?title=Resizing_Models&amp;diff=25416</id>
		<title>Resizing Models</title>
		<link rel="alternate" type="text/html" href="https://wiki.thedarkmod.com/index.php?title=Resizing_Models&amp;diff=25416"/>
		<updated>2019-07-02T13:43:21Z</updated>

		<summary type="html">&lt;p&gt;Springheel: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;Note: This article is largely obsolete. Model scaling is available in Dark Radiant 2.2.1 and higher.  See [[Model Scaling]]&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Further details: http://forums.thedarkmod.com/topic/18586-darkradiant-220-pre-release-testing/page-2#entry400283&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;written by Fidcal&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Resizing models is generally not recommended but I do it a lot. It works fine with many models but there are a few fixes needed.&lt;br /&gt;
&lt;br /&gt;
* This method does not work with any AI or corpses.&lt;br /&gt;
* It does not work with moveables or movers. (I am unsure about movers - it might be OK if they are symmetrically resized, eg, all dimensions doubled.)&lt;br /&gt;
* It does not work with &#039;&#039;all&#039;&#039; static models anyway. So you have to try it on a particular model then check it in-game to see if it looks and works correctly. It&#039;s a hack. This is how I do it:&lt;br /&gt;
&lt;br /&gt;
Do not rotate the model first. If you have then first delete the rotation property. Otherwise the numbers might be too complex to deal with easily (try it and see!)&lt;br /&gt;
&lt;br /&gt;
Give the model this property:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;rotation 1 0 0 0 1 0 0 0 1&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
That mean unrotated scale normal. (a quick way to get the above from UNrotated is rotate 45 degrees then back again in top view. - edit - this might not work in later versions of Dark Radiant)&lt;br /&gt;
&lt;br /&gt;
The 1&#039;s are the scale so double all sides would be 2 0 0 0 2 0 0 0 2&lt;br /&gt;
Or half width double height might be 0.5 0 0 0 0.5 0 0 0 2&lt;br /&gt;
Note that these are &#039;&#039;world&#039;&#039; oriented so if you need to rotate the model later you should anticipate that and change the side that &#039;&#039;will&#039;&#039; be turned that way after you rotate it! (experiement and undo and you&#039;ll see soon see what I mean. If you make a long table even longer then rotate it then now it is not longer but &#039;fatter&#039;!)&lt;br /&gt;
&lt;br /&gt;
Once you&#039;ve done the above then you can rotate the model if necessary subject to what I said above. &lt;br /&gt;
&lt;br /&gt;
The collision model is now &#039;wrong&#039; (it&#039;s still the original size) so give the model the property solid 0. Now you and AI can walk through it so build a nodraw solid brush(es) inside roughly the shape (there are nodraw solid textures for different materials so pick the right one eg, nodraw_solid_wood so it sounds correct when impacted.) &lt;br /&gt;
&lt;br /&gt;
The shadow will be &#039;wrong&#039; (it&#039;s still the original size). Set the model noshadows 1 so it has no shadow. If you want a shadow then make the inner brush to be a real material like wood.&lt;br /&gt;
&lt;br /&gt;
If there is a texture specular map (shinyness) then it won&#039;t scale so the texture might go unnaturally dark, almost black. Avoid those. But many models work fine.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Addition by Flanders 9-11-2009&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you are familiar with matrix calculation than this might be useful if you want to use the rotation spawnarg for arbitrary transformations.&lt;br /&gt;
&lt;br /&gt;
The notation that is used with the rotation spawnarg is that of a 3x3 transformation matrix like this one on the left:&lt;br /&gt;
&lt;br /&gt;
 [ 1 0 0 ] [ x ]   [ x ]&lt;br /&gt;
 [ 0 1 0 ] [ y ] = [ y ] &lt;br /&gt;
 [ 0 0 1 ] [ z ]   [ z ]&lt;br /&gt;
&lt;br /&gt;
The transformation matrix transforms the model coordinates into a new set of coordinates, so if you want to scale a model use it like this:&lt;br /&gt;
 [ 1 0   0 ] [ x ]   [    x ]&lt;br /&gt;
 [ 0 2   0 ] [ y ] = [   2y ] &lt;br /&gt;
 [ 0 0 0.5 ] [ z ]   [ 0.5z ]&lt;br /&gt;
&lt;br /&gt;
For reflections use a negative scale value.&lt;br /&gt;
&lt;br /&gt;
For rotations use one of these:&lt;br /&gt;
&lt;br /&gt;
Around the x-axis:&lt;br /&gt;
&lt;br /&gt;
 [ 1 0       0      ]&lt;br /&gt;
 [ 0 cos(a) -sin(a) ]&lt;br /&gt;
 [ 0 sin(a)  cos(a) ]&lt;br /&gt;
&lt;br /&gt;
For a rotation of 90 degrees that gives:&lt;br /&gt;
&lt;br /&gt;
 [ 1 0  0 ] [ x ]   [  x ]&lt;br /&gt;
 [ 0 0 -1 ] [ y ] = [ -z ] &lt;br /&gt;
 [ 0 1  0 ] [ z ]   [  y ]&lt;br /&gt;
&lt;br /&gt;
Around the y-axis:&lt;br /&gt;
&lt;br /&gt;
 [  cos(a) 0 sin(a) ]&lt;br /&gt;
 [  0      1 0      ]&lt;br /&gt;
 [ -sin(a) 0 cos(a) ]&lt;br /&gt;
&lt;br /&gt;
Around the z-axis:&lt;br /&gt;
&lt;br /&gt;
 [ cos(a) -sin(a) 0 ]&lt;br /&gt;
 [ sin(a)  cos(a) 0 ]&lt;br /&gt;
 [ 0       0      1 ]&lt;br /&gt;
&lt;br /&gt;
If you want to scale and rotate a model in an arbitrary way, scale and rotate the model separately, get the right matrix for scaling first, then delete the rotation spawnarg and get the right matrix for rotation. Multiply these two matrices to get the combination of the two transformations. &lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
I want to widen and flatten a model so I use this for scaling:&lt;br /&gt;
&lt;br /&gt;
 2 0 0 0 1 0 0 0 0.5&lt;br /&gt;
&lt;br /&gt;
Now I want to rotate it 45 degrees around the z axis:&lt;br /&gt;
&lt;br /&gt;
I delete the rotation spawnarg to get the model back in it’s original size, I use Modify &amp;gt; rotate and scale and rotate it 45 degrees around the z-axis:&lt;br /&gt;
&lt;br /&gt;
 0.707107 -0.707107 0 0.707107 0.707107 0 0 0 1&lt;br /&gt;
&lt;br /&gt;
Multiply them like this:&lt;br /&gt;
&lt;br /&gt;
 [ 2 0   0 ]   [ 0.707107 -0.707107 0 ]   [ 1.414 -1.414   0 ]&lt;br /&gt;
 [ 0 1   0 ] x [ 0.707107  0.707107 0 ] = [ 0.707  0.707   0 ]&lt;br /&gt;
 [ 0 0 0.5 ]   [        0         0 1 ]   [     0      0 0.5 ]&lt;br /&gt;
&lt;br /&gt;
And enter the result in as the rotation spawnarg:&lt;br /&gt;
&lt;br /&gt;
 1.414 -1.414  0.000 0.707  0.707  0.000 0.000  0.000  0.500 &lt;br /&gt;
&lt;br /&gt;
This gets me a wide and flat model rotated 45 degrees.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Editing]]&lt;/div&gt;</summary>
		<author><name>Springheel</name></author>
	</entry>
	<entry>
		<id>https://wiki.thedarkmod.com/index.php?title=Stim/Response_Editor&amp;diff=20546</id>
		<title>Stim/Response Editor</title>
		<link rel="alternate" type="text/html" href="https://wiki.thedarkmod.com/index.php?title=Stim/Response_Editor&amp;diff=20546"/>
		<updated>2018-08-17T14:15:19Z</updated>

		<summary type="html">&lt;p&gt;Springheel: /* Available effects */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Stim / Response Editor =&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
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 [[Glossary#Spawnarg|arg]] does. &lt;br /&gt;
&lt;br /&gt;
For more general reading on stims and responses, please see also the pages [[Stim/Response]] and [[Stim/Response Key/Values]].&lt;br /&gt;
&lt;br /&gt;
= Stims =&lt;br /&gt;
&lt;br /&gt;
To add a Stim or Response to an entity, open the Stim/Response editor:&lt;br /&gt;
Select the entity and - from the menu bar - go to Entity &amp;gt; Stim/Response.&lt;br /&gt;
The Stim/Response Editor has three tabs: Stims, Responses and Custom Stims.&lt;br /&gt;
As stated on the [[Stim/Response]] page, an entity can have either or both Stims and Responses, but is not able to create a Response through a Stim fired on itself.&lt;br /&gt;
&lt;br /&gt;
To add a non-custom Stim, select the &amp;quot;Stims&amp;quot; tab.&lt;br /&gt;
From here, it is possible to add a Stim from the drop-down menu next to the &amp;quot;Add&amp;quot; button, clicking the Add button and choosing a stim from the &amp;quot;Type&amp;quot; drop-down menu at the top (&amp;quot;Frob&amp;quot; being the default) or using a keyboard shortcut by pressing the initial letter of the Stim type you&#039;d like to add.&lt;br /&gt;
&lt;br /&gt;
Select the Stim to edit from the numbered list on the left.&lt;br /&gt;
If no Stim type is selected, all options presented on the right are greyed out.&lt;br /&gt;
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]].&lt;br /&gt;
&lt;br /&gt;
= Responses =&lt;br /&gt;
&lt;br /&gt;
The Response Editor is a simplified way to create basic scripts without need for deeper knowledge in scripting for TDM.&lt;br /&gt;
It works similar to the Stim Editor, but for adding Stims that will act as entity Responses.&lt;br /&gt;
In the Responses tab, the Stim to which the selected entity should respond is selected in the same way as the Stims tab.&lt;br /&gt;
&lt;br /&gt;
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.&amp;lt;br&amp;gt;&lt;br /&gt;
To add an effect, right-click in the &amp;quot;Response Effects&amp;quot; window and press, &amp;quot;Add new Effect&amp;quot;.&amp;lt;br&amp;gt;&lt;br /&gt;
Double-clicking the numbered Response (or right-clicking it and choosing &amp;quot;Edit&amp;quot;) will open the &amp;quot;Edit Response Effect&amp;quot; box, in which it is possible to select the target entity, type of Stim (as args) and the Response effect itself.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Available effects ==&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Activate Response:&#039;&#039;&#039; Activates the Response for the stated Stim Type on the stated Entity.&lt;br /&gt;
** E.g. the player must give a fire stim to a furnace in order to have a door react to a frob Stim.&lt;br /&gt;
* &#039;&#039;&#039;Activate Shooter:&#039;&#039;&#039; Activates the named Shooter entity.&lt;br /&gt;
** E.g. Can be used to activate a trap.&lt;br /&gt;
* &#039;&#039;&#039;Activate Stim:&#039;&#039;&#039; Activates the Stim for the stated Stim Type on the named Entity.&lt;br /&gt;
** E.g. Adds a damage stim to the furnace after a fire stim is given.&lt;br /&gt;
* &#039;&#039;&#039;Add Target: &#039;&#039;&#039; Adds the stated Target to the named Entity.&lt;br /&gt;
** E.g.  Add a new path_corner to a patrol route.&lt;br /&gt;
* &#039;&#039;&#039;Apply Stim:&#039;&#039;&#039; Fires a Stim of the stated Stim Type to the named Target.&lt;br /&gt;
** The Source can be changed, but is not necessary.&lt;br /&gt;
* &#039;&#039;&#039;Blind AI:&#039;&#039;&#039; Blinds the named AI as if a flash bomb has been used on it.&lt;br /&gt;
* &#039;&#039;&#039;Clear Targets:&#039;&#039;&#039; Removes all Target-args from the named Entity.&lt;br /&gt;
* &#039;&#039;&#039;Damage:&#039;&#039;&#039; Applies a damage type to the stated Target.  By default, both the player and AI have a response to Damage stims.  If time_interval is not set, it defaults to firing every millisecond, which will kill anything almost instantly.&lt;br /&gt;
** Damage Defs can be found in the def file &amp;quot;darkmod/tdm_defs01.pk4/defs/tdm_damage.def&amp;quot;.  (I think this would have to be changed at the response level, on the player and AI)&lt;br /&gt;
* &#039;&#039;&#039;Deactivate Response:&#039;&#039;&#039; Deactivates the Response for the stated Stim Type on the named Entity.&lt;br /&gt;
* &#039;&#039;&#039;Deactivate Shooter:&#039;&#039;&#039; Deactivates the stated Shooter.&lt;br /&gt;
** E.g. Can be used to disarm a trap.&lt;br /&gt;
* &#039;&#039;&#039;Deactivate Stim:&#039;&#039;&#039; Deactivates the Stim for the stated Stim Type on the named Entity.&lt;br /&gt;
* &#039;&#039;&#039;Disable Effect:&#039;&#039;&#039; Disables only one Effect on the named Entity.&lt;br /&gt;
** 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.&lt;br /&gt;
* &#039;&#039;&#039;Enable Effect:&#039;&#039;&#039; Enables only one Effect on the stated Entity.&lt;br /&gt;
** 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.&lt;br /&gt;
* &#039;&#039;&#039;Fade Light Color:&#039;&#039;&#039; Changes the colour of the named Target Light to the stated Color over a time of Fade Time seconds.&lt;br /&gt;
* &#039;&#039;&#039;Frob:&#039;&#039;&#039; Frobs the named Entity as if it had been frobbed by the player.&lt;br /&gt;
* &#039;&#039;&#039;Gas Knockout:&#039;&#039;&#039; Knocks out the named Target as if it had been hit with a gas arrow.&lt;br /&gt;
* &#039;&#039;&#039;Heal:&#039;&#039;&#039; Heals the named Target by the stated Amount.&lt;br /&gt;
* &#039;&#039;&#039;Kill:&#039;&#039;&#039; Kills the named Target.  AI don&#039;t have a default Response to this as standard. &lt;br /&gt;
* &#039;&#039;&#039;Knockout:&#039;&#039;&#039; Knocks out the named Target as if it had been hit with the blackjack.&lt;br /&gt;
* &#039;&#039;&#039;Turn extinguishable Light Off:&#039;&#039;&#039; Extinguishes the named extinguishable Light.&lt;br /&gt;
* &#039;&#039;&#039;Turn extinguishable Light On:&#039;&#039;&#039; (Re)ignites the named extinguishable Light.&lt;br /&gt;
* &#039;&#039;&#039;Turn Light Off:&#039;&#039;&#039; Turns off the named Light.&lt;br /&gt;
* &#039;&#039;&#039;Turn Light On:&#039;&#039;&#039; Turns on the named Light.&lt;br /&gt;
* &#039;&#039;&#039;Move To Position:&#039;&#039;&#039; Moves the named Entity to the stated Position (coordinates: X Y Z).&lt;br /&gt;
** If the box &amp;quot;Relative to old origin&amp;quot; is ticked, the Entity is moved (X Y Z) units from its current location.&lt;br /&gt;
* &#039;&#039;&#039;Move To Random Position:&#039;&#039;&#039; Moves the named Entity to a random position inside the &amp;quot;Within Radius&amp;quot; range.&lt;br /&gt;
* &#039;&#039;&#039;Play Animation:&#039;&#039;&#039; Plays the stated Animation for the stated Entity.&lt;br /&gt;
** 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.&lt;br /&gt;
* &#039;&#039;&#039;Play Sound:&#039;&#039;&#039; Play the named entity&#039;s stated Sound.&lt;br /&gt;
** The channel can be limited (e.g. to the player voice or ambient), but this can also be left blank.&lt;br /&gt;
* &#039;&#039;&#039;Play Sound Shader:&#039;&#039;&#039; 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.&lt;br /&gt;
* &#039;&#039;&#039;Remove:&#039;&#039;&#039; Removes the named Target from the map.&lt;br /&gt;
* &#039;&#039;&#039;Run Script:&#039;&#039;&#039; Runs the named Script. For more information on scripts refer to [[Scripting basics]].&lt;br /&gt;
* &#039;&#039;&#039;Set AI Team:&#039;&#039;&#039; Change the named AI&#039;s team to the stated Team.&lt;br /&gt;
** For a list of which AI belongs to which team by default, refer to [[AI_Relations_(Editing)#AI_Types_.28Teams.29|AI Relations]]&lt;br /&gt;
* &#039;&#039;&#039;Set Angles:&#039;&#039;&#039; Set the named Target&#039;s rotation to the stated Angles (in pitch/yaw/roll).&lt;br /&gt;
** As with Move To Position, this is also possible relative to the entity&#039;s current angles.&lt;br /&gt;
* &#039;&#039;&#039;Set Frobable:&#039;&#039;&#039; Sets the named Entity as frobable (box checked) or unfrobable (box unchecked).&lt;br /&gt;
* &#039;&#039;&#039;Set Light Color:&#039;&#039;&#039; Changes the colour of the named Target Light to the stated Color.&lt;br /&gt;
** In contrast to &amp;quot;Fade to Color&amp;quot;, this happens without any transition.&lt;br /&gt;
* &#039;&#039;&#039;Set Model:&#039;&#039;&#039; Changes the current model of the named Target to the stated Model.&lt;br /&gt;
** E.g. Can be used to change a model to a broken model after recieving damage.&lt;br /&gt;
* &#039;&#039;&#039;Set Skin:&#039;&#039;&#039; Changes the current skin of the stated Target to the stated Skin.&lt;br /&gt;
* &#039;&#039;&#039;Set Spawnarg:&#039;&#039;&#039; Changes the value of a Key (Spawnarg) on the stated Target to a stated Value.&lt;br /&gt;
* &#039;&#039;&#039;Spawn Entity:&#039;&#039;&#039; 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.&lt;br /&gt;
* &#039;&#039;&#039;Spawn Particle:&#039;&#039;&#039; Creates an emitter that will emit the named [[Particles|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.&lt;br /&gt;
* &#039;&#039;&#039;Start Stim Timer:&#039;&#039;&#039; Starts the timer of the stated Stim on the named Entity.&lt;br /&gt;
** For information about how a timer on a Stim works, refer to [[Stim/Response Key/Values]], E.g. Key: sr_timer_time_N.&lt;br /&gt;
* &#039;&#039;&#039;Stop Stim Timer:&#039;&#039;&#039; Stops the timer of the stated Stim on the named Entity.&lt;br /&gt;
** For information about how a timer on a Stim works, refer to [[Stim/Response Key/Values]], E.g. Key: sr_timer_time_N.&lt;br /&gt;
* &#039;&#039;&#039;Teleport (Set Origin):&#039;&#039;&#039; Moves the named Entity to the stated location&#039;s New Origin (coordinates: X Y Z).&lt;br /&gt;
** If the box &amp;quot;Relative to old origin&amp;quot; is checked, the Entity is moved (X Y Z) units from its current location.&lt;br /&gt;
* &#039;&#039;&#039;Toggle Effect:&#039;&#039;&#039; Disables the stated Effect if enabled or enables the stated Effect if disabled on the named Entity.&lt;br /&gt;
** 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.&lt;br /&gt;
* &#039;&#039;&#039;Toggle Light:&#039;&#039;&#039; Turns off the named Light if on or turns on the named Light if off.&lt;br /&gt;
* &#039;&#039;&#039;Trigger:&#039;&#039;&#039; 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).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The Response list gives a variety of options that allows for many effects without the need to write scripts.&lt;br /&gt;
&lt;br /&gt;
It is possible to add several effects with one response type by checking the box, &amp;quot;Random Effects&amp;quot; and entering the number of random effects to be used.&lt;br /&gt;
Note that each effect can be used multiple times. E.g. Selecting only one effect and setting &amp;quot;Random Effects: 3&amp;quot; will use the same effect three times.&lt;br /&gt;
&lt;br /&gt;
= Examples =&lt;br /&gt;
&lt;br /&gt;
== Arrow Trap ==&lt;br /&gt;
&lt;br /&gt;
First, create an &amp;quot;atdm:func_shooter&amp;quot; entity and position it so that the arrow points in the desired direction to shoot.&lt;br /&gt;
&#039;&#039;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&#039;&#039;.&lt;br /&gt;
Define the projectile to be fired (the default is a fire arrow) and check the pitch for the projectile&#039;s trajectory.&lt;br /&gt;
&lt;br /&gt;
Next, it is necessary to create an activator, that can be achieved with the Stim/Response Editor as follows:&lt;br /&gt;
* Create a brush, giving it a NoDraw texture and convert it to a [[Glossary#func_static|func_static]].&lt;br /&gt;
* 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 [[Limits,_Max,_Min,_Stats,_etc#Conversion_of_game units|units]]).&lt;br /&gt;
* Open the Stim/Response Editor.&lt;br /&gt;
* Add a Response &amp;quot;Player&amp;quot; to the NoDraw func_static entity.&lt;br /&gt;
* To that Response, add the Effect &amp;quot;Activate Shooter&amp;quot; with the name of the shooter as &amp;quot;Shooter Entity&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Now the shooter will start firing as soon as the player comes within 100 units of the NoDraw func_static entity.&lt;br /&gt;
&lt;br /&gt;
There are three options:&lt;br /&gt;
&lt;br /&gt;
* If the the setup is left as it is, the shooter will continuously fire.&lt;br /&gt;
* 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.&lt;br /&gt;
* If the shooter is to fire only once, it is necessary to add the Effect, &amp;quot;Disable Effect&amp;quot; and target the first effect that activates the shooter or give an ammo value of 1.&lt;br /&gt;
&lt;br /&gt;
It may also possible for the player to disarm the trap:&lt;br /&gt;
&lt;br /&gt;
* Create a response on another entity that the player will use to do to disarm the trap.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;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.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* Add the same &amp;quot;Disable Effect&amp;quot; effect as before.&lt;br /&gt;
* It is also possible to use the Effect, &amp;quot;Remove shooter&amp;quot;. But if this is used, the shooter will not be reactivated (E.g. if the player re-arms the trap, as above).&lt;br /&gt;
&#039;&#039;Note that using this setup, where the Response is &amp;quot;Player&amp;quot;, the trap will exclusively react to the player and not to any AI.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Change Patrol ==&lt;br /&gt;
&lt;br /&gt;
An AI&#039;s behaviour, such as its [[AI_Patrol|patrol route]], may be altered through a response.&lt;br /&gt;
E.g. If the player has taken a specific loot item.&lt;br /&gt;
&lt;br /&gt;
* Give the loot item a Response &amp;quot;Frob&amp;quot;.&lt;br /&gt;
* Add the effect &amp;quot;Add Target&amp;quot;.&lt;br /&gt;
* As the &amp;quot;Entity&amp;quot; do not use the AI, but the path_corner from which the AI is to leave its original path to enter the new one.&lt;br /&gt;
* As &amp;quot;Target&amp;quot; put in the first path_corner of the new path.&lt;br /&gt;
&lt;br /&gt;
If the new path circles back to the original path, the path will fork at this point:&lt;br /&gt;
if the new path does not target any path_corner of the original path, the AI will remain patrolling the new path.&lt;/div&gt;</summary>
		<author><name>Springheel</name></author>
	</entry>
	<entry>
		<id>https://wiki.thedarkmod.com/index.php?title=Stim/Response_Editor&amp;diff=20545</id>
		<title>Stim/Response Editor</title>
		<link rel="alternate" type="text/html" href="https://wiki.thedarkmod.com/index.php?title=Stim/Response_Editor&amp;diff=20545"/>
		<updated>2018-08-15T19:39:43Z</updated>

		<summary type="html">&lt;p&gt;Springheel: /* Available effects */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Stim / Response Editor =&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
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 [[Glossary#Spawnarg|arg]] does. &lt;br /&gt;
&lt;br /&gt;
For more general reading on stims and responses, please see also the pages [[Stim/Response]] and [[Stim/Response Key/Values]].&lt;br /&gt;
&lt;br /&gt;
= Stims =&lt;br /&gt;
&lt;br /&gt;
To add a Stim or Response to an entity, open the Stim/Response editor:&lt;br /&gt;
Select the entity and - from the menu bar - go to Entity &amp;gt; Stim/Response.&lt;br /&gt;
The Stim/Response Editor has three tabs: Stims, Responses and Custom Stims.&lt;br /&gt;
As stated on the [[Stim/Response]] page, an entity can have either or both Stims and Responses, but is not able to create a Response through a Stim fired on itself.&lt;br /&gt;
&lt;br /&gt;
To add a non-custom Stim, select the &amp;quot;Stims&amp;quot; tab.&lt;br /&gt;
From here, it is possible to add a Stim from the drop-down menu next to the &amp;quot;Add&amp;quot; button, clicking the Add button and choosing a stim from the &amp;quot;Type&amp;quot; drop-down menu at the top (&amp;quot;Frob&amp;quot; being the default) or using a keyboard shortcut by pressing the initial letter of the Stim type you&#039;d like to add.&lt;br /&gt;
&lt;br /&gt;
Select the Stim to edit from the numbered list on the left.&lt;br /&gt;
If no Stim type is selected, all options presented on the right are greyed out.&lt;br /&gt;
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]].&lt;br /&gt;
&lt;br /&gt;
= Responses =&lt;br /&gt;
&lt;br /&gt;
The Response Editor is a simplified way to create basic scripts without need for deeper knowledge in scripting for TDM.&lt;br /&gt;
It works similar to the Stim Editor, but for adding Stims that will act as entity Responses.&lt;br /&gt;
In the Responses tab, the Stim to which the selected entity should respond is selected in the same way as the Stims tab.&lt;br /&gt;
&lt;br /&gt;
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.&amp;lt;br&amp;gt;&lt;br /&gt;
To add an effect, right-click in the &amp;quot;Response Effects&amp;quot; window and press, &amp;quot;Add new Effect&amp;quot;.&amp;lt;br&amp;gt;&lt;br /&gt;
Double-clicking the numbered Response (or right-clicking it and choosing &amp;quot;Edit&amp;quot;) will open the &amp;quot;Edit Response Effect&amp;quot; box, in which it is possible to select the target entity, type of Stim (as args) and the Response effect itself.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Available effects ==&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Activate Response:&#039;&#039;&#039; Activates the Response for the stated Stim Type on the stated Entity.&lt;br /&gt;
** E.g. the player must give a fire stim to a furnace in order to have a door react to a frob Stim.&lt;br /&gt;
* &#039;&#039;&#039;Activate Shooter:&#039;&#039;&#039; Activates the named Shooter entity.&lt;br /&gt;
** E.g. Can be used to activate a trap.&lt;br /&gt;
* &#039;&#039;&#039;Activate Stim:&#039;&#039;&#039; Activates the Stim for the stated Stim Type on the named Entity.&lt;br /&gt;
** E.g. Adds a damage stim to the furnace after a fire stim is given.&lt;br /&gt;
* &#039;&#039;&#039;Add Target: &#039;&#039;&#039; Adds the stated Target to the named Entity.&lt;br /&gt;
** E.g.  Add a new path_corner to a patrol route.&lt;br /&gt;
* &#039;&#039;&#039;Apply Stim:&#039;&#039;&#039; Fires a Stim of the stated Stim Type to the named Target.&lt;br /&gt;
** The Source can be changed, but is not necessary.&lt;br /&gt;
* &#039;&#039;&#039;Blind AI:&#039;&#039;&#039; Blinds the named AI as if a flash bomb has been used on it.&lt;br /&gt;
* &#039;&#039;&#039;Clear Targets:&#039;&#039;&#039; Removes all Target-args from the named Entity.&lt;br /&gt;
* &#039;&#039;&#039;Damage:&#039;&#039;&#039; Applies a damage type to the stated Target.  By default, both the player and AI have a response to Damage stims.  If time_interval is not set, it defaults to firing every millisecond, which will kill anything almost instantly.&lt;br /&gt;
** Damage Defs can be found in the def file &amp;quot;darkmod/tdm_defs01.pk4/defs/tdm_damage.def&amp;quot;.&lt;br /&gt;
* &#039;&#039;&#039;Deactivate Response:&#039;&#039;&#039; Deactivates the Response for the stated Stim Type on the named Entity.&lt;br /&gt;
* &#039;&#039;&#039;Deactivate Shooter:&#039;&#039;&#039; Deactivates the stated Shooter.&lt;br /&gt;
** E.g. Can be used to disarm a trap.&lt;br /&gt;
* &#039;&#039;&#039;Deactivate Stim:&#039;&#039;&#039; Deactivates the Stim for the stated Stim Type on the named Entity.&lt;br /&gt;
* &#039;&#039;&#039;Disable Effect:&#039;&#039;&#039; Disables only one Effect on the named Entity.&lt;br /&gt;
** 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.&lt;br /&gt;
* &#039;&#039;&#039;Enable Effect:&#039;&#039;&#039; Enables only one Effect on the stated Entity.&lt;br /&gt;
** 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.&lt;br /&gt;
* &#039;&#039;&#039;Fade Light Color:&#039;&#039;&#039; Changes the colour of the named Target Light to the stated Color over a time of Fade Time seconds.&lt;br /&gt;
* &#039;&#039;&#039;Frob:&#039;&#039;&#039; Frobs the named Entity as if it had been frobbed by the player.&lt;br /&gt;
* &#039;&#039;&#039;Gas Knockout:&#039;&#039;&#039; Knocks out the named Target as if it had been hit with a gas arrow.&lt;br /&gt;
* &#039;&#039;&#039;Heal:&#039;&#039;&#039; Heals the named Target by the stated Amount.&lt;br /&gt;
* &#039;&#039;&#039;Kill:&#039;&#039;&#039; Kills the named Target.  AI don&#039;t have a default Response to this as standard. &lt;br /&gt;
* &#039;&#039;&#039;Knockout:&#039;&#039;&#039; Knocks out the named Target as if it had been hit with the blackjack.&lt;br /&gt;
* &#039;&#039;&#039;Turn extinguishable Light Off:&#039;&#039;&#039; Extinguishes the named extinguishable Light.&lt;br /&gt;
* &#039;&#039;&#039;Turn extinguishable Light On:&#039;&#039;&#039; (Re)ignites the named extinguishable Light.&lt;br /&gt;
* &#039;&#039;&#039;Turn Light Off:&#039;&#039;&#039; Turns off the named Light.&lt;br /&gt;
* &#039;&#039;&#039;Turn Light On:&#039;&#039;&#039; Turns on the named Light.&lt;br /&gt;
* &#039;&#039;&#039;Move To Position:&#039;&#039;&#039; Moves the named Entity to the stated Position (coordinates: X Y Z).&lt;br /&gt;
** If the box &amp;quot;Relative to old origin&amp;quot; is ticked, the Entity is moved (X Y Z) units from its current location.&lt;br /&gt;
* &#039;&#039;&#039;Move To Random Position:&#039;&#039;&#039; Moves the named Entity to a random position inside the &amp;quot;Within Radius&amp;quot; range.&lt;br /&gt;
* &#039;&#039;&#039;Play Animation:&#039;&#039;&#039; Plays the stated Animation for the stated Entity.&lt;br /&gt;
** 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.&lt;br /&gt;
* &#039;&#039;&#039;Play Sound:&#039;&#039;&#039; Play the named entity&#039;s stated Sound.&lt;br /&gt;
** The channel can be limited (e.g. to the player voice or ambient), but this can also be left blank.&lt;br /&gt;
* &#039;&#039;&#039;Play Sound Shader:&#039;&#039;&#039; 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.&lt;br /&gt;
* &#039;&#039;&#039;Remove:&#039;&#039;&#039; Removes the named Target from the map.&lt;br /&gt;
* &#039;&#039;&#039;Run Script:&#039;&#039;&#039; Runs the named Script. For more information on scripts refer to [[Scripting basics]].&lt;br /&gt;
* &#039;&#039;&#039;Set AI Team:&#039;&#039;&#039; Change the named AI&#039;s team to the stated Team.&lt;br /&gt;
** For a list of which AI belongs to which team by default, refer to [[AI_Relations_(Editing)#AI_Types_.28Teams.29|AI Relations]]&lt;br /&gt;
* &#039;&#039;&#039;Set Angles:&#039;&#039;&#039; Set the named Target&#039;s rotation to the stated Angles (in pitch/yaw/roll).&lt;br /&gt;
** As with Move To Position, this is also possible relative to the entity&#039;s current angles.&lt;br /&gt;
* &#039;&#039;&#039;Set Frobable:&#039;&#039;&#039; Sets the named Entity as frobable (box checked) or unfrobable (box unchecked).&lt;br /&gt;
* &#039;&#039;&#039;Set Light Color:&#039;&#039;&#039; Changes the colour of the named Target Light to the stated Color.&lt;br /&gt;
** In contrast to &amp;quot;Fade to Color&amp;quot;, this happens without any transition.&lt;br /&gt;
* &#039;&#039;&#039;Set Model:&#039;&#039;&#039; Changes the current model of the named Target to the stated Model.&lt;br /&gt;
** E.g. Can be used to change a model to a broken model after recieving damage.&lt;br /&gt;
* &#039;&#039;&#039;Set Skin:&#039;&#039;&#039; Changes the current skin of the stated Target to the stated Skin.&lt;br /&gt;
* &#039;&#039;&#039;Set Spawnarg:&#039;&#039;&#039; Changes the value of a Key (Spawnarg) on the stated Target to a stated Value.&lt;br /&gt;
* &#039;&#039;&#039;Spawn Entity:&#039;&#039;&#039; 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.&lt;br /&gt;
* &#039;&#039;&#039;Spawn Particle:&#039;&#039;&#039; Creates an emitter that will emit the named [[Particles|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.&lt;br /&gt;
* &#039;&#039;&#039;Start Stim Timer:&#039;&#039;&#039; Starts the timer of the stated Stim on the named Entity.&lt;br /&gt;
** For information about how a timer on a Stim works, refer to [[Stim/Response Key/Values]], E.g. Key: sr_timer_time_N.&lt;br /&gt;
* &#039;&#039;&#039;Stop Stim Timer:&#039;&#039;&#039; Stops the timer of the stated Stim on the named Entity.&lt;br /&gt;
** For information about how a timer on a Stim works, refer to [[Stim/Response Key/Values]], E.g. Key: sr_timer_time_N.&lt;br /&gt;
* &#039;&#039;&#039;Teleport (Set Origin):&#039;&#039;&#039; Moves the named Entity to the stated location&#039;s New Origin (coordinates: X Y Z).&lt;br /&gt;
** If the box &amp;quot;Relative to old origin&amp;quot; is checked, the Entity is moved (X Y Z) units from its current location.&lt;br /&gt;
* &#039;&#039;&#039;Toggle Effect:&#039;&#039;&#039; Disables the stated Effect if enabled or enables the stated Effect if disabled on the named Entity.&lt;br /&gt;
** 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.&lt;br /&gt;
* &#039;&#039;&#039;Toggle Light:&#039;&#039;&#039; Turns off the named Light if on or turns on the named Light if off.&lt;br /&gt;
* &#039;&#039;&#039;Trigger:&#039;&#039;&#039; 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).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The Response list gives a variety of options that allows for many effects without the need to write scripts.&lt;br /&gt;
&lt;br /&gt;
It is possible to add several effects with one response type by checking the box, &amp;quot;Random Effects&amp;quot; and entering the number of random effects to be used.&lt;br /&gt;
Note that each effect can be used multiple times. E.g. Selecting only one effect and setting &amp;quot;Random Effects: 3&amp;quot; will use the same effect three times.&lt;br /&gt;
&lt;br /&gt;
= Examples =&lt;br /&gt;
&lt;br /&gt;
== Arrow Trap ==&lt;br /&gt;
&lt;br /&gt;
First, create an &amp;quot;atdm:func_shooter&amp;quot; entity and position it so that the arrow points in the desired direction to shoot.&lt;br /&gt;
&#039;&#039;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&#039;&#039;.&lt;br /&gt;
Define the projectile to be fired (the default is a fire arrow) and check the pitch for the projectile&#039;s trajectory.&lt;br /&gt;
&lt;br /&gt;
Next, it is necessary to create an activator, that can be achieved with the Stim/Response Editor as follows:&lt;br /&gt;
* Create a brush, giving it a NoDraw texture and convert it to a [[Glossary#func_static|func_static]].&lt;br /&gt;
* 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 [[Limits,_Max,_Min,_Stats,_etc#Conversion_of_game units|units]]).&lt;br /&gt;
* Open the Stim/Response Editor.&lt;br /&gt;
* Add a Response &amp;quot;Player&amp;quot; to the NoDraw func_static entity.&lt;br /&gt;
* To that Response, add the Effect &amp;quot;Activate Shooter&amp;quot; with the name of the shooter as &amp;quot;Shooter Entity&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Now the shooter will start firing as soon as the player comes within 100 units of the NoDraw func_static entity.&lt;br /&gt;
&lt;br /&gt;
There are three options:&lt;br /&gt;
&lt;br /&gt;
* If the the setup is left as it is, the shooter will continuously fire.&lt;br /&gt;
* 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.&lt;br /&gt;
* If the shooter is to fire only once, it is necessary to add the Effect, &amp;quot;Disable Effect&amp;quot; and target the first effect that activates the shooter or give an ammo value of 1.&lt;br /&gt;
&lt;br /&gt;
It may also possible for the player to disarm the trap:&lt;br /&gt;
&lt;br /&gt;
* Create a response on another entity that the player will use to do to disarm the trap.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;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.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* Add the same &amp;quot;Disable Effect&amp;quot; effect as before.&lt;br /&gt;
* It is also possible to use the Effect, &amp;quot;Remove shooter&amp;quot;. But if this is used, the shooter will not be reactivated (E.g. if the player re-arms the trap, as above).&lt;br /&gt;
&#039;&#039;Note that using this setup, where the Response is &amp;quot;Player&amp;quot;, the trap will exclusively react to the player and not to any AI.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Change Patrol ==&lt;br /&gt;
&lt;br /&gt;
An AI&#039;s behaviour, such as its [[AI_Patrol|patrol route]], may be altered through a response.&lt;br /&gt;
E.g. If the player has taken a specific loot item.&lt;br /&gt;
&lt;br /&gt;
* Give the loot item a Response &amp;quot;Frob&amp;quot;.&lt;br /&gt;
* Add the effect &amp;quot;Add Target&amp;quot;.&lt;br /&gt;
* As the &amp;quot;Entity&amp;quot; do not use the AI, but the path_corner from which the AI is to leave its original path to enter the new one.&lt;br /&gt;
* As &amp;quot;Target&amp;quot; put in the first path_corner of the new path.&lt;br /&gt;
&lt;br /&gt;
If the new path circles back to the original path, the path will fork at this point:&lt;br /&gt;
if the new path does not target any path_corner of the original path, the AI will remain patrolling the new path.&lt;/div&gt;</summary>
		<author><name>Springheel</name></author>
	</entry>
	<entry>
		<id>https://wiki.thedarkmod.com/index.php?title=Stim/Response_Editor&amp;diff=20544</id>
		<title>Stim/Response Editor</title>
		<link rel="alternate" type="text/html" href="https://wiki.thedarkmod.com/index.php?title=Stim/Response_Editor&amp;diff=20544"/>
		<updated>2018-08-15T15:38:52Z</updated>

		<summary type="html">&lt;p&gt;Springheel: /* Available effects */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Stim / Response Editor =&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
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 [[Glossary#Spawnarg|arg]] does. &lt;br /&gt;
&lt;br /&gt;
For more general reading on stims and responses, please see also the pages [[Stim/Response]] and [[Stim/Response Key/Values]].&lt;br /&gt;
&lt;br /&gt;
= Stims =&lt;br /&gt;
&lt;br /&gt;
To add a Stim or Response to an entity, open the Stim/Response editor:&lt;br /&gt;
Select the entity and - from the menu bar - go to Entity &amp;gt; Stim/Response.&lt;br /&gt;
The Stim/Response Editor has three tabs: Stims, Responses and Custom Stims.&lt;br /&gt;
As stated on the [[Stim/Response]] page, an entity can have either or both Stims and Responses, but is not able to create a Response through a Stim fired on itself.&lt;br /&gt;
&lt;br /&gt;
To add a non-custom Stim, select the &amp;quot;Stims&amp;quot; tab.&lt;br /&gt;
From here, it is possible to add a Stim from the drop-down menu next to the &amp;quot;Add&amp;quot; button, clicking the Add button and choosing a stim from the &amp;quot;Type&amp;quot; drop-down menu at the top (&amp;quot;Frob&amp;quot; being the default) or using a keyboard shortcut by pressing the initial letter of the Stim type you&#039;d like to add.&lt;br /&gt;
&lt;br /&gt;
Select the Stim to edit from the numbered list on the left.&lt;br /&gt;
If no Stim type is selected, all options presented on the right are greyed out.&lt;br /&gt;
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]].&lt;br /&gt;
&lt;br /&gt;
= Responses =&lt;br /&gt;
&lt;br /&gt;
The Response Editor is a simplified way to create basic scripts without need for deeper knowledge in scripting for TDM.&lt;br /&gt;
It works similar to the Stim Editor, but for adding Stims that will act as entity Responses.&lt;br /&gt;
In the Responses tab, the Stim to which the selected entity should respond is selected in the same way as the Stims tab.&lt;br /&gt;
&lt;br /&gt;
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.&amp;lt;br&amp;gt;&lt;br /&gt;
To add an effect, right-click in the &amp;quot;Response Effects&amp;quot; window and press, &amp;quot;Add new Effect&amp;quot;.&amp;lt;br&amp;gt;&lt;br /&gt;
Double-clicking the numbered Response (or right-clicking it and choosing &amp;quot;Edit&amp;quot;) will open the &amp;quot;Edit Response Effect&amp;quot; box, in which it is possible to select the target entity, type of Stim (as args) and the Response effect itself.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Available effects ==&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Activate Response:&#039;&#039;&#039; Activates the Response for the stated Stim Type on the stated Entity.&lt;br /&gt;
** E.g. the player must give a fire stim to a furnace in order to have a door react to a frob Stim.&lt;br /&gt;
* &#039;&#039;&#039;Activate Shooter:&#039;&#039;&#039; Activates the named Shooter entity.&lt;br /&gt;
** E.g. Can be used to activate a trap.&lt;br /&gt;
* &#039;&#039;&#039;Activate Stim:&#039;&#039;&#039; Activates the Stim for the stated Stim Type on the named Entity.&lt;br /&gt;
** E.g. Adds a damage stim to the furnace after a fire stim is given.&lt;br /&gt;
* &#039;&#039;&#039;Add Target: &#039;&#039;&#039; Adds the stated Target to the named Entity.&lt;br /&gt;
** E.g.  Add a new path_corner to a patrol route.&lt;br /&gt;
* &#039;&#039;&#039;Apply Stim:&#039;&#039;&#039; Fires a Stim of the stated Stim Type to the named Target.&lt;br /&gt;
** The Source can be changed, but is not necessary.&lt;br /&gt;
* &#039;&#039;&#039;Blind AI:&#039;&#039;&#039; Blinds the named AI as if a flash bomb has been used on it.&lt;br /&gt;
* &#039;&#039;&#039;Clear Targets:&#039;&#039;&#039; Removes all Target-args from the named Entity.&lt;br /&gt;
* &#039;&#039;&#039;Damage:&#039;&#039;&#039; Applies a damage type to the stated Target.  By default, both the player and AI have a response to Damage stims.&lt;br /&gt;
** Damage Defs can be found in the def file &amp;quot;darkmod/tdm_defs01.pk4/defs/tdm_damage.def&amp;quot;.&lt;br /&gt;
* &#039;&#039;&#039;Deactivate Response:&#039;&#039;&#039; Deactivates the Response for the stated Stim Type on the named Entity.&lt;br /&gt;
* &#039;&#039;&#039;Deactivate Shooter:&#039;&#039;&#039; Deactivates the stated Shooter.&lt;br /&gt;
** E.g. Can be used to disarm a trap.&lt;br /&gt;
* &#039;&#039;&#039;Deactivate Stim:&#039;&#039;&#039; Deactivates the Stim for the stated Stim Type on the named Entity.&lt;br /&gt;
* &#039;&#039;&#039;Disable Effect:&#039;&#039;&#039; Disables only one Effect on the named Entity.&lt;br /&gt;
** 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.&lt;br /&gt;
* &#039;&#039;&#039;Enable Effect:&#039;&#039;&#039; Enables only one Effect on the stated Entity.&lt;br /&gt;
** 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.&lt;br /&gt;
* &#039;&#039;&#039;Fade Light Color:&#039;&#039;&#039; Changes the colour of the named Target Light to the stated Color over a time of Fade Time seconds.&lt;br /&gt;
* &#039;&#039;&#039;Frob:&#039;&#039;&#039; Frobs the named Entity as if it had been frobbed by the player.&lt;br /&gt;
* &#039;&#039;&#039;Gas Knockout:&#039;&#039;&#039; Knocks out the named Target as if it had been hit with a gas arrow.&lt;br /&gt;
* &#039;&#039;&#039;Heal:&#039;&#039;&#039; Heals the named Target by the stated Amount.&lt;br /&gt;
* &#039;&#039;&#039;Kill:&#039;&#039;&#039; Kills the named Target.  AI don&#039;t have a default Response to this as standard. &lt;br /&gt;
* &#039;&#039;&#039;Knockout:&#039;&#039;&#039; Knocks out the named Target as if it had been hit with the blackjack.&lt;br /&gt;
* &#039;&#039;&#039;Turn extinguishable Light Off:&#039;&#039;&#039; Extinguishes the named extinguishable Light.&lt;br /&gt;
* &#039;&#039;&#039;Turn extinguishable Light On:&#039;&#039;&#039; (Re)ignites the named extinguishable Light.&lt;br /&gt;
* &#039;&#039;&#039;Turn Light Off:&#039;&#039;&#039; Turns off the named Light.&lt;br /&gt;
* &#039;&#039;&#039;Turn Light On:&#039;&#039;&#039; Turns on the named Light.&lt;br /&gt;
* &#039;&#039;&#039;Move To Position:&#039;&#039;&#039; Moves the named Entity to the stated Position (coordinates: X Y Z).&lt;br /&gt;
** If the box &amp;quot;Relative to old origin&amp;quot; is ticked, the Entity is moved (X Y Z) units from its current location.&lt;br /&gt;
* &#039;&#039;&#039;Move To Random Position:&#039;&#039;&#039; Moves the named Entity to a random position inside the &amp;quot;Within Radius&amp;quot; range.&lt;br /&gt;
* &#039;&#039;&#039;Play Animation:&#039;&#039;&#039; Plays the stated Animation for the stated Entity.&lt;br /&gt;
** 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.&lt;br /&gt;
* &#039;&#039;&#039;Play Sound:&#039;&#039;&#039; Play the named entity&#039;s stated Sound.&lt;br /&gt;
** The channel can be limited (e.g. to the player voice or ambient), but this can also be left blank.&lt;br /&gt;
* &#039;&#039;&#039;Play Sound Shader:&#039;&#039;&#039; 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.&lt;br /&gt;
* &#039;&#039;&#039;Remove:&#039;&#039;&#039; Removes the named Target from the map.&lt;br /&gt;
* &#039;&#039;&#039;Run Script:&#039;&#039;&#039; Runs the named Script. For more information on scripts refer to [[Scripting basics]].&lt;br /&gt;
* &#039;&#039;&#039;Set AI Team:&#039;&#039;&#039; Change the named AI&#039;s team to the stated Team.&lt;br /&gt;
** For a list of which AI belongs to which team by default, refer to [[AI_Relations_(Editing)#AI_Types_.28Teams.29|AI Relations]]&lt;br /&gt;
* &#039;&#039;&#039;Set Angles:&#039;&#039;&#039; Set the named Target&#039;s rotation to the stated Angles (in pitch/yaw/roll).&lt;br /&gt;
** As with Move To Position, this is also possible relative to the entity&#039;s current angles.&lt;br /&gt;
* &#039;&#039;&#039;Set Frobable:&#039;&#039;&#039; Sets the named Entity as frobable (box checked) or unfrobable (box unchecked).&lt;br /&gt;
* &#039;&#039;&#039;Set Light Color:&#039;&#039;&#039; Changes the colour of the named Target Light to the stated Color.&lt;br /&gt;
** In contrast to &amp;quot;Fade to Color&amp;quot;, this happens without any transition.&lt;br /&gt;
* &#039;&#039;&#039;Set Model:&#039;&#039;&#039; Changes the current model of the named Target to the stated Model.&lt;br /&gt;
** E.g. Can be used to change a model to a broken model after recieving damage.&lt;br /&gt;
* &#039;&#039;&#039;Set Skin:&#039;&#039;&#039; Changes the current skin of the stated Target to the stated Skin.&lt;br /&gt;
* &#039;&#039;&#039;Set Spawnarg:&#039;&#039;&#039; Changes the value of a Key (Spawnarg) on the stated Target to a stated Value.&lt;br /&gt;
* &#039;&#039;&#039;Spawn Entity:&#039;&#039;&#039; 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.&lt;br /&gt;
* &#039;&#039;&#039;Spawn Particle:&#039;&#039;&#039; Creates an emitter that will emit the named [[Particles|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.&lt;br /&gt;
* &#039;&#039;&#039;Start Stim Timer:&#039;&#039;&#039; Starts the timer of the stated Stim on the named Entity.&lt;br /&gt;
** For information about how a timer on a Stim works, refer to [[Stim/Response Key/Values]], E.g. Key: sr_timer_time_N.&lt;br /&gt;
* &#039;&#039;&#039;Stop Stim Timer:&#039;&#039;&#039; Stops the timer of the stated Stim on the named Entity.&lt;br /&gt;
** For information about how a timer on a Stim works, refer to [[Stim/Response Key/Values]], E.g. Key: sr_timer_time_N.&lt;br /&gt;
* &#039;&#039;&#039;Teleport (Set Origin):&#039;&#039;&#039; Moves the named Entity to the stated location&#039;s New Origin (coordinates: X Y Z).&lt;br /&gt;
** If the box &amp;quot;Relative to old origin&amp;quot; is checked, the Entity is moved (X Y Z) units from its current location.&lt;br /&gt;
* &#039;&#039;&#039;Toggle Effect:&#039;&#039;&#039; Disables the stated Effect if enabled or enables the stated Effect if disabled on the named Entity.&lt;br /&gt;
** 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.&lt;br /&gt;
* &#039;&#039;&#039;Toggle Light:&#039;&#039;&#039; Turns off the named Light if on or turns on the named Light if off.&lt;br /&gt;
* &#039;&#039;&#039;Trigger:&#039;&#039;&#039; 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).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The Response list gives a variety of options that allows for many effects without the need to write scripts.&lt;br /&gt;
&lt;br /&gt;
It is possible to add several effects with one response type by checking the box, &amp;quot;Random Effects&amp;quot; and entering the number of random effects to be used.&lt;br /&gt;
Note that each effect can be used multiple times. E.g. Selecting only one effect and setting &amp;quot;Random Effects: 3&amp;quot; will use the same effect three times.&lt;br /&gt;
&lt;br /&gt;
= Examples =&lt;br /&gt;
&lt;br /&gt;
== Arrow Trap ==&lt;br /&gt;
&lt;br /&gt;
First, create an &amp;quot;atdm:func_shooter&amp;quot; entity and position it so that the arrow points in the desired direction to shoot.&lt;br /&gt;
&#039;&#039;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&#039;&#039;.&lt;br /&gt;
Define the projectile to be fired (the default is a fire arrow) and check the pitch for the projectile&#039;s trajectory.&lt;br /&gt;
&lt;br /&gt;
Next, it is necessary to create an activator, that can be achieved with the Stim/Response Editor as follows:&lt;br /&gt;
* Create a brush, giving it a NoDraw texture and convert it to a [[Glossary#func_static|func_static]].&lt;br /&gt;
* 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 [[Limits,_Max,_Min,_Stats,_etc#Conversion_of_game units|units]]).&lt;br /&gt;
* Open the Stim/Response Editor.&lt;br /&gt;
* Add a Response &amp;quot;Player&amp;quot; to the NoDraw func_static entity.&lt;br /&gt;
* To that Response, add the Effect &amp;quot;Activate Shooter&amp;quot; with the name of the shooter as &amp;quot;Shooter Entity&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Now the shooter will start firing as soon as the player comes within 100 units of the NoDraw func_static entity.&lt;br /&gt;
&lt;br /&gt;
There are three options:&lt;br /&gt;
&lt;br /&gt;
* If the the setup is left as it is, the shooter will continuously fire.&lt;br /&gt;
* 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.&lt;br /&gt;
* If the shooter is to fire only once, it is necessary to add the Effect, &amp;quot;Disable Effect&amp;quot; and target the first effect that activates the shooter or give an ammo value of 1.&lt;br /&gt;
&lt;br /&gt;
It may also possible for the player to disarm the trap:&lt;br /&gt;
&lt;br /&gt;
* Create a response on another entity that the player will use to do to disarm the trap.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;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.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* Add the same &amp;quot;Disable Effect&amp;quot; effect as before.&lt;br /&gt;
* It is also possible to use the Effect, &amp;quot;Remove shooter&amp;quot;. But if this is used, the shooter will not be reactivated (E.g. if the player re-arms the trap, as above).&lt;br /&gt;
&#039;&#039;Note that using this setup, where the Response is &amp;quot;Player&amp;quot;, the trap will exclusively react to the player and not to any AI.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Change Patrol ==&lt;br /&gt;
&lt;br /&gt;
An AI&#039;s behaviour, such as its [[AI_Patrol|patrol route]], may be altered through a response.&lt;br /&gt;
E.g. If the player has taken a specific loot item.&lt;br /&gt;
&lt;br /&gt;
* Give the loot item a Response &amp;quot;Frob&amp;quot;.&lt;br /&gt;
* Add the effect &amp;quot;Add Target&amp;quot;.&lt;br /&gt;
* As the &amp;quot;Entity&amp;quot; do not use the AI, but the path_corner from which the AI is to leave its original path to enter the new one.&lt;br /&gt;
* As &amp;quot;Target&amp;quot; put in the first path_corner of the new path.&lt;br /&gt;
&lt;br /&gt;
If the new path circles back to the original path, the path will fork at this point:&lt;br /&gt;
if the new path does not target any path_corner of the original path, the AI will remain patrolling the new path.&lt;/div&gt;</summary>
		<author><name>Springheel</name></author>
	</entry>
	<entry>
		<id>https://wiki.thedarkmod.com/index.php?title=Stim/Response_Editor&amp;diff=20543</id>
		<title>Stim/Response Editor</title>
		<link rel="alternate" type="text/html" href="https://wiki.thedarkmod.com/index.php?title=Stim/Response_Editor&amp;diff=20543"/>
		<updated>2018-08-15T15:34:22Z</updated>

		<summary type="html">&lt;p&gt;Springheel: /* Available effects */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Stim / Response Editor =&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
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 [[Glossary#Spawnarg|arg]] does. &lt;br /&gt;
&lt;br /&gt;
For more general reading on stims and responses, please see also the pages [[Stim/Response]] and [[Stim/Response Key/Values]].&lt;br /&gt;
&lt;br /&gt;
= Stims =&lt;br /&gt;
&lt;br /&gt;
To add a Stim or Response to an entity, open the Stim/Response editor:&lt;br /&gt;
Select the entity and - from the menu bar - go to Entity &amp;gt; Stim/Response.&lt;br /&gt;
The Stim/Response Editor has three tabs: Stims, Responses and Custom Stims.&lt;br /&gt;
As stated on the [[Stim/Response]] page, an entity can have either or both Stims and Responses, but is not able to create a Response through a Stim fired on itself.&lt;br /&gt;
&lt;br /&gt;
To add a non-custom Stim, select the &amp;quot;Stims&amp;quot; tab.&lt;br /&gt;
From here, it is possible to add a Stim from the drop-down menu next to the &amp;quot;Add&amp;quot; button, clicking the Add button and choosing a stim from the &amp;quot;Type&amp;quot; drop-down menu at the top (&amp;quot;Frob&amp;quot; being the default) or using a keyboard shortcut by pressing the initial letter of the Stim type you&#039;d like to add.&lt;br /&gt;
&lt;br /&gt;
Select the Stim to edit from the numbered list on the left.&lt;br /&gt;
If no Stim type is selected, all options presented on the right are greyed out.&lt;br /&gt;
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]].&lt;br /&gt;
&lt;br /&gt;
= Responses =&lt;br /&gt;
&lt;br /&gt;
The Response Editor is a simplified way to create basic scripts without need for deeper knowledge in scripting for TDM.&lt;br /&gt;
It works similar to the Stim Editor, but for adding Stims that will act as entity Responses.&lt;br /&gt;
In the Responses tab, the Stim to which the selected entity should respond is selected in the same way as the Stims tab.&lt;br /&gt;
&lt;br /&gt;
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.&amp;lt;br&amp;gt;&lt;br /&gt;
To add an effect, right-click in the &amp;quot;Response Effects&amp;quot; window and press, &amp;quot;Add new Effect&amp;quot;.&amp;lt;br&amp;gt;&lt;br /&gt;
Double-clicking the numbered Response (or right-clicking it and choosing &amp;quot;Edit&amp;quot;) will open the &amp;quot;Edit Response Effect&amp;quot; box, in which it is possible to select the target entity, type of Stim (as args) and the Response effect itself.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Available effects ==&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Activate Response:&#039;&#039;&#039; Activates the Response for the stated Stim Type on the stated Entity.&lt;br /&gt;
** E.g. the player must give a fire stim to a furnace in order to have a door react to a frob Stim.&lt;br /&gt;
* &#039;&#039;&#039;Activate Shooter:&#039;&#039;&#039; Activates the named Shooter entity.&lt;br /&gt;
** E.g. Can be used to activate a trap.&lt;br /&gt;
* &#039;&#039;&#039;Activate Stim:&#039;&#039;&#039; Activates the Stim for the stated Stim Type on the named Entity.&lt;br /&gt;
** E.g. Adds a damage stim to the furnace after a fire stim is given.&lt;br /&gt;
* &#039;&#039;&#039;Add Target: &#039;&#039;&#039; Adds the stated Target to the named Entity.&lt;br /&gt;
** E.g.  Add a new path_corner to a patrol route.&lt;br /&gt;
* &#039;&#039;&#039;Apply Stim:&#039;&#039;&#039; Fires a Stim of the stated Stim Type to the named Target.&lt;br /&gt;
** The Source can be changed, but is not necessary.&lt;br /&gt;
* &#039;&#039;&#039;Blind AI:&#039;&#039;&#039; Blinds the named AI as if a flash bomb has been used on it.&lt;br /&gt;
* &#039;&#039;&#039;Clear Targets:&#039;&#039;&#039; Removes all Target-args from the named Entity.&lt;br /&gt;
* &#039;&#039;&#039;Damage:&#039;&#039;&#039; Applies a damage type to the stated Target.  By default, both the player and AI have a response to Damage stims.&lt;br /&gt;
** Damage Defs can be found in the def file &amp;quot;darkmod/tdm_defs01.pk4/defs/tdm_damage.def&amp;quot;.&lt;br /&gt;
* &#039;&#039;&#039;Deactivate Response:&#039;&#039;&#039; Deactivates the Response for the stated Stim Type on the named Entity.&lt;br /&gt;
* &#039;&#039;&#039;Deactivate Shooter:&#039;&#039;&#039; Deactivates the stated Shooter.&lt;br /&gt;
** E.g. Can be used to disarm a trap.&lt;br /&gt;
* &#039;&#039;&#039;Deactivate Stim:&#039;&#039;&#039; Deactivates the Stim for the stated Stim Type on the named Entity.&lt;br /&gt;
* &#039;&#039;&#039;Disable Effect:&#039;&#039;&#039; Disables only one Effect on the named Entity.&lt;br /&gt;
** 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.&lt;br /&gt;
* &#039;&#039;&#039;Enable Effect:&#039;&#039;&#039; Enables only one Effect on the stated Entity.&lt;br /&gt;
** 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.&lt;br /&gt;
* &#039;&#039;&#039;Fade Light Color:&#039;&#039;&#039; Changes the colour of the named Target Light to the stated Color over a time of Fade Time seconds.&lt;br /&gt;
* &#039;&#039;&#039;Frob:&#039;&#039;&#039; Frobs the named Entity as if it had been frobbed by the player.&lt;br /&gt;
* &#039;&#039;&#039;Gas Knockout:&#039;&#039;&#039; Knocks out the named Target as if it had been hit with a gas arrow.&lt;br /&gt;
* &#039;&#039;&#039;Heal:&#039;&#039;&#039; Heals the named Target by the stated Amount.&lt;br /&gt;
* &#039;&#039;&#039;Kill:&#039;&#039;&#039; Kills the named Target.&lt;br /&gt;
* &#039;&#039;&#039;Knockout:&#039;&#039;&#039; Knocks out the named Target as if it had been hit with the blackjack.&lt;br /&gt;
* &#039;&#039;&#039;Turn extinguishable Light Off:&#039;&#039;&#039; Extinguishes the named extinguishable Light.&lt;br /&gt;
* &#039;&#039;&#039;Turn extinguishable Light On:&#039;&#039;&#039; (Re)ignites the named extinguishable Light.&lt;br /&gt;
* &#039;&#039;&#039;Turn Light Off:&#039;&#039;&#039; Turns off the named Light.&lt;br /&gt;
* &#039;&#039;&#039;Turn Light On:&#039;&#039;&#039; Turns on the named Light.&lt;br /&gt;
* &#039;&#039;&#039;Move To Position:&#039;&#039;&#039; Moves the named Entity to the stated Position (coordinates: X Y Z).&lt;br /&gt;
** If the box &amp;quot;Relative to old origin&amp;quot; is ticked, the Entity is moved (X Y Z) units from its current location.&lt;br /&gt;
* &#039;&#039;&#039;Move To Random Position:&#039;&#039;&#039; Moves the named Entity to a random position inside the &amp;quot;Within Radius&amp;quot; range.&lt;br /&gt;
* &#039;&#039;&#039;Play Animation:&#039;&#039;&#039; Plays the stated Animation for the stated Entity.&lt;br /&gt;
** 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.&lt;br /&gt;
* &#039;&#039;&#039;Play Sound:&#039;&#039;&#039; Play the named entity&#039;s stated Sound.&lt;br /&gt;
** The channel can be limited (e.g. to the player voice or ambient), but this can also be left blank.&lt;br /&gt;
* &#039;&#039;&#039;Play Sound Shader:&#039;&#039;&#039; 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.&lt;br /&gt;
* &#039;&#039;&#039;Remove:&#039;&#039;&#039; Removes the named Target from the map.&lt;br /&gt;
* &#039;&#039;&#039;Run Script:&#039;&#039;&#039; Runs the named Script. For more information on scripts refer to [[Scripting basics]].&lt;br /&gt;
* &#039;&#039;&#039;Set AI Team:&#039;&#039;&#039; Change the named AI&#039;s team to the stated Team.&lt;br /&gt;
** For a list of which AI belongs to which team by default, refer to [[AI_Relations_(Editing)#AI_Types_.28Teams.29|AI Relations]]&lt;br /&gt;
* &#039;&#039;&#039;Set Angles:&#039;&#039;&#039; Set the named Target&#039;s rotation to the stated Angles (in pitch/yaw/roll).&lt;br /&gt;
** As with Move To Position, this is also possible relative to the entity&#039;s current angles.&lt;br /&gt;
* &#039;&#039;&#039;Set Frobable:&#039;&#039;&#039; Sets the named Entity as frobable (box checked) or unfrobable (box unchecked).&lt;br /&gt;
* &#039;&#039;&#039;Set Light Color:&#039;&#039;&#039; Changes the colour of the named Target Light to the stated Color.&lt;br /&gt;
** In contrast to &amp;quot;Fade to Color&amp;quot;, this happens without any transition.&lt;br /&gt;
* &#039;&#039;&#039;Set Model:&#039;&#039;&#039; Changes the current model of the named Target to the stated Model.&lt;br /&gt;
** E.g. Can be used to change a model to a broken model after recieving damage.&lt;br /&gt;
* &#039;&#039;&#039;Set Skin:&#039;&#039;&#039; Changes the current skin of the stated Target to the stated Skin.&lt;br /&gt;
* &#039;&#039;&#039;Set Spawnarg:&#039;&#039;&#039; Changes the value of a Key (Spawnarg) on the stated Target to a stated Value.&lt;br /&gt;
* &#039;&#039;&#039;Spawn Entity:&#039;&#039;&#039; 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.&lt;br /&gt;
* &#039;&#039;&#039;Spawn Particle:&#039;&#039;&#039; Creates an emitter that will emit the named [[Particles|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.&lt;br /&gt;
* &#039;&#039;&#039;Start Stim Timer:&#039;&#039;&#039; Starts the timer of the stated Stim on the named Entity.&lt;br /&gt;
** For information about how a timer on a Stim works, refer to [[Stim/Response Key/Values]], E.g. Key: sr_timer_time_N.&lt;br /&gt;
* &#039;&#039;&#039;Stop Stim Timer:&#039;&#039;&#039; Stops the timer of the stated Stim on the named Entity.&lt;br /&gt;
** For information about how a timer on a Stim works, refer to [[Stim/Response Key/Values]], E.g. Key: sr_timer_time_N.&lt;br /&gt;
* &#039;&#039;&#039;Teleport (Set Origin):&#039;&#039;&#039; Moves the named Entity to the stated location&#039;s New Origin (coordinates: X Y Z).&lt;br /&gt;
** If the box &amp;quot;Relative to old origin&amp;quot; is checked, the Entity is moved (X Y Z) units from its current location.&lt;br /&gt;
* &#039;&#039;&#039;Toggle Effect:&#039;&#039;&#039; Disables the stated Effect if enabled or enables the stated Effect if disabled on the named Entity.&lt;br /&gt;
** 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.&lt;br /&gt;
* &#039;&#039;&#039;Toggle Light:&#039;&#039;&#039; Turns off the named Light if on or turns on the named Light if off.&lt;br /&gt;
* &#039;&#039;&#039;Trigger:&#039;&#039;&#039; 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).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The Response list gives a variety of options that allows for many effects without the need to write scripts.&lt;br /&gt;
&lt;br /&gt;
It is possible to add several effects with one response type by checking the box, &amp;quot;Random Effects&amp;quot; and entering the number of random effects to be used.&lt;br /&gt;
Note that each effect can be used multiple times. E.g. Selecting only one effect and setting &amp;quot;Random Effects: 3&amp;quot; will use the same effect three times.&lt;br /&gt;
&lt;br /&gt;
= Examples =&lt;br /&gt;
&lt;br /&gt;
== Arrow Trap ==&lt;br /&gt;
&lt;br /&gt;
First, create an &amp;quot;atdm:func_shooter&amp;quot; entity and position it so that the arrow points in the desired direction to shoot.&lt;br /&gt;
&#039;&#039;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&#039;&#039;.&lt;br /&gt;
Define the projectile to be fired (the default is a fire arrow) and check the pitch for the projectile&#039;s trajectory.&lt;br /&gt;
&lt;br /&gt;
Next, it is necessary to create an activator, that can be achieved with the Stim/Response Editor as follows:&lt;br /&gt;
* Create a brush, giving it a NoDraw texture and convert it to a [[Glossary#func_static|func_static]].&lt;br /&gt;
* 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 [[Limits,_Max,_Min,_Stats,_etc#Conversion_of_game units|units]]).&lt;br /&gt;
* Open the Stim/Response Editor.&lt;br /&gt;
* Add a Response &amp;quot;Player&amp;quot; to the NoDraw func_static entity.&lt;br /&gt;
* To that Response, add the Effect &amp;quot;Activate Shooter&amp;quot; with the name of the shooter as &amp;quot;Shooter Entity&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Now the shooter will start firing as soon as the player comes within 100 units of the NoDraw func_static entity.&lt;br /&gt;
&lt;br /&gt;
There are three options:&lt;br /&gt;
&lt;br /&gt;
* If the the setup is left as it is, the shooter will continuously fire.&lt;br /&gt;
* 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.&lt;br /&gt;
* If the shooter is to fire only once, it is necessary to add the Effect, &amp;quot;Disable Effect&amp;quot; and target the first effect that activates the shooter or give an ammo value of 1.&lt;br /&gt;
&lt;br /&gt;
It may also possible for the player to disarm the trap:&lt;br /&gt;
&lt;br /&gt;
* Create a response on another entity that the player will use to do to disarm the trap.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;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.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* Add the same &amp;quot;Disable Effect&amp;quot; effect as before.&lt;br /&gt;
* It is also possible to use the Effect, &amp;quot;Remove shooter&amp;quot;. But if this is used, the shooter will not be reactivated (E.g. if the player re-arms the trap, as above).&lt;br /&gt;
&#039;&#039;Note that using this setup, where the Response is &amp;quot;Player&amp;quot;, the trap will exclusively react to the player and not to any AI.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Change Patrol ==&lt;br /&gt;
&lt;br /&gt;
An AI&#039;s behaviour, such as its [[AI_Patrol|patrol route]], may be altered through a response.&lt;br /&gt;
E.g. If the player has taken a specific loot item.&lt;br /&gt;
&lt;br /&gt;
* Give the loot item a Response &amp;quot;Frob&amp;quot;.&lt;br /&gt;
* Add the effect &amp;quot;Add Target&amp;quot;.&lt;br /&gt;
* As the &amp;quot;Entity&amp;quot; do not use the AI, but the path_corner from which the AI is to leave its original path to enter the new one.&lt;br /&gt;
* As &amp;quot;Target&amp;quot; put in the first path_corner of the new path.&lt;br /&gt;
&lt;br /&gt;
If the new path circles back to the original path, the path will fork at this point:&lt;br /&gt;
if the new path does not target any path_corner of the original path, the AI will remain patrolling the new path.&lt;/div&gt;</summary>
		<author><name>Springheel</name></author>
	</entry>
	<entry>
		<id>https://wiki.thedarkmod.com/index.php?title=Stim/Response_Key/Values&amp;diff=20542</id>
		<title>Stim/Response Key/Values</title>
		<link rel="alternate" type="text/html" href="https://wiki.thedarkmod.com/index.php?title=Stim/Response_Key/Values&amp;diff=20542"/>
		<updated>2018-08-15T15:33:19Z</updated>

		<summary type="html">&lt;p&gt;Springheel: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;Note:&#039;&#039;&#039; &#039;&#039;There is now a [[Stim/Response Editor]] accessed via the Dark Radiant entity menu which makes it easier to set these key/values. The editor settings will be shown below next to their equivalent key/values (work in progress.)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;There are some useful notes regarding STIMs here:  http://wiki.thedarkmod.com/index.php?title=User:VanishedOne&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I added two new key/vals to stim response, and figured I would document them all here including the new ones.&lt;br /&gt;
&lt;br /&gt;
In all of these, N is the number of the stim on the entity. It starts at 1 and goes up. Be aware of any stims that are defined on the entity in other places, like in the def file or in something inherited by it. Stims on the entity itself must start counting from the last one of these, so if the def file has 1 stim, the entitydef in the map would start at number 2.&lt;br /&gt;
&lt;br /&gt;
== Keys that can be used to set up both stims and responses ==&lt;br /&gt;
Key: &#039;&#039;&#039;sr_class_N&#039;&#039;&#039;&lt;br /&gt;
Set to &amp;quot;S&amp;quot; for stim, &amp;quot;R&amp;quot; for response.&lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_type_N&#039;&#039;&#039;&lt;br /&gt;
Type of stim (e.g. STIM_WATER). See /script/darkmod_stim_response.script for a complete list of stim types.&lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_state_N&#039;&#039;&#039;&lt;br /&gt;
Set to &amp;quot;1&amp;quot; for enabled, &amp;quot;0&amp;quot; for disabled. This may be altered later with scripting.&lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_chance_N&#039;&#039;&#039;&lt;br /&gt;
Probability for this stim/response to fire/react. Set this to 0.3 if you want to have a 30% chance.&lt;br /&gt;
&lt;br /&gt;
== Stim only ==&lt;br /&gt;
Key: &#039;&#039;&#039;sr_use_bounds_N&#039;&#039;&#039;&lt;br /&gt;
Set to &amp;quot;1&amp;quot; if you want to use the bounds of the entity as the basis for the intersection test. &amp;quot;0&amp;quot; (the default) uses a sphere centered on the entity origin.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Springheel:  I cannot confirm this. After a lot of tests, it seems that the game is measuring the distance from the origin of the stim to the bounds of the response.  It looks like the origin of the stim must be [radius + distance] =&amp;gt; 4 in order to avoid stimming the response.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Tests intersection between the physical models of entities A and B, where A carries the stim and B perhaps has a response set. Used for &#039;immersion&#039; in liquids. If A also has a radius set on the stim, the stim can be applied to B when the radius intersects with B&#039;s physical model. &lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_collision_N&#039;&#039;&#039;&lt;br /&gt;
Stim on entity A is applied to entity B when A and B collide.&lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_radius_N&#039;&#039;&#039;&lt;br /&gt;
Radius of the stim in doomunits. NOTE: If you set sr_use_bounds to &amp;quot;1&amp;quot;, the radius is applied as an expansion of the entity bounding box in all directions. So if you select use bounds and set the radius to &amp;quot;0&amp;quot;, this makes the stimmed region exactly equal to the stim bounds.&lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_radius_final_N&#039;&#039;&#039;&lt;br /&gt;
Final radius of the stim (i.e. the radius at the end of its lifetime). While the stim is active, the radius will linearly change within the [sr_radius..sr_radius_final] interval. The start value is defined by sr_radius, the end value by this spawnarg. Note that sr_radius_final is not necessarily larger than the sr_radius value, it&#039;s also possible to let a stim shrink. For this spawnarg to work, the &#039;&#039;&#039;sr_duration&#039;&#039;&#039; value must be greater than zero.&lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_magnitude_N&#039;&#039;&#039; (float)&lt;br /&gt;
The maximum magnitude of the stim at zero distance. If the responding entity&#039;s origin is exactly at the origin of the stimming entity (which is not always possible due to the collision boxes), this magnitude value is passed to the response effect scripts.&lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_falloffexponent_N&#039;&#039;&#039; (float)&lt;br /&gt;
The falloff exponent determining the magnitude in dependency of the distance. There is no limitation to this value, although only a few make sense.&lt;br /&gt;
&lt;br /&gt;
0 = no falloff (magnitude is constantly at maximum value over the whole radius)&lt;br /&gt;
&lt;br /&gt;
1 = linear falloff&lt;br /&gt;
&lt;br /&gt;
2 = quadratic falloff&lt;br /&gt;
&lt;br /&gt;
3 = etc.&lt;br /&gt;
&lt;br /&gt;
The higher the number, the faster the magnitude is decreasing with the distance. The magnitude is reaching zero as soon as the distance of the responding object is greater than or equal to the stim radius, except for falloffexponent = 0 (no falloff). Negative values are allowed as well, this way it should be possible to actually increase the magnitude of a stim with larger distance. Don&#039;t know if that makes sense, though and I haven&#039;t tested it either.&lt;br /&gt;
&lt;br /&gt;
For documentation purposes, this function is used to determine the actual magnitude: &#039;&#039;&#039;m(dist) = m0*[ 1 - dist/radius]^falloffExponent&#039;&#039;&#039; (math functions seem to be disabled for this wiki)&lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_duration_N&#039;&#039;&#039;&lt;br /&gt;
This specifies how long the stim is active before it gets disabled. If this is key is empty, the stim has infinite lifetime (apart from being disabled by scripts and such).  Changing this value to 2000 will mean the stim is active for 2 seconds (apparently from map start).&lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_time_interval_N&#039;&#039;&#039;&lt;br /&gt;
When this stim is active, the firings will be spread out by this many milliseconds. So a stim with sr_time_interval = 500 will fire every half second when active. Used for optimization for stims that don&#039;t have to be checked that often.&lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_max_fire_count_N&#039;&#039;&#039; (default: -1)&lt;br /&gt;
This specifies the maximum number of stim firings that are possible for this stim. The default is -1 which means that it can be fired infinitely often. With each firing, the counter is decreased. When it reaches zero, the stim is entirely ignored from then on. Currently there is no way to reactivate a stim whose max_fire_count has been depleted. Stims that fail because of their &#039;&#039;&#039;sr_chance_N&#039;&#039;&#039; spawnarg decrease the counter as well.&lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_timer_time_N&#039;&#039;&#039; (Format: hhhh:mm:ss:ms, for example: 0:3:20:0 which means 3 minutes and 20 secs) &#039;&#039;(s &amp;amp; r editor = Activation Timer.)&#039;&#039;&lt;br /&gt;
This can be used to enable the stim after a certain amount of time. Depending on the &#039;&#039;&#039;sr_timer_waitforstart&#039;&#039;&#039; key the timer is started on spawn or on a &amp;quot;StartTimer&amp;quot; event. Use this to setup a stim that has its &#039;&#039;&#039;sr_state_N&#039;&#039;&#039; set to 0 at start and gets enabled after a certain amount of time. This is only effective if the sr_state is 0 (disabled) by the time this timer is elapsing &#039;&#039;(s &amp;amp; r editor = Active checkbox.)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_timer_waitforstart_N&#039;&#039;&#039; (0 or 1, default is 0)&lt;br /&gt;
If this key is TRUE = &amp;quot;1&amp;quot;, the timer has to be started by a StartTimer script event or the according response effect. If this is set to 0, the timer starts on spawning this entity (beware: the entities might be spawned quite some time before the map is actually started, on my testmap it sometimes took up to 20 seconds before the player is spawned, so this is not a very reliable measure).&lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_timer_type_N&#039;&#039;&#039; | possible values: &amp;quot;RELOAD&amp;quot; or &amp;quot;SINGLESHOT&amp;quot; (default)&lt;br /&gt;
When this is set to RELOAD, the timer is reactivated after the stim has been fired. This can be used to setup sophisticated time intervals. I intend to draw a graph explaining this, so if this is not yet in the wiki, you can bug greebo to do this. :)&lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_bounds_mins_N&#039;&#039;&#039; and &#039;&#039;&#039;sr_bounds_maxs_N&#039;&#039;&#039; (Type: Vector, default is &amp;quot;0 0 0&amp;quot;)&lt;br /&gt;
These two vectors define the bounding box of the stim. This is measured relatively to the stim origin (which might be moving), not the entity origin. A vector pair of &#039;&#039;&#039;-10 -10 -50&#039;&#039;&#039; and &#039;&#039;&#039;10 10 150&#039;&#039;&#039; defines a primarily vertical stim area.&lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_velocity_N&#039;&#039;&#039; (type: Vector, default: &amp;quot;0 0 &amp;quot;)&lt;br /&gt;
This defines the velocity of the stim in units per second. A vector of &#039;&#039;&#039;0 0 -10&#039;&#039;&#039; let&#039;s the stim move downward for 10 units per second for the stim duration time.&lt;br /&gt;
&lt;br /&gt;
== Response only ==&lt;br /&gt;
Key: &#039;&#039;&#039;sr_chance_timeout_N&#039;&#039;&#039;&lt;br /&gt;
Many stims like the water arrow stim are firing rapidly multiple times a second, distorting the &amp;quot;effective&amp;quot; probability of a response going off. Use this to give the response a timeout before it can be evaluated again after a failed probability check.&lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_random_effects_N&#039;&#039;&#039;&lt;br /&gt;
If this spawnarg contains non-zero values, exactly this number of random response effects is chosen from the available ones. So, if you set sr_random_effects to 2 and there are 5 effects available, two are randomly chosen (may also be one of them twice). If only one effect is available, just this one is fired twice.&lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_script_&amp;lt;STIM TYPE&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
First off, the name of this key: &amp;lt;STIM TYPE&amp;gt; should be replaced with the string name of one of the stim types. For example, sr_script_STIM_WATER defines the script to call in respone to a water stim. Apparently there can only be one of these per stim type. &amp;lt;STIM TYPE&amp;gt; can either be the name as a string (in case of default stims) or the number:&lt;br /&gt;
sr_script_STIM_WATER&lt;br /&gt;
sr_script_2&lt;br /&gt;
Both of which will have the same meaning, assuming that the water stim has the number two.&lt;br /&gt;
&lt;br /&gt;
The value this key contains the name of the script function to call. If it&#039;s a local script, you must put it in the form of &amp;quot;&amp;lt;script object name&amp;gt;::&amp;lt;local function&amp;gt;&amp;quot; otherwise &amp;quot;&amp;lt;global function name&amp;gt;&amp;quot; works as well.&lt;br /&gt;
&lt;br /&gt;
Note:  When using the stim/response editor, you must right-click on the Response Effects field in order to enter an effect.  Not sure how anyone would know that.&lt;br /&gt;
&lt;br /&gt;
Also note, responses set on AI persist when the AI goes to ragdoll state.&lt;br /&gt;
&lt;br /&gt;
== Important note about writing response scripts ==&lt;br /&gt;
There&#039;s some subtlety about writing these response scriptfunctions. Global scriptfunctions must take two arguments: an entity argument and int threadnum argument. The first argument is the entity that was stimmed. Local response functions (those on the entity being stimmed) should not have the entity argument, only taking one argument, the threadnum. This is because the entity being stimmed is the same as the entity running the script, so the argument is passed implicitly as the &amp;quot;self&amp;quot; entity, just like the &amp;quot;this&amp;quot; pointer is passed implicitly in C++.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Examples ==&lt;br /&gt;
=== Damage Stim ===&lt;br /&gt;
&lt;br /&gt;
An entity has a STIM_DAMAGE with a magnitude of 100 and a linear falloff (1). The further you&#039;re away from the stim origin, the smaller the magnitude gets.&lt;br /&gt;
&lt;br /&gt;
Once an entity with a response to STIM_DAMAGE comes into range and the stim fires, the magnitude is passed on to the response entity. The response entity needs to have a response effect defined for the DAMAGE stim, which tells the code which damage entityDef (e.g. &#039;&#039;atdm:damage_simple&#039;&#039;) it should use and which entity should be damaged (this should be &#039;&#039;_SELF&#039;&#039; by default).&lt;br /&gt;
&lt;br /&gt;
So, an example response setup can be found on the player:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 // The damage response&lt;br /&gt;
 &amp;quot;sr_class_3&amp;quot; &amp;quot;R&amp;quot;&lt;br /&gt;
 &amp;quot;sr_type_3&amp;quot; &amp;quot;STIM_DAMAGE&amp;quot;&lt;br /&gt;
 &amp;quot;sr_state_3&amp;quot; &amp;quot;1&amp;quot;&lt;br /&gt;
 &amp;quot;sr_effect_3_1&amp;quot; &amp;quot;effect_damage&amp;quot;&lt;br /&gt;
 &amp;quot;sr_effect_3_1_arg1&amp;quot; &amp;quot;_SELF&amp;quot;&lt;br /&gt;
 &amp;quot;sr_effect_3_1_arg2&amp;quot; &amp;quot;atdm:damage_simple&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As soon as the player comes into the range of a damage stim, the distance-based magnitude is passed over and the code multiplies this magnitude with the &amp;quot;damage&amp;quot; value defined in atdm:damage_simple. E.g. if a magnitude of 30 is passed, the atdm:damage_simple&#039;s value of 10 ends up at 300 =&amp;gt; insta-death.&lt;br /&gt;
&lt;br /&gt;
If you want to have a constant magnitude which is not depending on the distance, you need to define a 0 falloff on the stim.&lt;br /&gt;
&lt;br /&gt;
=== Remove torch damage if extinguished with water ===&lt;br /&gt;
If you have hot torches/ovens that damage the player if too close, but shouldn&#039;t if extinguished, first copy the name of the entity that has the damage stim.  Then use the Stim/Response editor to add a Water Response, effect &amp;quot;Deactivate Stim&amp;quot;, pasting/selecting the entity with the damage stim, and &amp;quot;Damage&amp;quot;.  (One would want a Fire Response, &amp;quot;Activate Stim&amp;quot; if they wished damage to return if reignited.)&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
*[[Stim/Response]] overview&lt;br /&gt;
*[[Triggers]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Editing]]&lt;/div&gt;</summary>
		<author><name>Springheel</name></author>
	</entry>
	<entry>
		<id>https://wiki.thedarkmod.com/index.php?title=Triggers&amp;diff=20541</id>
		<title>Triggers</title>
		<link rel="alternate" type="text/html" href="https://wiki.thedarkmod.com/index.php?title=Triggers&amp;diff=20541"/>
		<updated>2018-08-13T14:04:46Z</updated>

		<summary type="html">&lt;p&gt;Springheel: /* trigger_sequencer */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;There are many different ways of triggering [[Entity|entities]], the Trigger entities themselves, as well as through [[Stim/Response]], [[Conversations]], Movers, [[Objectives]], and more.  How the trigger occurs will typically dictate which manner you choose for your map.  &lt;br /&gt;
&lt;br /&gt;
=Triggers=&lt;br /&gt;
To create triggers that rely on boundaries (once, multiple and their derivations), you need to drag out a worldspawn brush, right-click, select &amp;quot;Create Entity&amp;quot;.  (They will not function if abutted against others.)  Triggers need to be connected to their subjects, either via &amp;quot;Connect Selected Entities&amp;quot; menu option/shortcut key, or adding &amp;quot;Target&amp;quot;, &amp;quot;Target0&amp;quot;, &amp;quot;Target1&amp;quot; or subsequent &amp;quot;Target&amp;quot;# spawnargs.  Triggers without targets (to be added via a target_changetarget entity later) won&#039;t exist, so need a dummy target.  The triggers below are listed roughly by frequency of usage, with related triggers beneath.&lt;br /&gt;
&lt;br /&gt;
==trigger_once==&lt;br /&gt;
When the origin of an entity is within the bounds of this entity, the target(s) will be triggered, then the trigger_once is removed.  (Note, to resize the brush after creating the entity, select it then press Tab once.)&lt;br /&gt;
&lt;br /&gt;
==trigger_once_entityname==&lt;br /&gt;
Similar to [[Triggers#trigger_once|trigger_once]], but may be set to only respond to the entity specified by the spawnarg, &amp;quot;entityname&amp;quot;.  Note the entity must move into the boundaries itself, not be moved by the player (AI walking themselves for example).  (If you want something to happen based on the player dropping or placing an item somewhere, use the [[Objectives]] system instead.)&lt;br /&gt;
&lt;br /&gt;
==trigger_multiple==&lt;br /&gt;
Similar to [[Triggers#trigger_once|trigger_once]] but will activate again and again, use &amp;quot;Wait&amp;quot; spawnarg to control how many seconds between triggerings. &lt;br /&gt;
&lt;br /&gt;
==trigger_entityname ==&lt;br /&gt;
Similar to [[Triggers#trigger_multiple|trigger_multiple]] but only reacts to the entity defined by the &amp;quot;entityname&amp;quot; spawnarg.&lt;br /&gt;
&lt;br /&gt;
== trigger_facing ==&lt;br /&gt;
Also similar to [[Triggers#trigger_multiple|trigger_multiple]], but requires the triggering entity to be within 30° of the specified &amp;quot;angle&amp;quot; spawnarg. For details see [[Trigger Facing]].&lt;br /&gt;
&lt;br /&gt;
==trigger_relay ==&lt;br /&gt;
Most commonly used to trigger many targets, or do so after a delay (per the &amp;quot;delay&amp;quot; spawnarg).  May be set to only work once (spawnarg &amp;quot;wait&amp;quot; &amp;quot;-1&amp;quot;) or limit firing based upon how many seconds have passed.  The &amp;quot;random&amp;quot; spawnarg may be used with &amp;quot;wait&amp;quot; to vary the firings.  Very useful as the target of worldspawn, to trigger things at map start (since worldspawn currently only activate one &amp;quot;Target&amp;quot;), or as the target of Objectives.&lt;br /&gt;
&lt;br /&gt;
==trigger_count ==&lt;br /&gt;
This will fire at it&#039;s targets upon a specific number of times being triggered itself, based upon the &amp;quot;count&amp;quot; spawnarg.  If &amp;quot;count&amp;quot; &amp;quot;3&amp;quot; is set, it will do nothing until the third triggering.  Set &amp;quot;repeat&amp;quot; to &amp;quot;1&amp;quot; if it should do it again and again instead of just once.&lt;br /&gt;
&lt;br /&gt;
== trigger_timer ==&lt;br /&gt;
This trigger will fire repeatedly every &amp;quot;wait&amp;quot; # seconds.  The spawnarg &amp;quot;start_on&amp;quot; defines if it should do so at the start of the map, or wait to be triggered (defaults to 0, off at map start).  Spawnarg &amp;quot;random&amp;quot; adds variability to the triggerings.&lt;br /&gt;
&lt;br /&gt;
== trigger_fade ==&lt;br /&gt;
Will cause the display to fade or dissolve to a specified color.  The spawnarg &amp;quot;fadeColor&amp;quot; specifies which color, and how transparent in RGBA (red, green, blue, and alpha, ranging from 0-1).  Default is fade to black: &amp;quot;fadeColor&amp;quot; &amp;quot;0 0 0 1&amp;quot;.  To fade up from whatever, use alpha of 0, IE to fade up from black, &amp;quot;0 0 0 0&amp;quot;.  &amp;quot;fadeTime&amp;quot; controls how quickly the fade transpires.&lt;br /&gt;
&lt;br /&gt;
== trigger_hurt ==&lt;br /&gt;
Applied to a worldspawn brush to define boundaries à la a [[Triggers#trigger_multiple|trigger_multiple]], by default it causes 10 points of damage/second to the activator (player or AI).  It may be triggered on/off.  The spawnarg, &amp;quot;delay&amp;quot; may be set to vary frequency of damage application.  One of various &amp;quot;def_damage&amp;quot; may be specified, generally found in the root directory of the entities, or to see specific details, in the defs file, &amp;quot;damage.def&amp;quot;.  Note those referencing &amp;quot;triggerhurt&amp;quot; simply cause damage, while others feature additional effects such as push and knockbacks (launching the player away).&lt;br /&gt;
&lt;br /&gt;
If you need varying amount of damage based on proximity, the [[Stim/Response_Key/Values#Damage_Stim|Stim/Response]] system offers control of various types of falloff.&lt;br /&gt;
&lt;br /&gt;
trigger_hurt entities do not need a target.  They will damage the player or AI if either enters its bounds.  It apparently does not hurt AI if the trigger_hurt is moved into a stationary AI.&lt;br /&gt;
&lt;br /&gt;
trigger_hurt entities can be turned on/off by other triggers.&lt;br /&gt;
&lt;br /&gt;
== trigger_presize ==&lt;br /&gt;
Akin to [[Triggers#trigger_multiple|trigger_multiple]] without the need of creating a brush first, and defaults to not being touched by players/AIs, but triggered by other entities/script.&lt;br /&gt;
&lt;br /&gt;
== trigger_touch ==&lt;br /&gt;
Continuously checks if entities are touching, costly performance wise, probably done via [[Objectives]] more efficiently.&lt;br /&gt;
&lt;br /&gt;
== trigger_sequencer ==&lt;br /&gt;
trigger_sequencer triggers a successively different target each time it&#039;s triggered. Needs to be activated by another trigger.  Fires target 0 when first triggered, target 1 when next triggered, target 2 when next triggered etc.  Can repeat the sequence after triggering the last target if desired.&lt;br /&gt;
&lt;br /&gt;
== trigger_random ==&lt;br /&gt;
When triggered, triggers one of its targets randomly with evenly weighted probability.&lt;br /&gt;
&lt;br /&gt;
== trigger_inactivity ==&lt;br /&gt;
Once triggered, activates its targets if &amp;lt;delay&amp;gt; seconds pass in which it is NOT triggered again. You can use this for e.g. the kind of alarm system seen in Calendra&#039;s Cistern and one or two other Thief FMs, where a guard presses a button as part of his patrol route, and an alarm goes off if a certain length of time passes without the button being pressed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Triggering via Path Nodes=&lt;br /&gt;
Several [[Path Nodes|path nodes]] will trigger their targets upon AI completing the associated node action (as of TDM v2.02).  These include, path_corner (upon reaching), path_turn, path_wait, path_sit, path_sleep and path_anim.&lt;br /&gt;
&lt;br /&gt;
=Triggering Stim/Response=&lt;br /&gt;
&#039;&#039;&#039;To Trigger Something Else:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Any Response type may have an effect of &amp;quot;Trigger&amp;quot;, in which another entity selected is triggered.  Note the &amp;quot;Trigger&amp;quot; effect is all the way at the bottom of the drop down, which might not be displayed on screen (Toggle Effect is the last displayed on mine), you may cursor down or use the End key to get to Trigger.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Be Triggered:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Within the [[Stim/Response]] editor, add a response stim set to &amp;quot;Trigger&amp;quot;, now when this entity is targeted, whatever specified effect will occur.&lt;br /&gt;
&lt;br /&gt;
An example would be to not have something able to be frobbed until something obscuring it is removed or opened.  Make the response effect &amp;quot;Set Frobable&amp;quot; for the entity in question, and check &amp;quot;frobability&amp;quot; on.  Now when the item is triggered, by a door, or frob response on something in front moved/picked up, it will become frobable.&lt;br /&gt;
&lt;br /&gt;
=Triggering via Conversation=&lt;br /&gt;
The command, [[Conversations#Conversation Commands 2|ActivateTarget]] will trigger the specified entity at that time in the Conversation script.&lt;br /&gt;
&lt;br /&gt;
=Triggering via Doors, Buttons, Levers, Movers=&lt;br /&gt;
[[Doors]] trigger their targets by default upon opening (spawnarg &amp;quot;trigger_on_open&amp;quot; &amp;quot;1&amp;quot;).  They may also trigger when completely open by changing &amp;quot;trigger_when_opened&amp;quot; to 1 instead of the default 0, or when fully closed via &amp;quot;trigger_on_close&amp;quot;.  Note, those conditions on Buttons came from doors, so are counter-intuitive.&lt;br /&gt;
&lt;br /&gt;
=Triggering via Objectives=&lt;br /&gt;
In the [[Objectives Editor]] you may select an entity to be triggered upon an objective succeeding or failing.  Therefore all the possible objective conditions may become trigger events (knock out an AI, move an object away from another or to a spot, cause another objective to become visible, disappear or complete, etc.)&lt;br /&gt;
&lt;br /&gt;
=Triggering via Worldspawn=&lt;br /&gt;
You may set &amp;quot;Target&amp;quot; on Worldspawn (usually at a trigger_relay since it only may target one entity currently) to cause things to be triggered at map start.  If you use this to kill an AI or other affect with audio, note if in range of the player&#039;s start, it will be heard during the fade up from black.&lt;br /&gt;
&lt;br /&gt;
=Triggering via Lights=&lt;br /&gt;
Lights trigger their target(s) both upon being extinguished and lit.  This is useful to match window glow to actual light condition.  Depending on the light, it may be tricky to set the targets however.  A basic light entity can simply have target(s) spawnargs, but a candle, lamp or torch with attached flame entity, you need to use the &amp;quot;set&amp;quot; spawnarg.  For example, &amp;quot;set target0 on flame&amp;quot; &amp;quot;EntityToBeTriggered&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
=Trigger a Script=&lt;br /&gt;
Point any trigger at a target_callscriptfunction entity and give it the spawnarg, &amp;quot;call&amp;quot; &#039;&#039;ScriptFunctionName&#039;&#039;, where &#039;&#039;ScriptFunctionName&#039;&#039; matches &amp;quot;void &#039;&#039;ScriptFunctionName&#039;&#039;()&amp;quot; in the map&#039;s .script file.  See [[Scripting_basics#Script_invocation|script invocation]] for more info.&lt;br /&gt;
&lt;br /&gt;
[[Category:Editing]]&lt;/div&gt;</summary>
		<author><name>Springheel</name></author>
	</entry>
	<entry>
		<id>https://wiki.thedarkmod.com/index.php?title=Triggers&amp;diff=20540</id>
		<title>Triggers</title>
		<link rel="alternate" type="text/html" href="https://wiki.thedarkmod.com/index.php?title=Triggers&amp;diff=20540"/>
		<updated>2018-08-13T14:03:11Z</updated>

		<summary type="html">&lt;p&gt;Springheel: /* trigger_sequencer */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;There are many different ways of triggering [[Entity|entities]], the Trigger entities themselves, as well as through [[Stim/Response]], [[Conversations]], Movers, [[Objectives]], and more.  How the trigger occurs will typically dictate which manner you choose for your map.  &lt;br /&gt;
&lt;br /&gt;
=Triggers=&lt;br /&gt;
To create triggers that rely on boundaries (once, multiple and their derivations), you need to drag out a worldspawn brush, right-click, select &amp;quot;Create Entity&amp;quot;.  (They will not function if abutted against others.)  Triggers need to be connected to their subjects, either via &amp;quot;Connect Selected Entities&amp;quot; menu option/shortcut key, or adding &amp;quot;Target&amp;quot;, &amp;quot;Target0&amp;quot;, &amp;quot;Target1&amp;quot; or subsequent &amp;quot;Target&amp;quot;# spawnargs.  Triggers without targets (to be added via a target_changetarget entity later) won&#039;t exist, so need a dummy target.  The triggers below are listed roughly by frequency of usage, with related triggers beneath.&lt;br /&gt;
&lt;br /&gt;
==trigger_once==&lt;br /&gt;
When the origin of an entity is within the bounds of this entity, the target(s) will be triggered, then the trigger_once is removed.  (Note, to resize the brush after creating the entity, select it then press Tab once.)&lt;br /&gt;
&lt;br /&gt;
==trigger_once_entityname==&lt;br /&gt;
Similar to [[Triggers#trigger_once|trigger_once]], but may be set to only respond to the entity specified by the spawnarg, &amp;quot;entityname&amp;quot;.  Note the entity must move into the boundaries itself, not be moved by the player (AI walking themselves for example).  (If you want something to happen based on the player dropping or placing an item somewhere, use the [[Objectives]] system instead.)&lt;br /&gt;
&lt;br /&gt;
==trigger_multiple==&lt;br /&gt;
Similar to [[Triggers#trigger_once|trigger_once]] but will activate again and again, use &amp;quot;Wait&amp;quot; spawnarg to control how many seconds between triggerings. &lt;br /&gt;
&lt;br /&gt;
==trigger_entityname ==&lt;br /&gt;
Similar to [[Triggers#trigger_multiple|trigger_multiple]] but only reacts to the entity defined by the &amp;quot;entityname&amp;quot; spawnarg.&lt;br /&gt;
&lt;br /&gt;
== trigger_facing ==&lt;br /&gt;
Also similar to [[Triggers#trigger_multiple|trigger_multiple]], but requires the triggering entity to be within 30° of the specified &amp;quot;angle&amp;quot; spawnarg. For details see [[Trigger Facing]].&lt;br /&gt;
&lt;br /&gt;
==trigger_relay ==&lt;br /&gt;
Most commonly used to trigger many targets, or do so after a delay (per the &amp;quot;delay&amp;quot; spawnarg).  May be set to only work once (spawnarg &amp;quot;wait&amp;quot; &amp;quot;-1&amp;quot;) or limit firing based upon how many seconds have passed.  The &amp;quot;random&amp;quot; spawnarg may be used with &amp;quot;wait&amp;quot; to vary the firings.  Very useful as the target of worldspawn, to trigger things at map start (since worldspawn currently only activate one &amp;quot;Target&amp;quot;), or as the target of Objectives.&lt;br /&gt;
&lt;br /&gt;
==trigger_count ==&lt;br /&gt;
This will fire at it&#039;s targets upon a specific number of times being triggered itself, based upon the &amp;quot;count&amp;quot; spawnarg.  If &amp;quot;count&amp;quot; &amp;quot;3&amp;quot; is set, it will do nothing until the third triggering.  Set &amp;quot;repeat&amp;quot; to &amp;quot;1&amp;quot; if it should do it again and again instead of just once.&lt;br /&gt;
&lt;br /&gt;
== trigger_timer ==&lt;br /&gt;
This trigger will fire repeatedly every &amp;quot;wait&amp;quot; # seconds.  The spawnarg &amp;quot;start_on&amp;quot; defines if it should do so at the start of the map, or wait to be triggered (defaults to 0, off at map start).  Spawnarg &amp;quot;random&amp;quot; adds variability to the triggerings.&lt;br /&gt;
&lt;br /&gt;
== trigger_fade ==&lt;br /&gt;
Will cause the display to fade or dissolve to a specified color.  The spawnarg &amp;quot;fadeColor&amp;quot; specifies which color, and how transparent in RGBA (red, green, blue, and alpha, ranging from 0-1).  Default is fade to black: &amp;quot;fadeColor&amp;quot; &amp;quot;0 0 0 1&amp;quot;.  To fade up from whatever, use alpha of 0, IE to fade up from black, &amp;quot;0 0 0 0&amp;quot;.  &amp;quot;fadeTime&amp;quot; controls how quickly the fade transpires.&lt;br /&gt;
&lt;br /&gt;
== trigger_hurt ==&lt;br /&gt;
Applied to a worldspawn brush to define boundaries à la a [[Triggers#trigger_multiple|trigger_multiple]], by default it causes 10 points of damage/second to the activator (player or AI).  It may be triggered on/off.  The spawnarg, &amp;quot;delay&amp;quot; may be set to vary frequency of damage application.  One of various &amp;quot;def_damage&amp;quot; may be specified, generally found in the root directory of the entities, or to see specific details, in the defs file, &amp;quot;damage.def&amp;quot;.  Note those referencing &amp;quot;triggerhurt&amp;quot; simply cause damage, while others feature additional effects such as push and knockbacks (launching the player away).&lt;br /&gt;
&lt;br /&gt;
If you need varying amount of damage based on proximity, the [[Stim/Response_Key/Values#Damage_Stim|Stim/Response]] system offers control of various types of falloff.&lt;br /&gt;
&lt;br /&gt;
trigger_hurt entities do not need a target.  They will damage the player or AI if either enters its bounds.  It apparently does not hurt AI if the trigger_hurt is moved into a stationary AI.&lt;br /&gt;
&lt;br /&gt;
trigger_hurt entities can be turned on/off by other triggers.&lt;br /&gt;
&lt;br /&gt;
== trigger_presize ==&lt;br /&gt;
Akin to [[Triggers#trigger_multiple|trigger_multiple]] without the need of creating a brush first, and defaults to not being touched by players/AIs, but triggered by other entities/script.&lt;br /&gt;
&lt;br /&gt;
== trigger_touch ==&lt;br /&gt;
Continuously checks if entities are touching, costly performance wise, probably done via [[Objectives]] more efficiently.&lt;br /&gt;
&lt;br /&gt;
== trigger_sequencer ==&lt;br /&gt;
Needs to be activated by another trigger.  Fires target 0 when first triggered, target 1 when next triggered, target 2 when next triggered etc.  Can repeat the sequence after triggering the last target if desired.&lt;br /&gt;
&lt;br /&gt;
== trigger_random ==&lt;br /&gt;
When triggered, triggers one of its targets randomly with evenly weighted probability.&lt;br /&gt;
&lt;br /&gt;
== trigger_inactivity ==&lt;br /&gt;
Once triggered, activates its targets if &amp;lt;delay&amp;gt; seconds pass in which it is NOT triggered again. You can use this for e.g. the kind of alarm system seen in Calendra&#039;s Cistern and one or two other Thief FMs, where a guard presses a button as part of his patrol route, and an alarm goes off if a certain length of time passes without the button being pressed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Triggering via Path Nodes=&lt;br /&gt;
Several [[Path Nodes|path nodes]] will trigger their targets upon AI completing the associated node action (as of TDM v2.02).  These include, path_corner (upon reaching), path_turn, path_wait, path_sit, path_sleep and path_anim.&lt;br /&gt;
&lt;br /&gt;
=Triggering Stim/Response=&lt;br /&gt;
&#039;&#039;&#039;To Trigger Something Else:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Any Response type may have an effect of &amp;quot;Trigger&amp;quot;, in which another entity selected is triggered.  Note the &amp;quot;Trigger&amp;quot; effect is all the way at the bottom of the drop down, which might not be displayed on screen (Toggle Effect is the last displayed on mine), you may cursor down or use the End key to get to Trigger.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Be Triggered:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Within the [[Stim/Response]] editor, add a response stim set to &amp;quot;Trigger&amp;quot;, now when this entity is targeted, whatever specified effect will occur.&lt;br /&gt;
&lt;br /&gt;
An example would be to not have something able to be frobbed until something obscuring it is removed or opened.  Make the response effect &amp;quot;Set Frobable&amp;quot; for the entity in question, and check &amp;quot;frobability&amp;quot; on.  Now when the item is triggered, by a door, or frob response on something in front moved/picked up, it will become frobable.&lt;br /&gt;
&lt;br /&gt;
=Triggering via Conversation=&lt;br /&gt;
The command, [[Conversations#Conversation Commands 2|ActivateTarget]] will trigger the specified entity at that time in the Conversation script.&lt;br /&gt;
&lt;br /&gt;
=Triggering via Doors, Buttons, Levers, Movers=&lt;br /&gt;
[[Doors]] trigger their targets by default upon opening (spawnarg &amp;quot;trigger_on_open&amp;quot; &amp;quot;1&amp;quot;).  They may also trigger when completely open by changing &amp;quot;trigger_when_opened&amp;quot; to 1 instead of the default 0, or when fully closed via &amp;quot;trigger_on_close&amp;quot;.  Note, those conditions on Buttons came from doors, so are counter-intuitive.&lt;br /&gt;
&lt;br /&gt;
=Triggering via Objectives=&lt;br /&gt;
In the [[Objectives Editor]] you may select an entity to be triggered upon an objective succeeding or failing.  Therefore all the possible objective conditions may become trigger events (knock out an AI, move an object away from another or to a spot, cause another objective to become visible, disappear or complete, etc.)&lt;br /&gt;
&lt;br /&gt;
=Triggering via Worldspawn=&lt;br /&gt;
You may set &amp;quot;Target&amp;quot; on Worldspawn (usually at a trigger_relay since it only may target one entity currently) to cause things to be triggered at map start.  If you use this to kill an AI or other affect with audio, note if in range of the player&#039;s start, it will be heard during the fade up from black.&lt;br /&gt;
&lt;br /&gt;
=Triggering via Lights=&lt;br /&gt;
Lights trigger their target(s) both upon being extinguished and lit.  This is useful to match window glow to actual light condition.  Depending on the light, it may be tricky to set the targets however.  A basic light entity can simply have target(s) spawnargs, but a candle, lamp or torch with attached flame entity, you need to use the &amp;quot;set&amp;quot; spawnarg.  For example, &amp;quot;set target0 on flame&amp;quot; &amp;quot;EntityToBeTriggered&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
=Trigger a Script=&lt;br /&gt;
Point any trigger at a target_callscriptfunction entity and give it the spawnarg, &amp;quot;call&amp;quot; &#039;&#039;ScriptFunctionName&#039;&#039;, where &#039;&#039;ScriptFunctionName&#039;&#039; matches &amp;quot;void &#039;&#039;ScriptFunctionName&#039;&#039;()&amp;quot; in the map&#039;s .script file.  See [[Scripting_basics#Script_invocation|script invocation]] for more info.&lt;br /&gt;
&lt;br /&gt;
[[Category:Editing]]&lt;/div&gt;</summary>
		<author><name>Springheel</name></author>
	</entry>
	<entry>
		<id>https://wiki.thedarkmod.com/index.php?title=Triggers&amp;diff=20539</id>
		<title>Triggers</title>
		<link rel="alternate" type="text/html" href="https://wiki.thedarkmod.com/index.php?title=Triggers&amp;diff=20539"/>
		<updated>2018-08-13T13:57:07Z</updated>

		<summary type="html">&lt;p&gt;Springheel: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;There are many different ways of triggering [[Entity|entities]], the Trigger entities themselves, as well as through [[Stim/Response]], [[Conversations]], Movers, [[Objectives]], and more.  How the trigger occurs will typically dictate which manner you choose for your map.  &lt;br /&gt;
&lt;br /&gt;
=Triggers=&lt;br /&gt;
To create triggers that rely on boundaries (once, multiple and their derivations), you need to drag out a worldspawn brush, right-click, select &amp;quot;Create Entity&amp;quot;.  (They will not function if abutted against others.)  Triggers need to be connected to their subjects, either via &amp;quot;Connect Selected Entities&amp;quot; menu option/shortcut key, or adding &amp;quot;Target&amp;quot;, &amp;quot;Target0&amp;quot;, &amp;quot;Target1&amp;quot; or subsequent &amp;quot;Target&amp;quot;# spawnargs.  Triggers without targets (to be added via a target_changetarget entity later) won&#039;t exist, so need a dummy target.  The triggers below are listed roughly by frequency of usage, with related triggers beneath.&lt;br /&gt;
&lt;br /&gt;
==trigger_once==&lt;br /&gt;
When the origin of an entity is within the bounds of this entity, the target(s) will be triggered, then the trigger_once is removed.  (Note, to resize the brush after creating the entity, select it then press Tab once.)&lt;br /&gt;
&lt;br /&gt;
==trigger_once_entityname==&lt;br /&gt;
Similar to [[Triggers#trigger_once|trigger_once]], but may be set to only respond to the entity specified by the spawnarg, &amp;quot;entityname&amp;quot;.  Note the entity must move into the boundaries itself, not be moved by the player (AI walking themselves for example).  (If you want something to happen based on the player dropping or placing an item somewhere, use the [[Objectives]] system instead.)&lt;br /&gt;
&lt;br /&gt;
==trigger_multiple==&lt;br /&gt;
Similar to [[Triggers#trigger_once|trigger_once]] but will activate again and again, use &amp;quot;Wait&amp;quot; spawnarg to control how many seconds between triggerings. &lt;br /&gt;
&lt;br /&gt;
==trigger_entityname ==&lt;br /&gt;
Similar to [[Triggers#trigger_multiple|trigger_multiple]] but only reacts to the entity defined by the &amp;quot;entityname&amp;quot; spawnarg.&lt;br /&gt;
&lt;br /&gt;
== trigger_facing ==&lt;br /&gt;
Also similar to [[Triggers#trigger_multiple|trigger_multiple]], but requires the triggering entity to be within 30° of the specified &amp;quot;angle&amp;quot; spawnarg. For details see [[Trigger Facing]].&lt;br /&gt;
&lt;br /&gt;
==trigger_relay ==&lt;br /&gt;
Most commonly used to trigger many targets, or do so after a delay (per the &amp;quot;delay&amp;quot; spawnarg).  May be set to only work once (spawnarg &amp;quot;wait&amp;quot; &amp;quot;-1&amp;quot;) or limit firing based upon how many seconds have passed.  The &amp;quot;random&amp;quot; spawnarg may be used with &amp;quot;wait&amp;quot; to vary the firings.  Very useful as the target of worldspawn, to trigger things at map start (since worldspawn currently only activate one &amp;quot;Target&amp;quot;), or as the target of Objectives.&lt;br /&gt;
&lt;br /&gt;
==trigger_count ==&lt;br /&gt;
This will fire at it&#039;s targets upon a specific number of times being triggered itself, based upon the &amp;quot;count&amp;quot; spawnarg.  If &amp;quot;count&amp;quot; &amp;quot;3&amp;quot; is set, it will do nothing until the third triggering.  Set &amp;quot;repeat&amp;quot; to &amp;quot;1&amp;quot; if it should do it again and again instead of just once.&lt;br /&gt;
&lt;br /&gt;
== trigger_timer ==&lt;br /&gt;
This trigger will fire repeatedly every &amp;quot;wait&amp;quot; # seconds.  The spawnarg &amp;quot;start_on&amp;quot; defines if it should do so at the start of the map, or wait to be triggered (defaults to 0, off at map start).  Spawnarg &amp;quot;random&amp;quot; adds variability to the triggerings.&lt;br /&gt;
&lt;br /&gt;
== trigger_fade ==&lt;br /&gt;
Will cause the display to fade or dissolve to a specified color.  The spawnarg &amp;quot;fadeColor&amp;quot; specifies which color, and how transparent in RGBA (red, green, blue, and alpha, ranging from 0-1).  Default is fade to black: &amp;quot;fadeColor&amp;quot; &amp;quot;0 0 0 1&amp;quot;.  To fade up from whatever, use alpha of 0, IE to fade up from black, &amp;quot;0 0 0 0&amp;quot;.  &amp;quot;fadeTime&amp;quot; controls how quickly the fade transpires.&lt;br /&gt;
&lt;br /&gt;
== trigger_hurt ==&lt;br /&gt;
Applied to a worldspawn brush to define boundaries à la a [[Triggers#trigger_multiple|trigger_multiple]], by default it causes 10 points of damage/second to the activator (player or AI).  It may be triggered on/off.  The spawnarg, &amp;quot;delay&amp;quot; may be set to vary frequency of damage application.  One of various &amp;quot;def_damage&amp;quot; may be specified, generally found in the root directory of the entities, or to see specific details, in the defs file, &amp;quot;damage.def&amp;quot;.  Note those referencing &amp;quot;triggerhurt&amp;quot; simply cause damage, while others feature additional effects such as push and knockbacks (launching the player away).&lt;br /&gt;
&lt;br /&gt;
If you need varying amount of damage based on proximity, the [[Stim/Response_Key/Values#Damage_Stim|Stim/Response]] system offers control of various types of falloff.&lt;br /&gt;
&lt;br /&gt;
trigger_hurt entities do not need a target.  They will damage the player or AI if either enters its bounds.  It apparently does not hurt AI if the trigger_hurt is moved into a stationary AI.&lt;br /&gt;
&lt;br /&gt;
trigger_hurt entities can be turned on/off by other triggers.&lt;br /&gt;
&lt;br /&gt;
== trigger_presize ==&lt;br /&gt;
Akin to [[Triggers#trigger_multiple|trigger_multiple]] without the need of creating a brush first, and defaults to not being touched by players/AIs, but triggered by other entities/script.&lt;br /&gt;
&lt;br /&gt;
== trigger_touch ==&lt;br /&gt;
Continuously checks if entities are touching, costly performance wise, probably done via [[Objectives]] more efficiently.&lt;br /&gt;
&lt;br /&gt;
== trigger_sequencer ==&lt;br /&gt;
Needs to be activated by another trigger.  Fires target 0 when first triggered, target 1 when next triggered, etc.  Can repeat the sequence after triggering the last target if desired.&lt;br /&gt;
&lt;br /&gt;
== trigger_random ==&lt;br /&gt;
When triggered, triggers one of its targets randomly with evenly weighted probability.&lt;br /&gt;
&lt;br /&gt;
== trigger_inactivity ==&lt;br /&gt;
Once triggered, activates its targets if &amp;lt;delay&amp;gt; seconds pass in which it is NOT triggered again. You can use this for e.g. the kind of alarm system seen in Calendra&#039;s Cistern and one or two other Thief FMs, where a guard presses a button as part of his patrol route, and an alarm goes off if a certain length of time passes without the button being pressed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Triggering via Path Nodes=&lt;br /&gt;
Several [[Path Nodes|path nodes]] will trigger their targets upon AI completing the associated node action (as of TDM v2.02).  These include, path_corner (upon reaching), path_turn, path_wait, path_sit, path_sleep and path_anim.&lt;br /&gt;
&lt;br /&gt;
=Triggering Stim/Response=&lt;br /&gt;
&#039;&#039;&#039;To Trigger Something Else:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Any Response type may have an effect of &amp;quot;Trigger&amp;quot;, in which another entity selected is triggered.  Note the &amp;quot;Trigger&amp;quot; effect is all the way at the bottom of the drop down, which might not be displayed on screen (Toggle Effect is the last displayed on mine), you may cursor down or use the End key to get to Trigger.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Be Triggered:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Within the [[Stim/Response]] editor, add a response stim set to &amp;quot;Trigger&amp;quot;, now when this entity is targeted, whatever specified effect will occur.&lt;br /&gt;
&lt;br /&gt;
An example would be to not have something able to be frobbed until something obscuring it is removed or opened.  Make the response effect &amp;quot;Set Frobable&amp;quot; for the entity in question, and check &amp;quot;frobability&amp;quot; on.  Now when the item is triggered, by a door, or frob response on something in front moved/picked up, it will become frobable.&lt;br /&gt;
&lt;br /&gt;
=Triggering via Conversation=&lt;br /&gt;
The command, [[Conversations#Conversation Commands 2|ActivateTarget]] will trigger the specified entity at that time in the Conversation script.&lt;br /&gt;
&lt;br /&gt;
=Triggering via Doors, Buttons, Levers, Movers=&lt;br /&gt;
[[Doors]] trigger their targets by default upon opening (spawnarg &amp;quot;trigger_on_open&amp;quot; &amp;quot;1&amp;quot;).  They may also trigger when completely open by changing &amp;quot;trigger_when_opened&amp;quot; to 1 instead of the default 0, or when fully closed via &amp;quot;trigger_on_close&amp;quot;.  Note, those conditions on Buttons came from doors, so are counter-intuitive.&lt;br /&gt;
&lt;br /&gt;
=Triggering via Objectives=&lt;br /&gt;
In the [[Objectives Editor]] you may select an entity to be triggered upon an objective succeeding or failing.  Therefore all the possible objective conditions may become trigger events (knock out an AI, move an object away from another or to a spot, cause another objective to become visible, disappear or complete, etc.)&lt;br /&gt;
&lt;br /&gt;
=Triggering via Worldspawn=&lt;br /&gt;
You may set &amp;quot;Target&amp;quot; on Worldspawn (usually at a trigger_relay since it only may target one entity currently) to cause things to be triggered at map start.  If you use this to kill an AI or other affect with audio, note if in range of the player&#039;s start, it will be heard during the fade up from black.&lt;br /&gt;
&lt;br /&gt;
=Triggering via Lights=&lt;br /&gt;
Lights trigger their target(s) both upon being extinguished and lit.  This is useful to match window glow to actual light condition.  Depending on the light, it may be tricky to set the targets however.  A basic light entity can simply have target(s) spawnargs, but a candle, lamp or torch with attached flame entity, you need to use the &amp;quot;set&amp;quot; spawnarg.  For example, &amp;quot;set target0 on flame&amp;quot; &amp;quot;EntityToBeTriggered&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
=Trigger a Script=&lt;br /&gt;
Point any trigger at a target_callscriptfunction entity and give it the spawnarg, &amp;quot;call&amp;quot; &#039;&#039;ScriptFunctionName&#039;&#039;, where &#039;&#039;ScriptFunctionName&#039;&#039; matches &amp;quot;void &#039;&#039;ScriptFunctionName&#039;&#039;()&amp;quot; in the map&#039;s .script file.  See [[Scripting_basics#Script_invocation|script invocation]] for more info.&lt;br /&gt;
&lt;br /&gt;
[[Category:Editing]]&lt;/div&gt;</summary>
		<author><name>Springheel</name></author>
	</entry>
	<entry>
		<id>https://wiki.thedarkmod.com/index.php?title=Triggers&amp;diff=20538</id>
		<title>Triggers</title>
		<link rel="alternate" type="text/html" href="https://wiki.thedarkmod.com/index.php?title=Triggers&amp;diff=20538"/>
		<updated>2018-08-13T13:18:52Z</updated>

		<summary type="html">&lt;p&gt;Springheel: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;There are many different ways of triggering [[Entity|entities]], the Trigger entities themselves, as well as through [[Stim/Response]], [[Conversations]], Movers, [[Objectives]], and more.  How the trigger occurs will typically dictate which manner you choose for your map.  &lt;br /&gt;
&lt;br /&gt;
=Triggers=&lt;br /&gt;
To create triggers that rely on boundaries (once, multiple and their derivations), you need to drag out a worldspawn brush, right-click, select &amp;quot;Create Entity&amp;quot;.  (They will not function if abutted against others.)  Triggers need to be connected to their subjects, either via &amp;quot;Connect Selected Entities&amp;quot; menu option/shortcut key, or adding &amp;quot;Target&amp;quot;, &amp;quot;Target0&amp;quot;, &amp;quot;Target1&amp;quot; or subsequent &amp;quot;Target&amp;quot;# spawnargs.  Triggers without targets (to be added via a target_changetarget entity later) won&#039;t exist, so need a dummy target.  The triggers below are listed roughly by frequency of usage, with related triggers beneath.&lt;br /&gt;
&lt;br /&gt;
==trigger_once==&lt;br /&gt;
When the origin of an entity is within the bounds of this entity, the target(s) will be triggered, then the trigger_once is removed.  (Note, to resize the brush after creating the entity, select it then press Tab once.)&lt;br /&gt;
&lt;br /&gt;
==trigger_once_entityname==&lt;br /&gt;
Similar to [[Triggers#trigger_once|trigger_once]], but may be set to only respond to the entity specified by the spawnarg, &amp;quot;entityname&amp;quot;.  Note the entity must move into the boundaries itself, not be moved by the player (AI walking themselves for example).  (If you want something to happen based on the player dropping or placing an item somewhere, use the [[Objectives]] system instead.)&lt;br /&gt;
&lt;br /&gt;
==trigger_multiple==&lt;br /&gt;
Similar to [[Triggers#trigger_once|trigger_once]] but will activate again and again, use &amp;quot;Wait&amp;quot; spawnarg to control how many seconds between triggerings. &lt;br /&gt;
&lt;br /&gt;
==trigger_entityname ==&lt;br /&gt;
Similar to [[Triggers#trigger_multiple|trigger_multiple]] but only reacts to the entity defined by the &amp;quot;entityname&amp;quot; spawnarg.&lt;br /&gt;
&lt;br /&gt;
== trigger_facing ==&lt;br /&gt;
Also similar to [[Triggers#trigger_multiple|trigger_multiple]], but requires the triggering entity to be within 30° of the specified &amp;quot;angle&amp;quot; spawnarg. For details see [[Trigger Facing]].&lt;br /&gt;
&lt;br /&gt;
==trigger_relay ==&lt;br /&gt;
Most commonly used to trigger many targets, or do so after a delay (per the &amp;quot;delay&amp;quot; spawnarg).  May be set to only work once (spawnarg &amp;quot;wait&amp;quot; &amp;quot;-1&amp;quot;) or limit firing based upon how many seconds have passed.  The &amp;quot;random&amp;quot; spawnarg may be used with &amp;quot;wait&amp;quot; to vary the firings.  Very useful as the target of worldspawn, to trigger things at map start (since worldspawn currently only activate one &amp;quot;Target&amp;quot;), or as the target of Objectives.&lt;br /&gt;
&lt;br /&gt;
==trigger_count ==&lt;br /&gt;
This will fire at it&#039;s targets upon a specific number of times being triggered itself, based upon the &amp;quot;count&amp;quot; spawnarg.  If &amp;quot;count&amp;quot; &amp;quot;3&amp;quot; is set, it will do nothing until the third triggering.  Set &amp;quot;repeat&amp;quot; to &amp;quot;1&amp;quot; if it should do it again and again instead of just once.&lt;br /&gt;
&lt;br /&gt;
== trigger_timer ==&lt;br /&gt;
This trigger will fire repeatedly every &amp;quot;wait&amp;quot; # seconds.  The spawnarg &amp;quot;start_on&amp;quot; defines if it should do so at the start of the map, or wait to be triggered (defaults to 0, off at map start).  Spawnarg &amp;quot;random&amp;quot; adds variability to the triggerings.&lt;br /&gt;
&lt;br /&gt;
== trigger_fade ==&lt;br /&gt;
Will cause the display to fade or dissolve to a specified color.  The spawnarg &amp;quot;fadeColor&amp;quot; specifies which color, and how transparent in RGBA (red, green, blue, and alpha, ranging from 0-1).  Default is fade to black: &amp;quot;fadeColor&amp;quot; &amp;quot;0 0 0 1&amp;quot;.  To fade up from whatever, use alpha of 0, IE to fade up from black, &amp;quot;0 0 0 0&amp;quot;.  &amp;quot;fadeTime&amp;quot; controls how quickly the fade transpires.&lt;br /&gt;
&lt;br /&gt;
== trigger_hurt ==&lt;br /&gt;
Applied to a worldspawn brush to define boundaries à la a [[Triggers#trigger_multiple|trigger_multiple]], by default it causes 10 points of damage/second to the activator (player or AI).  It may be triggered on/off.  The spawnarg, &amp;quot;delay&amp;quot; may be set to vary frequency of damage application.  One of various &amp;quot;def_damage&amp;quot; may be specified, generally found in the root directory of the entities, or to see specific details, in the defs file, &amp;quot;damage.def&amp;quot;.  Note those referencing &amp;quot;triggerhurt&amp;quot; simply cause damage, while others feature additional effects such as push and knockbacks (launching the player away).&lt;br /&gt;
&lt;br /&gt;
If you need varying amount of damage based on proximity, the [[Stim/Response_Key/Values#Damage_Stim|Stim/Response]] system offers control of various types of falloff.&lt;br /&gt;
&lt;br /&gt;
trigger_hurt entities do not need a target.  They will damage the player or AI if either enters its bounds.  It apparently does not hurt AI if the trigger_hurt is moved into a stationary AI.&lt;br /&gt;
&lt;br /&gt;
trigger_hurt entities can be turned on/off by other triggers.&lt;br /&gt;
&lt;br /&gt;
== trigger_presize ==&lt;br /&gt;
Akin to [[Triggers#trigger_multiple|trigger_multiple]] without the need of creating a brush first, and defaults to not being touched by players/AIs, but triggered by other entities/script.&lt;br /&gt;
&lt;br /&gt;
== trigger_touch ==&lt;br /&gt;
Continuously checks if entities are touching, costly performance wise, probably done via [[Objectives]] more efficiently.&lt;br /&gt;
&lt;br /&gt;
== trigger_sequencer ==&lt;br /&gt;
Needs to be activated by another trigger.  Fires target 0 when first triggered, target 1 when next triggered, etc.  Can repeat the sequence after triggering the last target if desired.&lt;br /&gt;
&lt;br /&gt;
== trigger_random ==&lt;br /&gt;
When triggered, triggers one of its targets randomly with evenly weighted probability.&lt;br /&gt;
&lt;br /&gt;
=Triggering via Path Nodes=&lt;br /&gt;
Several [[Path Nodes|path nodes]] will trigger their targets upon AI completing the associated node action (as of TDM v2.02).  These include, path_corner (upon reaching), path_turn, path_wait, path_sit, path_sleep and path_anim.&lt;br /&gt;
&lt;br /&gt;
=Triggering Stim/Response=&lt;br /&gt;
&#039;&#039;&#039;To Trigger Something Else:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Any Response type may have an effect of &amp;quot;Trigger&amp;quot;, in which another entity selected is triggered.  Note the &amp;quot;Trigger&amp;quot; effect is all the way at the bottom of the drop down, which might not be displayed on screen (Toggle Effect is the last displayed on mine), you may cursor down or use the End key to get to Trigger.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Be Triggered:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Within the [[Stim/Response]] editor, add a response stim set to &amp;quot;Trigger&amp;quot;, now when this entity is targeted, whatever specified effect will occur.&lt;br /&gt;
&lt;br /&gt;
An example would be to not have something able to be frobbed until something obscuring it is removed or opened.  Make the response effect &amp;quot;Set Frobable&amp;quot; for the entity in question, and check &amp;quot;frobability&amp;quot; on.  Now when the item is triggered, by a door, or frob response on something in front moved/picked up, it will become frobable.&lt;br /&gt;
&lt;br /&gt;
=Triggering via Conversation=&lt;br /&gt;
The command, [[Conversations#Conversation Commands 2|ActivateTarget]] will trigger the specified entity at that time in the Conversation script.&lt;br /&gt;
&lt;br /&gt;
=Triggering via Doors, Buttons, Levers, Movers=&lt;br /&gt;
[[Doors]] trigger their targets by default upon opening (spawnarg &amp;quot;trigger_on_open&amp;quot; &amp;quot;1&amp;quot;).  They may also trigger when completely open by changing &amp;quot;trigger_when_opened&amp;quot; to 1 instead of the default 0, or when fully closed via &amp;quot;trigger_on_close&amp;quot;.  Note, those conditions on Buttons came from doors, so are counter-intuitive.&lt;br /&gt;
&lt;br /&gt;
=Triggering via Objectives=&lt;br /&gt;
In the [[Objectives Editor]] you may select an entity to be triggered upon an objective succeeding or failing.  Therefore all the possible objective conditions may become trigger events (knock out an AI, move an object away from another or to a spot, cause another objective to become visible, disappear or complete, etc.)&lt;br /&gt;
&lt;br /&gt;
=Triggering via Worldspawn=&lt;br /&gt;
You may set &amp;quot;Target&amp;quot; on Worldspawn (usually at a trigger_relay since it only may target one entity currently) to cause things to be triggered at map start.  If you use this to kill an AI or other affect with audio, note if in range of the player&#039;s start, it will be heard during the fade up from black.&lt;br /&gt;
&lt;br /&gt;
=Triggering via Lights=&lt;br /&gt;
Lights trigger their target(s) both upon being extinguished and lit.  This is useful to match window glow to actual light condition.  Depending on the light, it may be tricky to set the targets however.  A basic light entity can simply have target(s) spawnargs, but a candle, lamp or torch with attached flame entity, you need to use the &amp;quot;set&amp;quot; spawnarg.  For example, &amp;quot;set target0 on flame&amp;quot; &amp;quot;EntityToBeTriggered&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
=Trigger a Script=&lt;br /&gt;
Point any trigger at a target_callscriptfunction entity and give it the spawnarg, &amp;quot;call&amp;quot; &#039;&#039;ScriptFunctionName&#039;&#039;, where &#039;&#039;ScriptFunctionName&#039;&#039; matches &amp;quot;void &#039;&#039;ScriptFunctionName&#039;&#039;()&amp;quot; in the map&#039;s .script file.  See [[Scripting_basics#Script_invocation|script invocation]] for more info.&lt;br /&gt;
&lt;br /&gt;
[[Category:Editing]]&lt;/div&gt;</summary>
		<author><name>Springheel</name></author>
	</entry>
	<entry>
		<id>https://wiki.thedarkmod.com/index.php?title=Triggers&amp;diff=20537</id>
		<title>Triggers</title>
		<link rel="alternate" type="text/html" href="https://wiki.thedarkmod.com/index.php?title=Triggers&amp;diff=20537"/>
		<updated>2018-08-11T20:17:30Z</updated>

		<summary type="html">&lt;p&gt;Springheel: /* trigger_hurt */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;There are many different ways of triggering [[Entity|entities]], the Trigger entities themselves, as well as through [[Stim/Response]], [[Conversations]], Movers, [[Objectives]], and more.  How the trigger occurs will typically dictate which manner you choose for your map.  &lt;br /&gt;
&lt;br /&gt;
=Triggers=&lt;br /&gt;
To create triggers that rely on boundaries (once, multiple and their derivations), you need to drag out a worldspawn brush, right-click, select &amp;quot;Create Entity&amp;quot;.  (They will not function if abutted against others.)  Triggers need to be connected to their subjects, either via &amp;quot;Connect Selected Entities&amp;quot; menu option/shortcut key, or adding &amp;quot;Target&amp;quot;, &amp;quot;Target0&amp;quot;, &amp;quot;Target1&amp;quot; or subsequent &amp;quot;Target&amp;quot;# spawnargs.  Triggers without targets (to be added via a target_changetarget entity later) won&#039;t exist, so need a dummy target.  The triggers below are listed roughly by frequency of usage, with related triggers beneath.&lt;br /&gt;
&lt;br /&gt;
==trigger_once==&lt;br /&gt;
When the origin of an entity is within the bounds of this entity, the target(s) will be triggered, then the trigger_once is removed.  (Note, to resize the brush after creating the entity, select it then press Tab once.)&lt;br /&gt;
&lt;br /&gt;
==trigger_once_entityname==&lt;br /&gt;
Similar to [[Triggers#trigger_once|trigger_once]], but may be set to only respond to the entity specified by the spawnarg, &amp;quot;entityname&amp;quot;.  Note the entity must move into the boundaries itself, not be moved by the player (AI walking themselves for example).  (If you want something to happen based on the player dropping or placing an item somewhere, use the [[Objectives]] system instead.)&lt;br /&gt;
&lt;br /&gt;
==trigger_multiple==&lt;br /&gt;
Similar to [[Triggers#trigger_once|trigger_once]] but will activate again and again, use &amp;quot;Wait&amp;quot; spawnarg to control how many seconds between triggerings. &lt;br /&gt;
&lt;br /&gt;
==trigger_entityname ==&lt;br /&gt;
Similar to [[Triggers#trigger_multiple|trigger_multiple]] but only reacts to the entity defined by the &amp;quot;entityname&amp;quot; spawnarg.&lt;br /&gt;
&lt;br /&gt;
== trigger_facing ==&lt;br /&gt;
Also similar to [[Triggers#trigger_multiple|trigger_multiple]], but requires the triggering entity to be within 30° of the specified &amp;quot;angle&amp;quot; spawnarg. For details see [[Trigger Facing]].&lt;br /&gt;
&lt;br /&gt;
==trigger_relay ==&lt;br /&gt;
Most commonly used to trigger many targets, or do so after a delay (per the &amp;quot;delay&amp;quot; spawnarg).  May be set to only work once (spawnarg &amp;quot;wait&amp;quot; &amp;quot;-1&amp;quot;) or limit firing based upon how many seconds have passed.  The &amp;quot;random&amp;quot; spawnarg may be used with &amp;quot;wait&amp;quot; to vary the firings.  Very useful as the target of worldspawn, to trigger things at map start (since worldspawn currently only activate one &amp;quot;Target&amp;quot;), or as the target of Objectives.&lt;br /&gt;
&lt;br /&gt;
==trigger_count ==&lt;br /&gt;
This will fire at it&#039;s targets upon a specific number of times being triggered itself, based upon the &amp;quot;count&amp;quot; spawnarg.  If &amp;quot;count&amp;quot; &amp;quot;3&amp;quot; is set, it will do nothing until the third triggering.  Set &amp;quot;repeat&amp;quot; to &amp;quot;1&amp;quot; if it should do it again and again instead of just once.&lt;br /&gt;
&lt;br /&gt;
== trigger_timer ==&lt;br /&gt;
This trigger will fire repeatedly every &amp;quot;wait&amp;quot; # seconds.  The spawnarg &amp;quot;start_on&amp;quot; defines if it should do so at the start of the map, or wait to be triggered (defaults to 0, off at map start).  Spawnarg &amp;quot;random&amp;quot; adds variability to the triggerings.&lt;br /&gt;
&lt;br /&gt;
== trigger_fade ==&lt;br /&gt;
Will cause the display to fade or dissolve to a specified color.  The spawnarg &amp;quot;fadeColor&amp;quot; specifies which color, and how transparent in RGBA (red, green, blue, and alpha, ranging from 0-1).  Default is fade to black: &amp;quot;fadeColor&amp;quot; &amp;quot;0 0 0 1&amp;quot;.  To fade up from whatever, use alpha of 0, IE to fade up from black, &amp;quot;0 0 0 0&amp;quot;.  &amp;quot;fadeTime&amp;quot; controls how quickly the fade transpires.&lt;br /&gt;
&lt;br /&gt;
== trigger_hurt ==&lt;br /&gt;
Applied to a worldspawn brush to define boundaries à la a [[Triggers#trigger_multiple|trigger_multiple]], by default it causes 10 points of damage/second to the activator (player or AI).  It may be triggered on/off.  The spawnarg, &amp;quot;delay&amp;quot; may be set to vary frequency of damage application.  One of various &amp;quot;def_damage&amp;quot; may be specified, generally found in the root directory of the entities, or to see specific details, in the defs file, &amp;quot;damage.def&amp;quot;.  Note those referencing &amp;quot;triggerhurt&amp;quot; simply cause damage, while others feature additional effects such as push and knockbacks (launching the player away).&lt;br /&gt;
&lt;br /&gt;
If you need varying amount of damage based on proximity, the [[Stim/Response_Key/Values#Damage_Stim|Stim/Response]] system offers control of various types of falloff.&lt;br /&gt;
&lt;br /&gt;
trigger_hurt entities do not need a target.  They will damage the player or AI if either enters its bounds.  It apparently does not hurt AI if the trigger_hurt is moved into a stationary AI.&lt;br /&gt;
&lt;br /&gt;
trigger_hurt entities can be turned on/off by other triggers.&lt;br /&gt;
&lt;br /&gt;
== trigger_presize ==&lt;br /&gt;
Akin to [[Triggers#trigger_multiple|trigger_multiple]] without the need of creating a brush first, and defaults to not being touched by players/AIs, but triggered by other entities/script.&lt;br /&gt;
&lt;br /&gt;
== trigger_touch ==&lt;br /&gt;
Continuously checks if entities are touching, costly performance wise, probably done via [[Objectives]] more efficiently.&lt;br /&gt;
&lt;br /&gt;
=Triggering via Path Nodes=&lt;br /&gt;
Several [[Path Nodes|path nodes]] will trigger their targets upon AI completing the associated node action (as of TDM v2.02).  These include, path_corner (upon reaching), path_turn, path_wait, path_sit, path_sleep and path_anim.&lt;br /&gt;
&lt;br /&gt;
=Triggering Stim/Response=&lt;br /&gt;
&#039;&#039;&#039;To Trigger Something Else:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Any Response type may have an effect of &amp;quot;Trigger&amp;quot;, in which another entity selected is triggered.  Note the &amp;quot;Trigger&amp;quot; effect is all the way at the bottom of the drop down, which might not be displayed on screen (Toggle Effect is the last displayed on mine), you may cursor down or use the End key to get to Trigger.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Be Triggered:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Within the [[Stim/Response]] editor, add a response stim set to &amp;quot;Trigger&amp;quot;, now when this entity is targeted, whatever specified effect will occur.&lt;br /&gt;
&lt;br /&gt;
An example would be to not have something able to be frobbed until something obscuring it is removed or opened.  Make the response effect &amp;quot;Set Frobable&amp;quot; for the entity in question, and check &amp;quot;frobability&amp;quot; on.  Now when the item is triggered, by a door, or frob response on something in front moved/picked up, it will become frobable.&lt;br /&gt;
&lt;br /&gt;
=Triggering via Conversation=&lt;br /&gt;
The command, [[Conversations#Conversation Commands 2|ActivateTarget]] will trigger the specified entity at that time in the Conversation script.&lt;br /&gt;
&lt;br /&gt;
=Triggering via Doors, Buttons, Levers, Movers=&lt;br /&gt;
[[Doors]] trigger their targets by default upon opening (spawnarg &amp;quot;trigger_on_open&amp;quot; &amp;quot;1&amp;quot;).  They may also trigger when completely open by changing &amp;quot;trigger_when_opened&amp;quot; to 1 instead of the default 0, or when fully closed via &amp;quot;trigger_on_close&amp;quot;.  Note, those conditions on Buttons came from doors, so are counter-intuitive.&lt;br /&gt;
&lt;br /&gt;
=Triggering via Objectives=&lt;br /&gt;
In the [[Objectives Editor]] you may select an entity to be triggered upon an objective succeeding or failing.  Therefore all the possible objective conditions may become trigger events (knock out an AI, move an object away from another or to a spot, cause another objective to become visible, disappear or complete, etc.)&lt;br /&gt;
&lt;br /&gt;
=Triggering via Worldspawn=&lt;br /&gt;
You may set &amp;quot;Target&amp;quot; on Worldspawn (usually at a trigger_relay since it only may target one entity currently) to cause things to be triggered at map start.  If you use this to kill an AI or other affect with audio, note if in range of the player&#039;s start, it will be heard during the fade up from black.&lt;br /&gt;
&lt;br /&gt;
=Triggering via Lights=&lt;br /&gt;
Lights trigger their target(s) both upon being extinguished and lit.  This is useful to match window glow to actual light condition.  Depending on the light, it may be tricky to set the targets however.  A basic light entity can simply have target(s) spawnargs, but a candle, lamp or torch with attached flame entity, you need to use the &amp;quot;set&amp;quot; spawnarg.  For example, &amp;quot;set target0 on flame&amp;quot; &amp;quot;EntityToBeTriggered&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
=Trigger a Script=&lt;br /&gt;
Point any trigger at a target_callscriptfunction entity and give it the spawnarg, &amp;quot;call&amp;quot; &#039;&#039;ScriptFunctionName&#039;&#039;, where &#039;&#039;ScriptFunctionName&#039;&#039; matches &amp;quot;void &#039;&#039;ScriptFunctionName&#039;&#039;()&amp;quot; in the map&#039;s .script file.  See [[Scripting_basics#Script_invocation|script invocation]] for more info.&lt;br /&gt;
&lt;br /&gt;
[[Category:Editing]]&lt;/div&gt;</summary>
		<author><name>Springheel</name></author>
	</entry>
	<entry>
		<id>https://wiki.thedarkmod.com/index.php?title=Triggers&amp;diff=20536</id>
		<title>Triggers</title>
		<link rel="alternate" type="text/html" href="https://wiki.thedarkmod.com/index.php?title=Triggers&amp;diff=20536"/>
		<updated>2018-08-11T19:04:25Z</updated>

		<summary type="html">&lt;p&gt;Springheel: /* trigger_hurt */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;There are many different ways of triggering [[Entity|entities]], the Trigger entities themselves, as well as through [[Stim/Response]], [[Conversations]], Movers, [[Objectives]], and more.  How the trigger occurs will typically dictate which manner you choose for your map.  &lt;br /&gt;
&lt;br /&gt;
=Triggers=&lt;br /&gt;
To create triggers that rely on boundaries (once, multiple and their derivations), you need to drag out a worldspawn brush, right-click, select &amp;quot;Create Entity&amp;quot;.  (They will not function if abutted against others.)  Triggers need to be connected to their subjects, either via &amp;quot;Connect Selected Entities&amp;quot; menu option/shortcut key, or adding &amp;quot;Target&amp;quot;, &amp;quot;Target0&amp;quot;, &amp;quot;Target1&amp;quot; or subsequent &amp;quot;Target&amp;quot;# spawnargs.  Triggers without targets (to be added via a target_changetarget entity later) won&#039;t exist, so need a dummy target.  The triggers below are listed roughly by frequency of usage, with related triggers beneath.&lt;br /&gt;
&lt;br /&gt;
==trigger_once==&lt;br /&gt;
When the origin of an entity is within the bounds of this entity, the target(s) will be triggered, then the trigger_once is removed.  (Note, to resize the brush after creating the entity, select it then press Tab once.)&lt;br /&gt;
&lt;br /&gt;
==trigger_once_entityname==&lt;br /&gt;
Similar to [[Triggers#trigger_once|trigger_once]], but may be set to only respond to the entity specified by the spawnarg, &amp;quot;entityname&amp;quot;.  Note the entity must move into the boundaries itself, not be moved by the player (AI walking themselves for example).  (If you want something to happen based on the player dropping or placing an item somewhere, use the [[Objectives]] system instead.)&lt;br /&gt;
&lt;br /&gt;
==trigger_multiple==&lt;br /&gt;
Similar to [[Triggers#trigger_once|trigger_once]] but will activate again and again, use &amp;quot;Wait&amp;quot; spawnarg to control how many seconds between triggerings. &lt;br /&gt;
&lt;br /&gt;
==trigger_entityname ==&lt;br /&gt;
Similar to [[Triggers#trigger_multiple|trigger_multiple]] but only reacts to the entity defined by the &amp;quot;entityname&amp;quot; spawnarg.&lt;br /&gt;
&lt;br /&gt;
== trigger_facing ==&lt;br /&gt;
Also similar to [[Triggers#trigger_multiple|trigger_multiple]], but requires the triggering entity to be within 30° of the specified &amp;quot;angle&amp;quot; spawnarg. For details see [[Trigger Facing]].&lt;br /&gt;
&lt;br /&gt;
==trigger_relay ==&lt;br /&gt;
Most commonly used to trigger many targets, or do so after a delay (per the &amp;quot;delay&amp;quot; spawnarg).  May be set to only work once (spawnarg &amp;quot;wait&amp;quot; &amp;quot;-1&amp;quot;) or limit firing based upon how many seconds have passed.  The &amp;quot;random&amp;quot; spawnarg may be used with &amp;quot;wait&amp;quot; to vary the firings.  Very useful as the target of worldspawn, to trigger things at map start (since worldspawn currently only activate one &amp;quot;Target&amp;quot;), or as the target of Objectives.&lt;br /&gt;
&lt;br /&gt;
==trigger_count ==&lt;br /&gt;
This will fire at it&#039;s targets upon a specific number of times being triggered itself, based upon the &amp;quot;count&amp;quot; spawnarg.  If &amp;quot;count&amp;quot; &amp;quot;3&amp;quot; is set, it will do nothing until the third triggering.  Set &amp;quot;repeat&amp;quot; to &amp;quot;1&amp;quot; if it should do it again and again instead of just once.&lt;br /&gt;
&lt;br /&gt;
== trigger_timer ==&lt;br /&gt;
This trigger will fire repeatedly every &amp;quot;wait&amp;quot; # seconds.  The spawnarg &amp;quot;start_on&amp;quot; defines if it should do so at the start of the map, or wait to be triggered (defaults to 0, off at map start).  Spawnarg &amp;quot;random&amp;quot; adds variability to the triggerings.&lt;br /&gt;
&lt;br /&gt;
== trigger_fade ==&lt;br /&gt;
Will cause the display to fade or dissolve to a specified color.  The spawnarg &amp;quot;fadeColor&amp;quot; specifies which color, and how transparent in RGBA (red, green, blue, and alpha, ranging from 0-1).  Default is fade to black: &amp;quot;fadeColor&amp;quot; &amp;quot;0 0 0 1&amp;quot;.  To fade up from whatever, use alpha of 0, IE to fade up from black, &amp;quot;0 0 0 0&amp;quot;.  &amp;quot;fadeTime&amp;quot; controls how quickly the fade transpires.&lt;br /&gt;
&lt;br /&gt;
== trigger_hurt ==&lt;br /&gt;
Applied to a worldspawn brush to define boundaries à la a [[Triggers#trigger_multiple|trigger_multiple]], by default it causes 10 points of damage/second to the activator (player or AI).  It may be triggered on/off.  The spawnarg, &amp;quot;delay&amp;quot; may be set to vary frequency of damage application.  One of various &amp;quot;def_damage&amp;quot; may be specified, generally found in the root directory of the entities, or to see specific details, in the defs file, &amp;quot;damage.def&amp;quot;.  Note those referencing &amp;quot;triggerhurt&amp;quot; simply cause damage, while others feature additional effects such as push and knockbacks (launching the player away).&lt;br /&gt;
&lt;br /&gt;
If you need varying amount of damage based on proximity, the [[Stim/Response_Key/Values#Damage_Stim|Stim/Response]] system offers control of various types of falloff.&lt;br /&gt;
&lt;br /&gt;
trigger_hurt entities do not need a target.  They will damage the player or AI if either enters its bounds.  It apparently does not hurt AI if the trigger_hurt is moved into a stationary AI.&lt;br /&gt;
&lt;br /&gt;
== trigger_presize ==&lt;br /&gt;
Akin to [[Triggers#trigger_multiple|trigger_multiple]] without the need of creating a brush first, and defaults to not being touched by players/AIs, but triggered by other entities/script.&lt;br /&gt;
&lt;br /&gt;
== trigger_touch ==&lt;br /&gt;
Continuously checks if entities are touching, costly performance wise, probably done via [[Objectives]] more efficiently.&lt;br /&gt;
&lt;br /&gt;
=Triggering via Path Nodes=&lt;br /&gt;
Several [[Path Nodes|path nodes]] will trigger their targets upon AI completing the associated node action (as of TDM v2.02).  These include, path_corner (upon reaching), path_turn, path_wait, path_sit, path_sleep and path_anim.&lt;br /&gt;
&lt;br /&gt;
=Triggering Stim/Response=&lt;br /&gt;
&#039;&#039;&#039;To Trigger Something Else:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Any Response type may have an effect of &amp;quot;Trigger&amp;quot;, in which another entity selected is triggered.  Note the &amp;quot;Trigger&amp;quot; effect is all the way at the bottom of the drop down, which might not be displayed on screen (Toggle Effect is the last displayed on mine), you may cursor down or use the End key to get to Trigger.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Be Triggered:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Within the [[Stim/Response]] editor, add a response stim set to &amp;quot;Trigger&amp;quot;, now when this entity is targeted, whatever specified effect will occur.&lt;br /&gt;
&lt;br /&gt;
An example would be to not have something able to be frobbed until something obscuring it is removed or opened.  Make the response effect &amp;quot;Set Frobable&amp;quot; for the entity in question, and check &amp;quot;frobability&amp;quot; on.  Now when the item is triggered, by a door, or frob response on something in front moved/picked up, it will become frobable.&lt;br /&gt;
&lt;br /&gt;
=Triggering via Conversation=&lt;br /&gt;
The command, [[Conversations#Conversation Commands 2|ActivateTarget]] will trigger the specified entity at that time in the Conversation script.&lt;br /&gt;
&lt;br /&gt;
=Triggering via Doors, Buttons, Levers, Movers=&lt;br /&gt;
[[Doors]] trigger their targets by default upon opening (spawnarg &amp;quot;trigger_on_open&amp;quot; &amp;quot;1&amp;quot;).  They may also trigger when completely open by changing &amp;quot;trigger_when_opened&amp;quot; to 1 instead of the default 0, or when fully closed via &amp;quot;trigger_on_close&amp;quot;.  Note, those conditions on Buttons came from doors, so are counter-intuitive.&lt;br /&gt;
&lt;br /&gt;
=Triggering via Objectives=&lt;br /&gt;
In the [[Objectives Editor]] you may select an entity to be triggered upon an objective succeeding or failing.  Therefore all the possible objective conditions may become trigger events (knock out an AI, move an object away from another or to a spot, cause another objective to become visible, disappear or complete, etc.)&lt;br /&gt;
&lt;br /&gt;
=Triggering via Worldspawn=&lt;br /&gt;
You may set &amp;quot;Target&amp;quot; on Worldspawn (usually at a trigger_relay since it only may target one entity currently) to cause things to be triggered at map start.  If you use this to kill an AI or other affect with audio, note if in range of the player&#039;s start, it will be heard during the fade up from black.&lt;br /&gt;
&lt;br /&gt;
=Triggering via Lights=&lt;br /&gt;
Lights trigger their target(s) both upon being extinguished and lit.  This is useful to match window glow to actual light condition.  Depending on the light, it may be tricky to set the targets however.  A basic light entity can simply have target(s) spawnargs, but a candle, lamp or torch with attached flame entity, you need to use the &amp;quot;set&amp;quot; spawnarg.  For example, &amp;quot;set target0 on flame&amp;quot; &amp;quot;EntityToBeTriggered&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
=Trigger a Script=&lt;br /&gt;
Point any trigger at a target_callscriptfunction entity and give it the spawnarg, &amp;quot;call&amp;quot; &#039;&#039;ScriptFunctionName&#039;&#039;, where &#039;&#039;ScriptFunctionName&#039;&#039; matches &amp;quot;void &#039;&#039;ScriptFunctionName&#039;&#039;()&amp;quot; in the map&#039;s .script file.  See [[Scripting_basics#Script_invocation|script invocation]] for more info.&lt;br /&gt;
&lt;br /&gt;
[[Category:Editing]]&lt;/div&gt;</summary>
		<author><name>Springheel</name></author>
	</entry>
	<entry>
		<id>https://wiki.thedarkmod.com/index.php?title=Stim/Response_Key/Values&amp;diff=20535</id>
		<title>Stim/Response Key/Values</title>
		<link rel="alternate" type="text/html" href="https://wiki.thedarkmod.com/index.php?title=Stim/Response_Key/Values&amp;diff=20535"/>
		<updated>2018-08-11T17:00:47Z</updated>

		<summary type="html">&lt;p&gt;Springheel: /* Stim only */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;Note:&#039;&#039;&#039; &#039;&#039;There is now a stim/response editor accessed via the Dark Radiant entity menu which makes it easier to set these key/values. The editor settings will be shown below next to their equivalent key/values (work in progress.)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;There are some useful notes regarding STIMs here:  http://wiki.thedarkmod.com/index.php?title=User:VanishedOne&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I added two new key/vals to stim response, and figured I would document them all here including the new ones.&lt;br /&gt;
&lt;br /&gt;
In all of these, N is the number of the stim on the entity. It starts at 1 and goes up. Be aware of any stims that are defined on the entity in other places, like in the def file or in something inherited by it. Stims on the entity itself must start counting from the last one of these, so if the def file has 1 stim, the entitydef in the map would start at number 2.&lt;br /&gt;
&lt;br /&gt;
== Keys that can be used to set up both stims and responses ==&lt;br /&gt;
Key: &#039;&#039;&#039;sr_class_N&#039;&#039;&#039;&lt;br /&gt;
Set to &amp;quot;S&amp;quot; for stim, &amp;quot;R&amp;quot; for response.&lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_type_N&#039;&#039;&#039;&lt;br /&gt;
Type of stim (e.g. STIM_WATER). See /script/darkmod_stim_response.script for a complete list of stim types.&lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_state_N&#039;&#039;&#039;&lt;br /&gt;
Set to &amp;quot;1&amp;quot; for enabled, &amp;quot;0&amp;quot; for disabled. This may be altered later with scripting.&lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_chance_N&#039;&#039;&#039;&lt;br /&gt;
Probability for this stim/response to fire/react. Set this to 0.3 if you want to have a 30% chance.&lt;br /&gt;
&lt;br /&gt;
== Stim only ==&lt;br /&gt;
Key: &#039;&#039;&#039;sr_use_bounds_N&#039;&#039;&#039;&lt;br /&gt;
Set to &amp;quot;1&amp;quot; if you want to use the bounds of the entity as the basis for the intersection test. &amp;quot;0&amp;quot; (the default) uses a sphere centered on the entity origin.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Springheel:  I cannot confirm this. After a lot of tests, it seems that the game is measuring the distance from the origin of the stim to the bounds of the response.  It looks like the origin of the stim must be [radius + distance] =&amp;gt; 4 in order to avoid stimming the response.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Tests intersection between the physical models of entities A and B, where A carries the stim and B perhaps has a response set. Used for &#039;immersion&#039; in liquids. If A also has a radius set on the stim, the stim can be applied to B when the radius intersects with B&#039;s physical model. &lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_collision_N&#039;&#039;&#039;&lt;br /&gt;
Stim on entity A is applied to entity B when A and B collide.&lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_radius_N&#039;&#039;&#039;&lt;br /&gt;
Radius of the stim in doomunits. NOTE: If you set sr_use_bounds to &amp;quot;1&amp;quot;, the radius is applied as an expansion of the entity bounding box in all directions. So if you select use bounds and set the radius to &amp;quot;0&amp;quot;, this makes the stimmed region exactly equal to the stim bounds.&lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_radius_final_N&#039;&#039;&#039;&lt;br /&gt;
Final radius of the stim (i.e. the radius at the end of its lifetime). While the stim is active, the radius will linearly change within the [sr_radius..sr_radius_final] interval. The start value is defined by sr_radius, the end value by this spawnarg. Note that sr_radius_final is not necessarily larger than the sr_radius value, it&#039;s also possible to let a stim shrink. For this spawnarg to work, the &#039;&#039;&#039;sr_duration&#039;&#039;&#039; value must be greater than zero.&lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_magnitude_N&#039;&#039;&#039; (float)&lt;br /&gt;
The maximum magnitude of the stim at zero distance. If the responding entity&#039;s origin is exactly at the origin of the stimming entity (which is not always possible due to the collision boxes), this magnitude value is passed to the response effect scripts.&lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_falloffexponent_N&#039;&#039;&#039; (float)&lt;br /&gt;
The falloff exponent determining the magnitude in dependency of the distance. There is no limitation to this value, although only a few make sense.&lt;br /&gt;
&lt;br /&gt;
0 = no falloff (magnitude is constantly at maximum value over the whole radius)&lt;br /&gt;
&lt;br /&gt;
1 = linear falloff&lt;br /&gt;
&lt;br /&gt;
2 = quadratic falloff&lt;br /&gt;
&lt;br /&gt;
3 = etc.&lt;br /&gt;
&lt;br /&gt;
The higher the number, the faster the magnitude is decreasing with the distance. The magnitude is reaching zero as soon as the distance of the responding object is greater than or equal to the stim radius, except for falloffexponent = 0 (no falloff). Negative values are allowed as well, this way it should be possible to actually increase the magnitude of a stim with larger distance. Don&#039;t know if that makes sense, though and I haven&#039;t tested it either.&lt;br /&gt;
&lt;br /&gt;
For documentation purposes, this function is used to determine the actual magnitude: &#039;&#039;&#039;m(dist) = m0*[ 1 - dist/radius]^falloffExponent&#039;&#039;&#039; (math functions seem to be disabled for this wiki)&lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_duration_N&#039;&#039;&#039;&lt;br /&gt;
This specifies how long the stim is active before it gets disabled. If this is key is empty, the stim has infinite lifetime (apart from being disabled by scripts and such).  Changing this value to 2000 will mean the stim is active for 2 seconds (apparently from map start).&lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_time_interval_N&#039;&#039;&#039;&lt;br /&gt;
When this stim is active, the firings will be spread out by this many milliseconds. So a stim with sr_time_interval = 500 will fire every half second when active. Used for optimization for stims that don&#039;t have to be checked that often.&lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_max_fire_count_N&#039;&#039;&#039; (default: -1)&lt;br /&gt;
This specifies the maximum number of stim firings that are possible for this stim. The default is -1 which means that it can be fired infinitely often. With each firing, the counter is decreased. When it reaches zero, the stim is entirely ignored from then on. Currently there is no way to reactivate a stim whose max_fire_count has been depleted. Stims that fail because of their &#039;&#039;&#039;sr_chance_N&#039;&#039;&#039; spawnarg decrease the counter as well.&lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_timer_time_N&#039;&#039;&#039; (Format: hhhh:mm:ss:ms, for example: 0:3:20:0 which means 3 minutes and 20 secs) &#039;&#039;(s &amp;amp; r editor = Activation Timer.)&#039;&#039;&lt;br /&gt;
This can be used to enable the stim after a certain amount of time. Depending on the &#039;&#039;&#039;sr_timer_waitforstart&#039;&#039;&#039; key the timer is started on spawn or on a &amp;quot;StartTimer&amp;quot; event. Use this to setup a stim that has its &#039;&#039;&#039;sr_state_N&#039;&#039;&#039; set to 0 at start and gets enabled after a certain amount of time. This is only effective if the sr_state is 0 (disabled) by the time this timer is elapsing &#039;&#039;(s &amp;amp; r editor = Active checkbox.)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_timer_waitforstart_N&#039;&#039;&#039; (0 or 1, default is 0)&lt;br /&gt;
If this key is TRUE = &amp;quot;1&amp;quot;, the timer has to be started by a StartTimer script event or the according response effect. If this is set to 0, the timer starts on spawning this entity (beware: the entities might be spawned quite some time before the map is actually started, on my testmap it sometimes took up to 20 seconds before the player is spawned, so this is not a very reliable measure).&lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_timer_type_N&#039;&#039;&#039; | possible values: &amp;quot;RELOAD&amp;quot; or &amp;quot;SINGLESHOT&amp;quot; (default)&lt;br /&gt;
When this is set to RELOAD, the timer is reactivated after the stim has been fired. This can be used to setup sophisticated time intervals. I intend to draw a graph explaining this, so if this is not yet in the wiki, you can bug greebo to do this. :)&lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_bounds_mins_N&#039;&#039;&#039; and &#039;&#039;&#039;sr_bounds_maxs_N&#039;&#039;&#039; (Type: Vector, default is &amp;quot;0 0 0&amp;quot;)&lt;br /&gt;
These two vectors define the bounding box of the stim. This is measured relatively to the stim origin (which might be moving), not the entity origin. A vector pair of &#039;&#039;&#039;-10 -10 -50&#039;&#039;&#039; and &#039;&#039;&#039;10 10 150&#039;&#039;&#039; defines a primarily vertical stim area.&lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_velocity_N&#039;&#039;&#039; (type: Vector, default: &amp;quot;0 0 &amp;quot;)&lt;br /&gt;
This defines the velocity of the stim in units per second. A vector of &#039;&#039;&#039;0 0 -10&#039;&#039;&#039; let&#039;s the stim move downward for 10 units per second for the stim duration time.&lt;br /&gt;
&lt;br /&gt;
== Response only ==&lt;br /&gt;
Key: &#039;&#039;&#039;sr_chance_timeout_N&#039;&#039;&#039;&lt;br /&gt;
Many stims like the water arrow stim are firing rapidly multiple times a second, distorting the &amp;quot;effective&amp;quot; probability of a response going off. Use this to give the response a timeout before it can be evaluated again after a failed probability check.&lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_random_effects_N&#039;&#039;&#039;&lt;br /&gt;
If this spawnarg contains non-zero values, exactly this number of random response effects is chosen from the available ones. So, if you set sr_random_effects to 2 and there are 5 effects available, two are randomly chosen (may also be one of them twice). If only one effect is available, just this one is fired twice.&lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_script_&amp;lt;STIM TYPE&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
First off, the name of this key: &amp;lt;STIM TYPE&amp;gt; should be replaced with the string name of one of the stim types. For example, sr_script_STIM_WATER defines the script to call in respone to a water stim. Apparently there can only be one of these per stim type. &amp;lt;STIM TYPE&amp;gt; can either be the name as a string (in case of default stims) or the number:&lt;br /&gt;
sr_script_STIM_WATER&lt;br /&gt;
sr_script_2&lt;br /&gt;
Both of which will have the same meaning, assuming that the water stim has the number two.&lt;br /&gt;
&lt;br /&gt;
The value this key contains the name of the script function to call. If it&#039;s a local script, you must put it in the form of &amp;quot;&amp;lt;script object name&amp;gt;::&amp;lt;local function&amp;gt;&amp;quot; otherwise &amp;quot;&amp;lt;global function name&amp;gt;&amp;quot; works as well.&lt;br /&gt;
&lt;br /&gt;
Note:  When using the stim/response editor, you must right-click on the Response Effects field in order to enter an effect.  Not sure how anyone would know that.&lt;br /&gt;
&lt;br /&gt;
Also note, responses set on AI persist when the AI goes to ragdoll state.&lt;br /&gt;
&lt;br /&gt;
== Important note about writing response scripts ==&lt;br /&gt;
There&#039;s some subtlety about writing these response scriptfunctions. Global scriptfunctions must take two arguments: an entity argument and int threadnum argument. The first argument is the entity that was stimmed. Local response functions (those on the entity being stimmed) should not have the entity argument, only taking one argument, the threadnum. This is because the entity being stimmed is the same as the entity running the script, so the argument is passed implicitly as the &amp;quot;self&amp;quot; entity, just like the &amp;quot;this&amp;quot; pointer is passed implicitly in C++.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Examples ==&lt;br /&gt;
=== Damage Stim ===&lt;br /&gt;
&lt;br /&gt;
An entity has a STIM_DAMAGE with a magnitude of 100 and a linear falloff (1). The further you&#039;re away from the stim origin, the smaller the magnitude gets.&lt;br /&gt;
&lt;br /&gt;
Once an entity with a response to STIM_DAMAGE comes into range and the stim fires, the magnitude is passed on to the response entity. The response entity needs to have a response effect defined for the DAMAGE stim, which tells the code which damage entityDef (e.g. &#039;&#039;atdm:damage_simple&#039;&#039;) it should use and which entity should be damaged (this should be &#039;&#039;_SELF&#039;&#039; by default).&lt;br /&gt;
&lt;br /&gt;
So, an example response setup can be found on the player:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 // The damage response&lt;br /&gt;
 &amp;quot;sr_class_3&amp;quot; &amp;quot;R&amp;quot;&lt;br /&gt;
 &amp;quot;sr_type_3&amp;quot; &amp;quot;STIM_DAMAGE&amp;quot;&lt;br /&gt;
 &amp;quot;sr_state_3&amp;quot; &amp;quot;1&amp;quot;&lt;br /&gt;
 &amp;quot;sr_effect_3_1&amp;quot; &amp;quot;effect_damage&amp;quot;&lt;br /&gt;
 &amp;quot;sr_effect_3_1_arg1&amp;quot; &amp;quot;_SELF&amp;quot;&lt;br /&gt;
 &amp;quot;sr_effect_3_1_arg2&amp;quot; &amp;quot;atdm:damage_simple&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As soon as the player comes into the range of a damage stim, the distance-based magnitude is passed over and the code multiplies this magnitude with the &amp;quot;damage&amp;quot; value defined in atdm:damage_simple. E.g. if a magnitude of 30 is passed, the atdm:damage_simple&#039;s value of 10 ends up at 300 =&amp;gt; insta-death.&lt;br /&gt;
&lt;br /&gt;
If you want to have a constant magnitude which is not depending on the distance, you need to define a 0 falloff on the stim.&lt;br /&gt;
&lt;br /&gt;
=== Remove torch damage if extinguished with water ===&lt;br /&gt;
If you have hot torches/ovens that damage the player if too close, but shouldn&#039;t if extinguished, first copy the name of the entity that has the damage stim.  Then use the Stim/Response editor to add a Water Response, effect &amp;quot;Deactivate Stim&amp;quot;, pasting/selecting the entity with the damage stim, and &amp;quot;Damage&amp;quot;.  (One would want a Fire Response, &amp;quot;Activate Stim&amp;quot; if they wished damage to return if reignited.)&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
*[[Stim/Response]] overview&lt;br /&gt;
*[[Triggers]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Editing]]&lt;/div&gt;</summary>
		<author><name>Springheel</name></author>
	</entry>
	<entry>
		<id>https://wiki.thedarkmod.com/index.php?title=Stim/Response_Key/Values&amp;diff=20534</id>
		<title>Stim/Response Key/Values</title>
		<link rel="alternate" type="text/html" href="https://wiki.thedarkmod.com/index.php?title=Stim/Response_Key/Values&amp;diff=20534"/>
		<updated>2018-08-08T15:38:09Z</updated>

		<summary type="html">&lt;p&gt;Springheel: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;Note:&#039;&#039;&#039; &#039;&#039;There is now a stim/response editor accessed via the Dark Radiant entity menu which makes it easier to set these key/values. The editor settings will be shown below next to their equivalent key/values (work in progress.)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;There are some useful notes regarding STIMs here:  http://wiki.thedarkmod.com/index.php?title=User:VanishedOne&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I added two new key/vals to stim response, and figured I would document them all here including the new ones.&lt;br /&gt;
&lt;br /&gt;
In all of these, N is the number of the stim on the entity. It starts at 1 and goes up. Be aware of any stims that are defined on the entity in other places, like in the def file or in something inherited by it. Stims on the entity itself must start counting from the last one of these, so if the def file has 1 stim, the entitydef in the map would start at number 2.&lt;br /&gt;
&lt;br /&gt;
== Keys that can be used to set up both stims and responses ==&lt;br /&gt;
Key: &#039;&#039;&#039;sr_class_N&#039;&#039;&#039;&lt;br /&gt;
Set to &amp;quot;S&amp;quot; for stim, &amp;quot;R&amp;quot; for response.&lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_type_N&#039;&#039;&#039;&lt;br /&gt;
Type of stim (e.g. STIM_WATER). See /script/darkmod_stim_response.script for a complete list of stim types.&lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_state_N&#039;&#039;&#039;&lt;br /&gt;
Set to &amp;quot;1&amp;quot; for enabled, &amp;quot;0&amp;quot; for disabled. This may be altered later with scripting.&lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_chance_N&#039;&#039;&#039;&lt;br /&gt;
Probability for this stim/response to fire/react. Set this to 0.3 if you want to have a 30% chance.&lt;br /&gt;
&lt;br /&gt;
== Stim only ==&lt;br /&gt;
Key: &#039;&#039;&#039;sr_use_bounds_N&#039;&#039;&#039;&lt;br /&gt;
Set to &amp;quot;1&amp;quot; if you want to use the bounds of the entity as the basis for the intersection test. &amp;quot;0&amp;quot; (the default) uses a sphere centered on the entity origin.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Springheel:  I cannot confirm this. After a lot of tests, it seems that the game is measuring the distance from the origin of the stim to the bounds of the response.  It looks like the origin of the stim must be [radius + distance] =&amp;gt; 4 in order to avoid stimming the response.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Tests intersection between the physical models of entities A and B, where A carries the stim and B perhaps has a response set. Used for &#039;immersion&#039; in liquids. If A also has a radius set on the stim, the stim can be applied to B when the radius intersects with B&#039;s physical model. &lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_collision_N&#039;&#039;&#039;&lt;br /&gt;
Stim on entity A is applied to entity B when A and B collide.&lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_radius_N&#039;&#039;&#039;&lt;br /&gt;
Radius of the stim in doomunits. NOTE: If you set sr_use_bounds to &amp;quot;1&amp;quot;, the radius is applied as an expansion of the entity bounding box in all directions. So if you select use bounds and set the radius to &amp;quot;0&amp;quot;, this makes the stimmed region exactly equal to the stim bounds.&lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_radius_final_N&#039;&#039;&#039;&lt;br /&gt;
Final radius of the stim (i.e. the radius at the end of its lifetime). While the stim is active, the radius will linearly change within the [sr_radius..sr_radius_final] interval. The start value is defined by sr_radius, the end value by this spawnarg. Note that sr_radius_final is not necessarily larger than the sr_radius value, it&#039;s also possible to let a stim shrink. For this spawnarg to work, the &#039;&#039;&#039;sr_duration&#039;&#039;&#039; value must be greater than zero.&lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_magnitude_N&#039;&#039;&#039; (float)&lt;br /&gt;
The maximum magnitude of the stim at zero distance. If the responding entity&#039;s origin is exactly at the origin of the stimming entity (which is not always possible due to the collision boxes), this magnitude value is passed to the response effect scripts.&lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_falloffexponent_N&#039;&#039;&#039; (float)&lt;br /&gt;
The falloff exponent determining the magnitude in dependency of the distance. There is no limitation to this value, although only a few make sense.&lt;br /&gt;
&lt;br /&gt;
0 = no falloff (magnitude is constantly at maximum value over the whole radius)&lt;br /&gt;
&lt;br /&gt;
1 = linear falloff&lt;br /&gt;
&lt;br /&gt;
2 = quadratic falloff&lt;br /&gt;
&lt;br /&gt;
3 = etc.&lt;br /&gt;
&lt;br /&gt;
The higher the number, the faster the magnitude is decreasing with the distance. The magnitude is reaching zero as soon as the distance of the responding object is greater than or equal to the stim radius, except for falloffexponent = 0 (no falloff). Negative values are allowed as well, this way it should be possible to actually increase the magnitude of a stim with larger distance. Don&#039;t know if that makes sense, though and I haven&#039;t tested it either.&lt;br /&gt;
&lt;br /&gt;
For documentation purposes, this function is used to determine the actual magnitude: &#039;&#039;&#039;m(dist) = m0*[ 1 - dist/radius]^falloffExponent&#039;&#039;&#039; (math functions seem to be disabled for this wiki)&lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_duration_N&#039;&#039;&#039;&lt;br /&gt;
This specifies how long the stim is active before it gets disabled. If this is key is empty, the stim has infinite lifetime (apart from being disabled by scripts and such).&lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_time_interval_N&#039;&#039;&#039;&lt;br /&gt;
When this stim is active, the firings will be spread out by this many milliseconds. So a stim with sr_time_interval = 500 will fire every half second when active. Used for optimization for stims that don&#039;t have to be checked that often.&lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_max_fire_count_N&#039;&#039;&#039; (default: -1)&lt;br /&gt;
This specifies the maximum number of stim firings that are possible for this stim. The default is -1 which means that it can be fired infinitely often. With each firing, the counter is decreased. When it reaches zero, the stim is entirely ignored from then on. Currently there is no way to reactivate a stim whose max_fire_count has been depleted. Stims that fail because of their &#039;&#039;&#039;sr_chance_N&#039;&#039;&#039; spawnarg decrease the counter as well.&lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_timer_time_N&#039;&#039;&#039; (Format: hhhh:mm:ss:ms, for example: 0:3:20:0 which means 3 minutes and 20 secs) &#039;&#039;(s &amp;amp; r editor = Activation Timer.)&#039;&#039;&lt;br /&gt;
This can be used to enable the stim after a certain amount of time. Depending on the &#039;&#039;&#039;sr_timer_waitforstart&#039;&#039;&#039; key the timer is started on spawn or on a &amp;quot;StartTimer&amp;quot; event. Use this to setup a stim that has its &#039;&#039;&#039;sr_state_N&#039;&#039;&#039; set to 0 at start and gets enabled after a certain amount of time. This is only effective if the sr_state is 0 (disabled) by the time this timer is elapsing &#039;&#039;(s &amp;amp; r editor = Active checkbox.)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_timer_waitforstart_N&#039;&#039;&#039; (0 or 1, default is 0)&lt;br /&gt;
If this key is TRUE = &amp;quot;1&amp;quot;, the timer has to be started by a StartTimer script event or the according response effect. If this is set to 0, the timer starts on spawning this entity (beware: the entities might be spawned quite some time before the map is actually started, on my testmap it sometimes took up to 20 seconds before the player is spawned, so this is not a very reliable measure).&lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_timer_type_N&#039;&#039;&#039; | possible values: &amp;quot;RELOAD&amp;quot; or &amp;quot;SINGLESHOT&amp;quot; (default)&lt;br /&gt;
When this is set to RELOAD, the timer is reactivated after the stim has been fired. This can be used to setup sophisticated time intervals. I intend to draw a graph explaining this, so if this is not yet in the wiki, you can bug greebo to do this. :)&lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_bounds_mins_N&#039;&#039;&#039; and &#039;&#039;&#039;sr_bounds_maxs_N&#039;&#039;&#039; (Type: Vector, default is &amp;quot;0 0 0&amp;quot;)&lt;br /&gt;
These two vectors define the bounding box of the stim. This is measured relatively to the stim origin (which might be moving), not the entity origin. A vector pair of &#039;&#039;&#039;-10 -10 -50&#039;&#039;&#039; and &#039;&#039;&#039;10 10 150&#039;&#039;&#039; defines a primarily vertical stim area.&lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_velocity_N&#039;&#039;&#039; (type: Vector, default: &amp;quot;0 0 &amp;quot;)&lt;br /&gt;
This defines the velocity of the stim in units per second. A vector of &#039;&#039;&#039;0 0 -10&#039;&#039;&#039; let&#039;s the stim move downward for 10 units per second for the stim duration time.&lt;br /&gt;
&lt;br /&gt;
== Response only ==&lt;br /&gt;
Key: &#039;&#039;&#039;sr_chance_timeout_N&#039;&#039;&#039;&lt;br /&gt;
Many stims like the water arrow stim are firing rapidly multiple times a second, distorting the &amp;quot;effective&amp;quot; probability of a response going off. Use this to give the response a timeout before it can be evaluated again after a failed probability check.&lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_random_effects_N&#039;&#039;&#039;&lt;br /&gt;
If this spawnarg contains non-zero values, exactly this number of random response effects is chosen from the available ones. So, if you set sr_random_effects to 2 and there are 5 effects available, two are randomly chosen (may also be one of them twice). If only one effect is available, just this one is fired twice.&lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_script_&amp;lt;STIM TYPE&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
First off, the name of this key: &amp;lt;STIM TYPE&amp;gt; should be replaced with the string name of one of the stim types. For example, sr_script_STIM_WATER defines the script to call in respone to a water stim. Apparently there can only be one of these per stim type. &amp;lt;STIM TYPE&amp;gt; can either be the name as a string (in case of default stims) or the number:&lt;br /&gt;
sr_script_STIM_WATER&lt;br /&gt;
sr_script_2&lt;br /&gt;
Both of which will have the same meaning, assuming that the water stim has the number two.&lt;br /&gt;
&lt;br /&gt;
The value this key contains the name of the script function to call. If it&#039;s a local script, you must put it in the form of &amp;quot;&amp;lt;script object name&amp;gt;::&amp;lt;local function&amp;gt;&amp;quot; otherwise &amp;quot;&amp;lt;global function name&amp;gt;&amp;quot; works as well.&lt;br /&gt;
&lt;br /&gt;
Note:  When using the stim/response editor, you must right-click on the Response Effects field in order to enter an effect.  Not sure how anyone would know that.&lt;br /&gt;
&lt;br /&gt;
Also note, responses set on AI persist when the AI goes to ragdoll state.&lt;br /&gt;
&lt;br /&gt;
== Important note about writing response scripts ==&lt;br /&gt;
There&#039;s some subtlety about writing these response scriptfunctions. Global scriptfunctions must take two arguments: an entity argument and int threadnum argument. The first argument is the entity that was stimmed. Local response functions (those on the entity being stimmed) should not have the entity argument, only taking one argument, the threadnum. This is because the entity being stimmed is the same as the entity running the script, so the argument is passed implicitly as the &amp;quot;self&amp;quot; entity, just like the &amp;quot;this&amp;quot; pointer is passed implicitly in C++.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Examples ==&lt;br /&gt;
=== Damage Stim ===&lt;br /&gt;
&lt;br /&gt;
An entity has a STIM_DAMAGE with a magnitude of 100 and a linear falloff (1). The further you&#039;re away from the stim origin, the smaller the magnitude gets.&lt;br /&gt;
&lt;br /&gt;
Once an entity with a response to STIM_DAMAGE comes into range and the stim fires, the magnitude is passed on to the response entity. The response entity needs to have a response effect defined for the DAMAGE stim, which tells the code which damage entityDef (e.g. &#039;&#039;atdm:damage_simple&#039;&#039;) it should use and which entity should be damaged (this should be &#039;&#039;_SELF&#039;&#039; by default).&lt;br /&gt;
&lt;br /&gt;
So, an example response setup can be found on the player:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 // The damage response&lt;br /&gt;
 &amp;quot;sr_class_3&amp;quot; &amp;quot;R&amp;quot;&lt;br /&gt;
 &amp;quot;sr_type_3&amp;quot; &amp;quot;STIM_DAMAGE&amp;quot;&lt;br /&gt;
 &amp;quot;sr_state_3&amp;quot; &amp;quot;1&amp;quot;&lt;br /&gt;
 &amp;quot;sr_effect_3_1&amp;quot; &amp;quot;effect_damage&amp;quot;&lt;br /&gt;
 &amp;quot;sr_effect_3_1_arg1&amp;quot; &amp;quot;_SELF&amp;quot;&lt;br /&gt;
 &amp;quot;sr_effect_3_1_arg2&amp;quot; &amp;quot;atdm:damage_simple&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As soon as the player comes into the range of a damage stim, the distance-based magnitude is passed over and the code multiplies this magnitude with the &amp;quot;damage&amp;quot; value defined in atdm:damage_simple. E.g. if a magnitude of 30 is passed, the atdm:damage_simple&#039;s value of 10 ends up at 300 =&amp;gt; insta-death.&lt;br /&gt;
&lt;br /&gt;
If you want to have a constant magnitude which is not depending on the distance, you need to define a 0 falloff on the stim.&lt;br /&gt;
&lt;br /&gt;
=== Remove torch damage if extinguished with water ===&lt;br /&gt;
If you have hot torches/ovens that damage the player if too close, but shouldn&#039;t if extinguished, first copy the name of the entity that has the damage stim.  Then use the Stim/Response editor to add a Water Response, effect &amp;quot;Deactivate Stim&amp;quot;, pasting/selecting the entity with the damage stim, and &amp;quot;Damage&amp;quot;.  (One would want a Fire Response, &amp;quot;Activate Stim&amp;quot; if they wished damage to return if reignited.)&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
*[[Stim/Response]] overview&lt;br /&gt;
*[[Triggers]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Editing]]&lt;/div&gt;</summary>
		<author><name>Springheel</name></author>
	</entry>
	<entry>
		<id>https://wiki.thedarkmod.com/index.php?title=Stim/Response_Key/Values&amp;diff=20533</id>
		<title>Stim/Response Key/Values</title>
		<link rel="alternate" type="text/html" href="https://wiki.thedarkmod.com/index.php?title=Stim/Response_Key/Values&amp;diff=20533"/>
		<updated>2018-08-08T15:37:59Z</updated>

		<summary type="html">&lt;p&gt;Springheel: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;Note:&#039;&#039;&#039; &#039;&#039;There is now a stim/response editor accessed via the Dark Radiant entity menu which makes it easier to set these key/values. The editor settings will be shown below next to their equivalent key/values (work in progress.)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;There are some useful notes regarding STIMs here:  http://wiki.thedarkmod.com/index.php?title=User:VanishedOne&lt;br /&gt;
&#039;&#039;&lt;br /&gt;
I added two new key/vals to stim response, and figured I would document them all here including the new ones.&lt;br /&gt;
&lt;br /&gt;
In all of these, N is the number of the stim on the entity. It starts at 1 and goes up. Be aware of any stims that are defined on the entity in other places, like in the def file or in something inherited by it. Stims on the entity itself must start counting from the last one of these, so if the def file has 1 stim, the entitydef in the map would start at number 2.&lt;br /&gt;
&lt;br /&gt;
== Keys that can be used to set up both stims and responses ==&lt;br /&gt;
Key: &#039;&#039;&#039;sr_class_N&#039;&#039;&#039;&lt;br /&gt;
Set to &amp;quot;S&amp;quot; for stim, &amp;quot;R&amp;quot; for response.&lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_type_N&#039;&#039;&#039;&lt;br /&gt;
Type of stim (e.g. STIM_WATER). See /script/darkmod_stim_response.script for a complete list of stim types.&lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_state_N&#039;&#039;&#039;&lt;br /&gt;
Set to &amp;quot;1&amp;quot; for enabled, &amp;quot;0&amp;quot; for disabled. This may be altered later with scripting.&lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_chance_N&#039;&#039;&#039;&lt;br /&gt;
Probability for this stim/response to fire/react. Set this to 0.3 if you want to have a 30% chance.&lt;br /&gt;
&lt;br /&gt;
== Stim only ==&lt;br /&gt;
Key: &#039;&#039;&#039;sr_use_bounds_N&#039;&#039;&#039;&lt;br /&gt;
Set to &amp;quot;1&amp;quot; if you want to use the bounds of the entity as the basis for the intersection test. &amp;quot;0&amp;quot; (the default) uses a sphere centered on the entity origin.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Springheel:  I cannot confirm this. After a lot of tests, it seems that the game is measuring the distance from the origin of the stim to the bounds of the response.  It looks like the origin of the stim must be [radius + distance] =&amp;gt; 4 in order to avoid stimming the response.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Tests intersection between the physical models of entities A and B, where A carries the stim and B perhaps has a response set. Used for &#039;immersion&#039; in liquids. If A also has a radius set on the stim, the stim can be applied to B when the radius intersects with B&#039;s physical model. &lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_collision_N&#039;&#039;&#039;&lt;br /&gt;
Stim on entity A is applied to entity B when A and B collide.&lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_radius_N&#039;&#039;&#039;&lt;br /&gt;
Radius of the stim in doomunits. NOTE: If you set sr_use_bounds to &amp;quot;1&amp;quot;, the radius is applied as an expansion of the entity bounding box in all directions. So if you select use bounds and set the radius to &amp;quot;0&amp;quot;, this makes the stimmed region exactly equal to the stim bounds.&lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_radius_final_N&#039;&#039;&#039;&lt;br /&gt;
Final radius of the stim (i.e. the radius at the end of its lifetime). While the stim is active, the radius will linearly change within the [sr_radius..sr_radius_final] interval. The start value is defined by sr_radius, the end value by this spawnarg. Note that sr_radius_final is not necessarily larger than the sr_radius value, it&#039;s also possible to let a stim shrink. For this spawnarg to work, the &#039;&#039;&#039;sr_duration&#039;&#039;&#039; value must be greater than zero.&lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_magnitude_N&#039;&#039;&#039; (float)&lt;br /&gt;
The maximum magnitude of the stim at zero distance. If the responding entity&#039;s origin is exactly at the origin of the stimming entity (which is not always possible due to the collision boxes), this magnitude value is passed to the response effect scripts.&lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_falloffexponent_N&#039;&#039;&#039; (float)&lt;br /&gt;
The falloff exponent determining the magnitude in dependency of the distance. There is no limitation to this value, although only a few make sense.&lt;br /&gt;
&lt;br /&gt;
0 = no falloff (magnitude is constantly at maximum value over the whole radius)&lt;br /&gt;
&lt;br /&gt;
1 = linear falloff&lt;br /&gt;
&lt;br /&gt;
2 = quadratic falloff&lt;br /&gt;
&lt;br /&gt;
3 = etc.&lt;br /&gt;
&lt;br /&gt;
The higher the number, the faster the magnitude is decreasing with the distance. The magnitude is reaching zero as soon as the distance of the responding object is greater than or equal to the stim radius, except for falloffexponent = 0 (no falloff). Negative values are allowed as well, this way it should be possible to actually increase the magnitude of a stim with larger distance. Don&#039;t know if that makes sense, though and I haven&#039;t tested it either.&lt;br /&gt;
&lt;br /&gt;
For documentation purposes, this function is used to determine the actual magnitude: &#039;&#039;&#039;m(dist) = m0*[ 1 - dist/radius]^falloffExponent&#039;&#039;&#039; (math functions seem to be disabled for this wiki)&lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_duration_N&#039;&#039;&#039;&lt;br /&gt;
This specifies how long the stim is active before it gets disabled. If this is key is empty, the stim has infinite lifetime (apart from being disabled by scripts and such).&lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_time_interval_N&#039;&#039;&#039;&lt;br /&gt;
When this stim is active, the firings will be spread out by this many milliseconds. So a stim with sr_time_interval = 500 will fire every half second when active. Used for optimization for stims that don&#039;t have to be checked that often.&lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_max_fire_count_N&#039;&#039;&#039; (default: -1)&lt;br /&gt;
This specifies the maximum number of stim firings that are possible for this stim. The default is -1 which means that it can be fired infinitely often. With each firing, the counter is decreased. When it reaches zero, the stim is entirely ignored from then on. Currently there is no way to reactivate a stim whose max_fire_count has been depleted. Stims that fail because of their &#039;&#039;&#039;sr_chance_N&#039;&#039;&#039; spawnarg decrease the counter as well.&lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_timer_time_N&#039;&#039;&#039; (Format: hhhh:mm:ss:ms, for example: 0:3:20:0 which means 3 minutes and 20 secs) &#039;&#039;(s &amp;amp; r editor = Activation Timer.)&#039;&#039;&lt;br /&gt;
This can be used to enable the stim after a certain amount of time. Depending on the &#039;&#039;&#039;sr_timer_waitforstart&#039;&#039;&#039; key the timer is started on spawn or on a &amp;quot;StartTimer&amp;quot; event. Use this to setup a stim that has its &#039;&#039;&#039;sr_state_N&#039;&#039;&#039; set to 0 at start and gets enabled after a certain amount of time. This is only effective if the sr_state is 0 (disabled) by the time this timer is elapsing &#039;&#039;(s &amp;amp; r editor = Active checkbox.)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_timer_waitforstart_N&#039;&#039;&#039; (0 or 1, default is 0)&lt;br /&gt;
If this key is TRUE = &amp;quot;1&amp;quot;, the timer has to be started by a StartTimer script event or the according response effect. If this is set to 0, the timer starts on spawning this entity (beware: the entities might be spawned quite some time before the map is actually started, on my testmap it sometimes took up to 20 seconds before the player is spawned, so this is not a very reliable measure).&lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_timer_type_N&#039;&#039;&#039; | possible values: &amp;quot;RELOAD&amp;quot; or &amp;quot;SINGLESHOT&amp;quot; (default)&lt;br /&gt;
When this is set to RELOAD, the timer is reactivated after the stim has been fired. This can be used to setup sophisticated time intervals. I intend to draw a graph explaining this, so if this is not yet in the wiki, you can bug greebo to do this. :)&lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_bounds_mins_N&#039;&#039;&#039; and &#039;&#039;&#039;sr_bounds_maxs_N&#039;&#039;&#039; (Type: Vector, default is &amp;quot;0 0 0&amp;quot;)&lt;br /&gt;
These two vectors define the bounding box of the stim. This is measured relatively to the stim origin (which might be moving), not the entity origin. A vector pair of &#039;&#039;&#039;-10 -10 -50&#039;&#039;&#039; and &#039;&#039;&#039;10 10 150&#039;&#039;&#039; defines a primarily vertical stim area.&lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_velocity_N&#039;&#039;&#039; (type: Vector, default: &amp;quot;0 0 &amp;quot;)&lt;br /&gt;
This defines the velocity of the stim in units per second. A vector of &#039;&#039;&#039;0 0 -10&#039;&#039;&#039; let&#039;s the stim move downward for 10 units per second for the stim duration time.&lt;br /&gt;
&lt;br /&gt;
== Response only ==&lt;br /&gt;
Key: &#039;&#039;&#039;sr_chance_timeout_N&#039;&#039;&#039;&lt;br /&gt;
Many stims like the water arrow stim are firing rapidly multiple times a second, distorting the &amp;quot;effective&amp;quot; probability of a response going off. Use this to give the response a timeout before it can be evaluated again after a failed probability check.&lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_random_effects_N&#039;&#039;&#039;&lt;br /&gt;
If this spawnarg contains non-zero values, exactly this number of random response effects is chosen from the available ones. So, if you set sr_random_effects to 2 and there are 5 effects available, two are randomly chosen (may also be one of them twice). If only one effect is available, just this one is fired twice.&lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_script_&amp;lt;STIM TYPE&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
First off, the name of this key: &amp;lt;STIM TYPE&amp;gt; should be replaced with the string name of one of the stim types. For example, sr_script_STIM_WATER defines the script to call in respone to a water stim. Apparently there can only be one of these per stim type. &amp;lt;STIM TYPE&amp;gt; can either be the name as a string (in case of default stims) or the number:&lt;br /&gt;
sr_script_STIM_WATER&lt;br /&gt;
sr_script_2&lt;br /&gt;
Both of which will have the same meaning, assuming that the water stim has the number two.&lt;br /&gt;
&lt;br /&gt;
The value this key contains the name of the script function to call. If it&#039;s a local script, you must put it in the form of &amp;quot;&amp;lt;script object name&amp;gt;::&amp;lt;local function&amp;gt;&amp;quot; otherwise &amp;quot;&amp;lt;global function name&amp;gt;&amp;quot; works as well.&lt;br /&gt;
&lt;br /&gt;
Note:  When using the stim/response editor, you must right-click on the Response Effects field in order to enter an effect.  Not sure how anyone would know that.&lt;br /&gt;
&lt;br /&gt;
Also note, responses set on AI persist when the AI goes to ragdoll state.&lt;br /&gt;
&lt;br /&gt;
== Important note about writing response scripts ==&lt;br /&gt;
There&#039;s some subtlety about writing these response scriptfunctions. Global scriptfunctions must take two arguments: an entity argument and int threadnum argument. The first argument is the entity that was stimmed. Local response functions (those on the entity being stimmed) should not have the entity argument, only taking one argument, the threadnum. This is because the entity being stimmed is the same as the entity running the script, so the argument is passed implicitly as the &amp;quot;self&amp;quot; entity, just like the &amp;quot;this&amp;quot; pointer is passed implicitly in C++.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Examples ==&lt;br /&gt;
=== Damage Stim ===&lt;br /&gt;
&lt;br /&gt;
An entity has a STIM_DAMAGE with a magnitude of 100 and a linear falloff (1). The further you&#039;re away from the stim origin, the smaller the magnitude gets.&lt;br /&gt;
&lt;br /&gt;
Once an entity with a response to STIM_DAMAGE comes into range and the stim fires, the magnitude is passed on to the response entity. The response entity needs to have a response effect defined for the DAMAGE stim, which tells the code which damage entityDef (e.g. &#039;&#039;atdm:damage_simple&#039;&#039;) it should use and which entity should be damaged (this should be &#039;&#039;_SELF&#039;&#039; by default).&lt;br /&gt;
&lt;br /&gt;
So, an example response setup can be found on the player:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 // The damage response&lt;br /&gt;
 &amp;quot;sr_class_3&amp;quot; &amp;quot;R&amp;quot;&lt;br /&gt;
 &amp;quot;sr_type_3&amp;quot; &amp;quot;STIM_DAMAGE&amp;quot;&lt;br /&gt;
 &amp;quot;sr_state_3&amp;quot; &amp;quot;1&amp;quot;&lt;br /&gt;
 &amp;quot;sr_effect_3_1&amp;quot; &amp;quot;effect_damage&amp;quot;&lt;br /&gt;
 &amp;quot;sr_effect_3_1_arg1&amp;quot; &amp;quot;_SELF&amp;quot;&lt;br /&gt;
 &amp;quot;sr_effect_3_1_arg2&amp;quot; &amp;quot;atdm:damage_simple&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As soon as the player comes into the range of a damage stim, the distance-based magnitude is passed over and the code multiplies this magnitude with the &amp;quot;damage&amp;quot; value defined in atdm:damage_simple. E.g. if a magnitude of 30 is passed, the atdm:damage_simple&#039;s value of 10 ends up at 300 =&amp;gt; insta-death.&lt;br /&gt;
&lt;br /&gt;
If you want to have a constant magnitude which is not depending on the distance, you need to define a 0 falloff on the stim.&lt;br /&gt;
&lt;br /&gt;
=== Remove torch damage if extinguished with water ===&lt;br /&gt;
If you have hot torches/ovens that damage the player if too close, but shouldn&#039;t if extinguished, first copy the name of the entity that has the damage stim.  Then use the Stim/Response editor to add a Water Response, effect &amp;quot;Deactivate Stim&amp;quot;, pasting/selecting the entity with the damage stim, and &amp;quot;Damage&amp;quot;.  (One would want a Fire Response, &amp;quot;Activate Stim&amp;quot; if they wished damage to return if reignited.)&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
*[[Stim/Response]] overview&lt;br /&gt;
*[[Triggers]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Editing]]&lt;/div&gt;</summary>
		<author><name>Springheel</name></author>
	</entry>
	<entry>
		<id>https://wiki.thedarkmod.com/index.php?title=Stim/Response_Key/Values&amp;diff=20529</id>
		<title>Stim/Response Key/Values</title>
		<link rel="alternate" type="text/html" href="https://wiki.thedarkmod.com/index.php?title=Stim/Response_Key/Values&amp;diff=20529"/>
		<updated>2018-08-07T13:11:11Z</updated>

		<summary type="html">&lt;p&gt;Springheel: /* Stim only */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;Note:&#039;&#039;&#039; &#039;&#039;There is now a stim/response editor accessed via the Dark Radiant entity menu which makes it easier to set these key/values. The editor settings will be shown below next to their equivalent key/values (work in progress.)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I added two new key/vals to stim response, and figured I would document them all here including the new ones.&lt;br /&gt;
&lt;br /&gt;
In all of these, N is the number of the stim on the entity. It starts at 1 and goes up. Be aware of any stims that are defined on the entity in other places, like in the def file or in something inherited by it. Stims on the entity itself must start counting from the last one of these, so if the def file has 1 stim, the entitydef in the map would start at number 2.&lt;br /&gt;
&lt;br /&gt;
== Keys that can be used to set up both stims and responses ==&lt;br /&gt;
Key: &#039;&#039;&#039;sr_class_N&#039;&#039;&#039;&lt;br /&gt;
Set to &amp;quot;S&amp;quot; for stim, &amp;quot;R&amp;quot; for response.&lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_type_N&#039;&#039;&#039;&lt;br /&gt;
Type of stim (e.g. STIM_WATER). See /script/darkmod_stim_response.script for a complete list of stim types.&lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_state_N&#039;&#039;&#039;&lt;br /&gt;
Set to &amp;quot;1&amp;quot; for enabled, &amp;quot;0&amp;quot; for disabled. This may be altered later with scripting.&lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_chance_N&#039;&#039;&#039;&lt;br /&gt;
Probability for this stim/response to fire/react. Set this to 0.3 if you want to have a 30% chance.&lt;br /&gt;
&lt;br /&gt;
== Stim only ==&lt;br /&gt;
Key: &#039;&#039;&#039;sr_use_bounds_N&#039;&#039;&#039;&lt;br /&gt;
Set to &amp;quot;1&amp;quot; if you want to use the bounds of the entity as the basis for the intersection test. &amp;quot;0&amp;quot; (the default) uses a sphere centered on the entity origin.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Springheel:  I cannot confirm this. After a lot of tests, it seems that the game is measuring the distance from the origin of the stim to the bounds of the response.  It looks like the origin of the stim must be [radius + distance] =&amp;gt; 4 in order to avoid stimming the response.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Tests intersection between the physical models of entities A and B, where A carries the stim and B perhaps has a response set. Used for &#039;immersion&#039; in liquids. If A also has a radius set on the stim, the stim can be applied to B when the radius intersects with B&#039;s physical model. &lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_collision_N&#039;&#039;&#039;&lt;br /&gt;
Stim on entity A is applied to entity B when A and B collide.&lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_radius_N&#039;&#039;&#039;&lt;br /&gt;
Radius of the stim in doomunits. NOTE: If you set sr_use_bounds to &amp;quot;1&amp;quot;, the radius is applied as an expansion of the entity bounding box in all directions. So if you select use bounds and set the radius to &amp;quot;0&amp;quot;, this makes the stimmed region exactly equal to the stim bounds.&lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_radius_final_N&#039;&#039;&#039;&lt;br /&gt;
Final radius of the stim (i.e. the radius at the end of its lifetime). While the stim is active, the radius will linearly change within the [sr_radius..sr_radius_final] interval. The start value is defined by sr_radius, the end value by this spawnarg. Note that sr_radius_final is not necessarily larger than the sr_radius value, it&#039;s also possible to let a stim shrink. For this spawnarg to work, the &#039;&#039;&#039;sr_duration&#039;&#039;&#039; value must be greater than zero.&lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_magnitude_N&#039;&#039;&#039; (float)&lt;br /&gt;
The maximum magnitude of the stim at zero distance. If the responding entity&#039;s origin is exactly at the origin of the stimming entity (which is not always possible due to the collision boxes), this magnitude value is passed to the response effect scripts.&lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_falloffexponent_N&#039;&#039;&#039; (float)&lt;br /&gt;
The falloff exponent determining the magnitude in dependency of the distance. There is no limitation to this value, although only a few make sense.&lt;br /&gt;
&lt;br /&gt;
0 = no falloff (magnitude is constantly at maximum value over the whole radius)&lt;br /&gt;
&lt;br /&gt;
1 = linear falloff&lt;br /&gt;
&lt;br /&gt;
2 = quadratic falloff&lt;br /&gt;
&lt;br /&gt;
3 = etc.&lt;br /&gt;
&lt;br /&gt;
The higher the number, the faster the magnitude is decreasing with the distance. The magnitude is reaching zero as soon as the distance of the responding object is greater than or equal to the stim radius, except for falloffexponent = 0 (no falloff). Negative values are allowed as well, this way it should be possible to actually increase the magnitude of a stim with larger distance. Don&#039;t know if that makes sense, though and I haven&#039;t tested it either.&lt;br /&gt;
&lt;br /&gt;
For documentation purposes, this function is used to determine the actual magnitude: &#039;&#039;&#039;m(dist) = m0*[ 1 - dist/radius]^falloffExponent&#039;&#039;&#039; (math functions seem to be disabled for this wiki)&lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_duration_N&#039;&#039;&#039;&lt;br /&gt;
This specifies how long the stim is active before it gets disabled. If this is key is empty, the stim has infinite lifetime (apart from being disabled by scripts and such).&lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_time_interval_N&#039;&#039;&#039;&lt;br /&gt;
When this stim is active, the firings will be spread out by this many milliseconds. So a stim with sr_time_interval = 500 will fire every half second when active. Used for optimization for stims that don&#039;t have to be checked that often.&lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_max_fire_count_N&#039;&#039;&#039; (default: -1)&lt;br /&gt;
This specifies the maximum number of stim firings that are possible for this stim. The default is -1 which means that it can be fired infinitely often. With each firing, the counter is decreased. When it reaches zero, the stim is entirely ignored from then on. Currently there is no way to reactivate a stim whose max_fire_count has been depleted. Stims that fail because of their &#039;&#039;&#039;sr_chance_N&#039;&#039;&#039; spawnarg decrease the counter as well.&lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_timer_time_N&#039;&#039;&#039; (Format: hhhh:mm:ss:ms, for example: 0:3:20:0 which means 3 minutes and 20 secs) &#039;&#039;(s &amp;amp; r editor = Activation Timer.)&#039;&#039;&lt;br /&gt;
This can be used to enable the stim after a certain amount of time. Depending on the &#039;&#039;&#039;sr_timer_waitforstart&#039;&#039;&#039; key the timer is started on spawn or on a &amp;quot;StartTimer&amp;quot; event. Use this to setup a stim that has its &#039;&#039;&#039;sr_state_N&#039;&#039;&#039; set to 0 at start and gets enabled after a certain amount of time. This is only effective if the sr_state is 0 (disabled) by the time this timer is elapsing &#039;&#039;(s &amp;amp; r editor = Active checkbox.)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_timer_waitforstart_N&#039;&#039;&#039; (0 or 1, default is 0)&lt;br /&gt;
If this key is TRUE = &amp;quot;1&amp;quot;, the timer has to be started by a StartTimer script event or the according response effect. If this is set to 0, the timer starts on spawning this entity (beware: the entities might be spawned quite some time before the map is actually started, on my testmap it sometimes took up to 20 seconds before the player is spawned, so this is not a very reliable measure).&lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_timer_type_N&#039;&#039;&#039; | possible values: &amp;quot;RELOAD&amp;quot; or &amp;quot;SINGLESHOT&amp;quot; (default)&lt;br /&gt;
When this is set to RELOAD, the timer is reactivated after the stim has been fired. This can be used to setup sophisticated time intervals. I intend to draw a graph explaining this, so if this is not yet in the wiki, you can bug greebo to do this. :)&lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_bounds_mins_N&#039;&#039;&#039; and &#039;&#039;&#039;sr_bounds_maxs_N&#039;&#039;&#039; (Type: Vector, default is &amp;quot;0 0 0&amp;quot;)&lt;br /&gt;
These two vectors define the bounding box of the stim. This is measured relatively to the stim origin (which might be moving), not the entity origin. A vector pair of &#039;&#039;&#039;-10 -10 -50&#039;&#039;&#039; and &#039;&#039;&#039;10 10 150&#039;&#039;&#039; defines a primarily vertical stim area.&lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_velocity_N&#039;&#039;&#039; (type: Vector, default: &amp;quot;0 0 &amp;quot;)&lt;br /&gt;
This defines the velocity of the stim in units per second. A vector of &#039;&#039;&#039;0 0 -10&#039;&#039;&#039; let&#039;s the stim move downward for 10 units per second for the stim duration time.&lt;br /&gt;
&lt;br /&gt;
== Response only ==&lt;br /&gt;
Key: &#039;&#039;&#039;sr_chance_timeout_N&#039;&#039;&#039;&lt;br /&gt;
Many stims like the water arrow stim are firing rapidly multiple times a second, distorting the &amp;quot;effective&amp;quot; probability of a response going off. Use this to give the response a timeout before it can be evaluated again after a failed probability check.&lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_random_effects_N&#039;&#039;&#039;&lt;br /&gt;
If this spawnarg contains non-zero values, exactly this number of random response effects is chosen from the available ones. So, if you set sr_random_effects to 2 and there are 5 effects available, two are randomly chosen (may also be one of them twice). If only one effect is available, just this one is fired twice.&lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_script_&amp;lt;STIM TYPE&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
First off, the name of this key: &amp;lt;STIM TYPE&amp;gt; should be replaced with the string name of one of the stim types. For example, sr_script_STIM_WATER defines the script to call in respone to a water stim. Apparently there can only be one of these per stim type. &amp;lt;STIM TYPE&amp;gt; can either be the name as a string (in case of default stims) or the number:&lt;br /&gt;
sr_script_STIM_WATER&lt;br /&gt;
sr_script_2&lt;br /&gt;
Both of which will have the same meaning, assuming that the water stim has the number two.&lt;br /&gt;
&lt;br /&gt;
The value this key contains the name of the script function to call. If it&#039;s a local script, you must put it in the form of &amp;quot;&amp;lt;script object name&amp;gt;::&amp;lt;local function&amp;gt;&amp;quot; otherwise &amp;quot;&amp;lt;global function name&amp;gt;&amp;quot; works as well.&lt;br /&gt;
&lt;br /&gt;
Note:  When using the stim/response editor, you must right-click on the Response Effects field in order to enter an effect.  Not sure how anyone would know that.&lt;br /&gt;
&lt;br /&gt;
Also note, responses set on AI persist when the AI goes to ragdoll state.&lt;br /&gt;
&lt;br /&gt;
== Important note about writing response scripts ==&lt;br /&gt;
There&#039;s some subtlety about writing these response scriptfunctions. Global scriptfunctions must take two arguments: an entity argument and int threadnum argument. The first argument is the entity that was stimmed. Local response functions (those on the entity being stimmed) should not have the entity argument, only taking one argument, the threadnum. This is because the entity being stimmed is the same as the entity running the script, so the argument is passed implicitly as the &amp;quot;self&amp;quot; entity, just like the &amp;quot;this&amp;quot; pointer is passed implicitly in C++.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Examples ==&lt;br /&gt;
=== Damage Stim ===&lt;br /&gt;
&lt;br /&gt;
An entity has a STIM_DAMAGE with a magnitude of 100 and a linear falloff (1). The further you&#039;re away from the stim origin, the smaller the magnitude gets.&lt;br /&gt;
&lt;br /&gt;
Once an entity with a response to STIM_DAMAGE comes into range and the stim fires, the magnitude is passed on to the response entity. The response entity needs to have a response effect defined for the DAMAGE stim, which tells the code which damage entityDef (e.g. &#039;&#039;atdm:damage_simple&#039;&#039;) it should use and which entity should be damaged (this should be &#039;&#039;_SELF&#039;&#039; by default).&lt;br /&gt;
&lt;br /&gt;
So, an example response setup can be found on the player:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 // The damage response&lt;br /&gt;
 &amp;quot;sr_class_3&amp;quot; &amp;quot;R&amp;quot;&lt;br /&gt;
 &amp;quot;sr_type_3&amp;quot; &amp;quot;STIM_DAMAGE&amp;quot;&lt;br /&gt;
 &amp;quot;sr_state_3&amp;quot; &amp;quot;1&amp;quot;&lt;br /&gt;
 &amp;quot;sr_effect_3_1&amp;quot; &amp;quot;effect_damage&amp;quot;&lt;br /&gt;
 &amp;quot;sr_effect_3_1_arg1&amp;quot; &amp;quot;_SELF&amp;quot;&lt;br /&gt;
 &amp;quot;sr_effect_3_1_arg2&amp;quot; &amp;quot;atdm:damage_simple&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As soon as the player comes into the range of a damage stim, the distance-based magnitude is passed over and the code multiplies this magnitude with the &amp;quot;damage&amp;quot; value defined in atdm:damage_simple. E.g. if a magnitude of 30 is passed, the atdm:damage_simple&#039;s value of 10 ends up at 300 =&amp;gt; insta-death.&lt;br /&gt;
&lt;br /&gt;
If you want to have a constant magnitude which is not depending on the distance, you need to define a 0 falloff on the stim.&lt;br /&gt;
&lt;br /&gt;
=== Remove torch damage if extinguished with water ===&lt;br /&gt;
If you have hot torches/ovens that damage the player if too close, but shouldn&#039;t if extinguished, first copy the name of the entity that has the damage stim.  Then use the Stim/Response editor to add a Water Response, effect &amp;quot;Deactivate Stim&amp;quot;, pasting/selecting the entity with the damage stim, and &amp;quot;Damage&amp;quot;.  (One would want a Fire Response, &amp;quot;Activate Stim&amp;quot; if they wished damage to return if reignited.)&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
*[[Stim/Response]] overview&lt;br /&gt;
*[[Triggers]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Editing]]&lt;/div&gt;</summary>
		<author><name>Springheel</name></author>
	</entry>
	<entry>
		<id>https://wiki.thedarkmod.com/index.php?title=Stim/Response_Key/Values&amp;diff=20528</id>
		<title>Stim/Response Key/Values</title>
		<link rel="alternate" type="text/html" href="https://wiki.thedarkmod.com/index.php?title=Stim/Response_Key/Values&amp;diff=20528"/>
		<updated>2018-08-07T00:55:08Z</updated>

		<summary type="html">&lt;p&gt;Springheel: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;Note:&#039;&#039;&#039; &#039;&#039;There is now a stim/response editor accessed via the Dark Radiant entity menu which makes it easier to set these key/values. The editor settings will be shown below next to their equivalent key/values (work in progress.)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I added two new key/vals to stim response, and figured I would document them all here including the new ones.&lt;br /&gt;
&lt;br /&gt;
In all of these, N is the number of the stim on the entity. It starts at 1 and goes up. Be aware of any stims that are defined on the entity in other places, like in the def file or in something inherited by it. Stims on the entity itself must start counting from the last one of these, so if the def file has 1 stim, the entitydef in the map would start at number 2.&lt;br /&gt;
&lt;br /&gt;
== Keys that can be used to set up both stims and responses ==&lt;br /&gt;
Key: &#039;&#039;&#039;sr_class_N&#039;&#039;&#039;&lt;br /&gt;
Set to &amp;quot;S&amp;quot; for stim, &amp;quot;R&amp;quot; for response.&lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_type_N&#039;&#039;&#039;&lt;br /&gt;
Type of stim (e.g. STIM_WATER). See /script/darkmod_stim_response.script for a complete list of stim types.&lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_state_N&#039;&#039;&#039;&lt;br /&gt;
Set to &amp;quot;1&amp;quot; for enabled, &amp;quot;0&amp;quot; for disabled. This may be altered later with scripting.&lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_chance_N&#039;&#039;&#039;&lt;br /&gt;
Probability for this stim/response to fire/react. Set this to 0.3 if you want to have a 30% chance.&lt;br /&gt;
&lt;br /&gt;
== Stim only ==&lt;br /&gt;
Key: &#039;&#039;&#039;sr_use_bounds_N&#039;&#039;&#039;&lt;br /&gt;
Set to &amp;quot;1&amp;quot; if you want to use the bounds of the entity as the basis for the intersection test. &amp;quot;0&amp;quot; (the default) uses a sphere centered on the entity origin.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Springheel:  I cannot confirm this. After a lot of tests, it seems that the game is measuring the distance from the origin of the stim to the bounds of the response.  It looks like the origin of the stim must be [radius + distance] =&amp;gt; 5 in order to avoid stimming the response.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Tests intersection between the physical models of entities A and B, where A carries the stim and B perhaps has a response set. Used for &#039;immersion&#039; in liquids. If A also has a radius set on the stim, the stim can be applied to B when the radius intersects with B&#039;s physical model. &lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_collision_N&#039;&#039;&#039;&lt;br /&gt;
Stim on entity A is applied to entity B when A and B collide.&lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_radius_N&#039;&#039;&#039;&lt;br /&gt;
Radius of the stim in doomunits. NOTE: If you set sr_use_bounds to &amp;quot;1&amp;quot;, the radius is applied as an expansion of the entity bounding box in all directions. So if you select use bounds and set the radius to &amp;quot;0&amp;quot;, this makes the stimmed region exactly equal to the stim bounds.&lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_radius_final_N&#039;&#039;&#039;&lt;br /&gt;
Final radius of the stim (i.e. the radius at the end of its lifetime). While the stim is active, the radius will linearly change within the [sr_radius..sr_radius_final] interval. The start value is defined by sr_radius, the end value by this spawnarg. Note that sr_radius_final is not necessarily larger than the sr_radius value, it&#039;s also possible to let a stim shrink. For this spawnarg to work, the &#039;&#039;&#039;sr_duration&#039;&#039;&#039; value must be greater than zero.&lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_magnitude_N&#039;&#039;&#039; (float)&lt;br /&gt;
The maximum magnitude of the stim at zero distance. If the responding entity&#039;s origin is exactly at the origin of the stimming entity (which is not always possible due to the collision boxes), this magnitude value is passed to the response effect scripts.&lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_falloffexponent_N&#039;&#039;&#039; (float)&lt;br /&gt;
The falloff exponent determining the magnitude in dependency of the distance. There is no limitation to this value, although only a few make sense.&lt;br /&gt;
&lt;br /&gt;
0 = no falloff (magnitude is constantly at maximum value over the whole radius)&lt;br /&gt;
&lt;br /&gt;
1 = linear falloff&lt;br /&gt;
&lt;br /&gt;
2 = quadratic falloff&lt;br /&gt;
&lt;br /&gt;
3 = etc.&lt;br /&gt;
&lt;br /&gt;
The higher the number, the faster the magnitude is decreasing with the distance. The magnitude is reaching zero as soon as the distance of the responding object is greater than or equal to the stim radius, except for falloffexponent = 0 (no falloff). Negative values are allowed as well, this way it should be possible to actually increase the magnitude of a stim with larger distance. Don&#039;t know if that makes sense, though and I haven&#039;t tested it either.&lt;br /&gt;
&lt;br /&gt;
For documentation purposes, this function is used to determine the actual magnitude: &#039;&#039;&#039;m(dist) = m0*[ 1 - dist/radius]^falloffExponent&#039;&#039;&#039; (math functions seem to be disabled for this wiki)&lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_duration_N&#039;&#039;&#039;&lt;br /&gt;
This specifies how long the stim is active before it gets disabled. If this is key is empty, the stim has infinite lifetime (apart from being disabled by scripts and such).&lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_time_interval_N&#039;&#039;&#039;&lt;br /&gt;
When this stim is active, the firings will be spread out by this many milliseconds. So a stim with sr_time_interval = 500 will fire every half second when active. Used for optimization for stims that don&#039;t have to be checked that often.&lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_max_fire_count_N&#039;&#039;&#039; (default: -1)&lt;br /&gt;
This specifies the maximum number of stim firings that are possible for this stim. The default is -1 which means that it can be fired infinitely often. With each firing, the counter is decreased. When it reaches zero, the stim is entirely ignored from then on. Currently there is no way to reactivate a stim whose max_fire_count has been depleted. Stims that fail because of their &#039;&#039;&#039;sr_chance_N&#039;&#039;&#039; spawnarg decrease the counter as well.&lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_timer_time_N&#039;&#039;&#039; (Format: hhhh:mm:ss:ms, for example: 0:3:20:0 which means 3 minutes and 20 secs) &#039;&#039;(s &amp;amp; r editor = Activation Timer.)&#039;&#039;&lt;br /&gt;
This can be used to enable the stim after a certain amount of time. Depending on the &#039;&#039;&#039;sr_timer_waitforstart&#039;&#039;&#039; key the timer is started on spawn or on a &amp;quot;StartTimer&amp;quot; event. Use this to setup a stim that has its &#039;&#039;&#039;sr_state_N&#039;&#039;&#039; set to 0 at start and gets enabled after a certain amount of time. This is only effective if the sr_state is 0 (disabled) by the time this timer is elapsing &#039;&#039;(s &amp;amp; r editor = Active checkbox.)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_timer_waitforstart_N&#039;&#039;&#039; (0 or 1, default is 0)&lt;br /&gt;
If this key is TRUE = &amp;quot;1&amp;quot;, the timer has to be started by a StartTimer script event or the according response effect. If this is set to 0, the timer starts on spawning this entity (beware: the entities might be spawned quite some time before the map is actually started, on my testmap it sometimes took up to 20 seconds before the player is spawned, so this is not a very reliable measure).&lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_timer_type_N&#039;&#039;&#039; | possible values: &amp;quot;RELOAD&amp;quot; or &amp;quot;SINGLESHOT&amp;quot; (default)&lt;br /&gt;
When this is set to RELOAD, the timer is reactivated after the stim has been fired. This can be used to setup sophisticated time intervals. I intend to draw a graph explaining this, so if this is not yet in the wiki, you can bug greebo to do this. :)&lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_bounds_mins_N&#039;&#039;&#039; and &#039;&#039;&#039;sr_bounds_maxs_N&#039;&#039;&#039; (Type: Vector, default is &amp;quot;0 0 0&amp;quot;)&lt;br /&gt;
These two vectors define the bounding box of the stim. This is measured relatively to the stim origin (which might be moving), not the entity origin. A vector pair of &#039;&#039;&#039;-10 -10 -50&#039;&#039;&#039; and &#039;&#039;&#039;10 10 150&#039;&#039;&#039; defines a primarily vertical stim area.&lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_velocity_N&#039;&#039;&#039; (type: Vector, default: &amp;quot;0 0 &amp;quot;)&lt;br /&gt;
This defines the velocity of the stim in units per second. A vector of &#039;&#039;&#039;0 0 -10&#039;&#039;&#039; let&#039;s the stim move downward for 10 units per second for the stim duration time.&lt;br /&gt;
&lt;br /&gt;
== Response only ==&lt;br /&gt;
Key: &#039;&#039;&#039;sr_chance_timeout_N&#039;&#039;&#039;&lt;br /&gt;
Many stims like the water arrow stim are firing rapidly multiple times a second, distorting the &amp;quot;effective&amp;quot; probability of a response going off. Use this to give the response a timeout before it can be evaluated again after a failed probability check.&lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_random_effects_N&#039;&#039;&#039;&lt;br /&gt;
If this spawnarg contains non-zero values, exactly this number of random response effects is chosen from the available ones. So, if you set sr_random_effects to 2 and there are 5 effects available, two are randomly chosen (may also be one of them twice). If only one effect is available, just this one is fired twice.&lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_script_&amp;lt;STIM TYPE&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
First off, the name of this key: &amp;lt;STIM TYPE&amp;gt; should be replaced with the string name of one of the stim types. For example, sr_script_STIM_WATER defines the script to call in respone to a water stim. Apparently there can only be one of these per stim type. &amp;lt;STIM TYPE&amp;gt; can either be the name as a string (in case of default stims) or the number:&lt;br /&gt;
sr_script_STIM_WATER&lt;br /&gt;
sr_script_2&lt;br /&gt;
Both of which will have the same meaning, assuming that the water stim has the number two.&lt;br /&gt;
&lt;br /&gt;
The value this key contains the name of the script function to call. If it&#039;s a local script, you must put it in the form of &amp;quot;&amp;lt;script object name&amp;gt;::&amp;lt;local function&amp;gt;&amp;quot; otherwise &amp;quot;&amp;lt;global function name&amp;gt;&amp;quot; works as well.&lt;br /&gt;
&lt;br /&gt;
Note:  When using the stim/response editor, you must right-click on the Response Effects field in order to enter an effect.  Not sure how anyone would know that.&lt;br /&gt;
&lt;br /&gt;
Also note, responses set on AI persist when the AI goes to ragdoll state.&lt;br /&gt;
&lt;br /&gt;
== Important note about writing response scripts ==&lt;br /&gt;
There&#039;s some subtlety about writing these response scriptfunctions. Global scriptfunctions must take two arguments: an entity argument and int threadnum argument. The first argument is the entity that was stimmed. Local response functions (those on the entity being stimmed) should not have the entity argument, only taking one argument, the threadnum. This is because the entity being stimmed is the same as the entity running the script, so the argument is passed implicitly as the &amp;quot;self&amp;quot; entity, just like the &amp;quot;this&amp;quot; pointer is passed implicitly in C++.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Examples ==&lt;br /&gt;
=== Damage Stim ===&lt;br /&gt;
&lt;br /&gt;
An entity has a STIM_DAMAGE with a magnitude of 100 and a linear falloff (1). The further you&#039;re away from the stim origin, the smaller the magnitude gets.&lt;br /&gt;
&lt;br /&gt;
Once an entity with a response to STIM_DAMAGE comes into range and the stim fires, the magnitude is passed on to the response entity. The response entity needs to have a response effect defined for the DAMAGE stim, which tells the code which damage entityDef (e.g. &#039;&#039;atdm:damage_simple&#039;&#039;) it should use and which entity should be damaged (this should be &#039;&#039;_SELF&#039;&#039; by default).&lt;br /&gt;
&lt;br /&gt;
So, an example response setup can be found on the player:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 // The damage response&lt;br /&gt;
 &amp;quot;sr_class_3&amp;quot; &amp;quot;R&amp;quot;&lt;br /&gt;
 &amp;quot;sr_type_3&amp;quot; &amp;quot;STIM_DAMAGE&amp;quot;&lt;br /&gt;
 &amp;quot;sr_state_3&amp;quot; &amp;quot;1&amp;quot;&lt;br /&gt;
 &amp;quot;sr_effect_3_1&amp;quot; &amp;quot;effect_damage&amp;quot;&lt;br /&gt;
 &amp;quot;sr_effect_3_1_arg1&amp;quot; &amp;quot;_SELF&amp;quot;&lt;br /&gt;
 &amp;quot;sr_effect_3_1_arg2&amp;quot; &amp;quot;atdm:damage_simple&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As soon as the player comes into the range of a damage stim, the distance-based magnitude is passed over and the code multiplies this magnitude with the &amp;quot;damage&amp;quot; value defined in atdm:damage_simple. E.g. if a magnitude of 30 is passed, the atdm:damage_simple&#039;s value of 10 ends up at 300 =&amp;gt; insta-death.&lt;br /&gt;
&lt;br /&gt;
If you want to have a constant magnitude which is not depending on the distance, you need to define a 0 falloff on the stim.&lt;br /&gt;
&lt;br /&gt;
=== Remove torch damage if extinguished with water ===&lt;br /&gt;
If you have hot torches/ovens that damage the player if too close, but shouldn&#039;t if extinguished, first copy the name of the entity that has the damage stim.  Then use the Stim/Response editor to add a Water Response, effect &amp;quot;Deactivate Stim&amp;quot;, pasting/selecting the entity with the damage stim, and &amp;quot;Damage&amp;quot;.  (One would want a Fire Response, &amp;quot;Activate Stim&amp;quot; if they wished damage to return if reignited.)&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
*[[Stim/Response]] overview&lt;br /&gt;
*[[Triggers]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Editing]]&lt;/div&gt;</summary>
		<author><name>Springheel</name></author>
	</entry>
	<entry>
		<id>https://wiki.thedarkmod.com/index.php?title=Stim/Response_Key/Values&amp;diff=20527</id>
		<title>Stim/Response Key/Values</title>
		<link rel="alternate" type="text/html" href="https://wiki.thedarkmod.com/index.php?title=Stim/Response_Key/Values&amp;diff=20527"/>
		<updated>2018-08-07T00:48:25Z</updated>

		<summary type="html">&lt;p&gt;Springheel: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;Note:&#039;&#039;&#039; &#039;&#039;There is now a stim/response editor accessed via the Dark Radiant entity menu which makes it easier to set these key/values. The editor settings will be shown below next to their equivalent key/values (work in progress.)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I added two new key/vals to stim response, and figured I would document them all here including the new ones.&lt;br /&gt;
&lt;br /&gt;
In all of these, N is the number of the stim on the entity. It starts at 1 and goes up. Be aware of any stims that are defined on the entity in other places, like in the def file or in something inherited by it. Stims on the entity itself must start counting from the last one of these, so if the def file has 1 stim, the entitydef in the map would start at number 2.&lt;br /&gt;
&lt;br /&gt;
== Keys that can be used to set up both stims and responses ==&lt;br /&gt;
Key: &#039;&#039;&#039;sr_class_N&#039;&#039;&#039;&lt;br /&gt;
Set to &amp;quot;S&amp;quot; for stim, &amp;quot;R&amp;quot; for response.&lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_type_N&#039;&#039;&#039;&lt;br /&gt;
Type of stim (e.g. STIM_WATER). See /script/darkmod_stim_response.script for a complete list of stim types.&lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_state_N&#039;&#039;&#039;&lt;br /&gt;
Set to &amp;quot;1&amp;quot; for enabled, &amp;quot;0&amp;quot; for disabled. This may be altered later with scripting.&lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_chance_N&#039;&#039;&#039;&lt;br /&gt;
Probability for this stim/response to fire/react. Set this to 0.3 if you want to have a 30% chance.&lt;br /&gt;
&lt;br /&gt;
== Stim only ==&lt;br /&gt;
Key: &#039;&#039;&#039;sr_use_bounds_N&#039;&#039;&#039;&lt;br /&gt;
Set to &amp;quot;1&amp;quot; if you want to use the bounds of the entity as the basis for the intersection test. &amp;quot;0&amp;quot; (the default) uses a sphere centered on the entity origin.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Springheel:  I cannot confirm this. After a lot of tests, it seems that the game is measuring the distance from the origin of the stim to the bounds of the response.  It looks like the origin of the stim must be [radius + 5] =&amp;gt; 5 in order to avoid stimming the response.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Tests intersection between the physical models of entities A and B, where A carries the stim and B perhaps has a response set. Used for &#039;immersion&#039; in liquids. If A also has a radius set on the stim, the stim can be applied to B when the radius intersects with B&#039;s physical model. &lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_collision_N&#039;&#039;&#039;&lt;br /&gt;
Stim on entity A is applied to entity B when A and B collide.&lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_radius_N&#039;&#039;&#039;&lt;br /&gt;
Radius of the stim in doomunits. NOTE: If you set sr_use_bounds to &amp;quot;1&amp;quot;, the radius is applied as an expansion of the entity bounding box in all directions. So if you select use bounds and set the radius to &amp;quot;0&amp;quot;, this makes the stimmed region exactly equal to the stim bounds.&lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_radius_final_N&#039;&#039;&#039;&lt;br /&gt;
Final radius of the stim (i.e. the radius at the end of its lifetime). While the stim is active, the radius will linearly change within the [sr_radius..sr_radius_final] interval. The start value is defined by sr_radius, the end value by this spawnarg. Note that sr_radius_final is not necessarily larger than the sr_radius value, it&#039;s also possible to let a stim shrink. For this spawnarg to work, the &#039;&#039;&#039;sr_duration&#039;&#039;&#039; value must be greater than zero.&lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_magnitude_N&#039;&#039;&#039; (float)&lt;br /&gt;
The maximum magnitude of the stim at zero distance. If the responding entity&#039;s origin is exactly at the origin of the stimming entity (which is not always possible due to the collision boxes), this magnitude value is passed to the response effect scripts.&lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_falloffexponent_N&#039;&#039;&#039; (float)&lt;br /&gt;
The falloff exponent determining the magnitude in dependency of the distance. There is no limitation to this value, although only a few make sense.&lt;br /&gt;
&lt;br /&gt;
0 = no falloff (magnitude is constantly at maximum value over the whole radius)&lt;br /&gt;
&lt;br /&gt;
1 = linear falloff&lt;br /&gt;
&lt;br /&gt;
2 = quadratic falloff&lt;br /&gt;
&lt;br /&gt;
3 = etc.&lt;br /&gt;
&lt;br /&gt;
The higher the number, the faster the magnitude is decreasing with the distance. The magnitude is reaching zero as soon as the distance of the responding object is greater than or equal to the stim radius, except for falloffexponent = 0 (no falloff). Negative values are allowed as well, this way it should be possible to actually increase the magnitude of a stim with larger distance. Don&#039;t know if that makes sense, though and I haven&#039;t tested it either.&lt;br /&gt;
&lt;br /&gt;
For documentation purposes, this function is used to determine the actual magnitude: &#039;&#039;&#039;m(dist) = m0*[ 1 - dist/radius]^falloffExponent&#039;&#039;&#039; (math functions seem to be disabled for this wiki)&lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_duration_N&#039;&#039;&#039;&lt;br /&gt;
This specifies how long the stim is active before it gets disabled. If this is key is empty, the stim has infinite lifetime (apart from being disabled by scripts and such).&lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_time_interval_N&#039;&#039;&#039;&lt;br /&gt;
When this stim is active, the firings will be spread out by this many milliseconds. So a stim with sr_time_interval = 500 will fire every half second when active. Used for optimization for stims that don&#039;t have to be checked that often.&lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_max_fire_count_N&#039;&#039;&#039; (default: -1)&lt;br /&gt;
This specifies the maximum number of stim firings that are possible for this stim. The default is -1 which means that it can be fired infinitely often. With each firing, the counter is decreased. When it reaches zero, the stim is entirely ignored from then on. Currently there is no way to reactivate a stim whose max_fire_count has been depleted. Stims that fail because of their &#039;&#039;&#039;sr_chance_N&#039;&#039;&#039; spawnarg decrease the counter as well.&lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_timer_time_N&#039;&#039;&#039; (Format: hhhh:mm:ss:ms, for example: 0:3:20:0 which means 3 minutes and 20 secs) &#039;&#039;(s &amp;amp; r editor = Activation Timer.)&#039;&#039;&lt;br /&gt;
This can be used to enable the stim after a certain amount of time. Depending on the &#039;&#039;&#039;sr_timer_waitforstart&#039;&#039;&#039; key the timer is started on spawn or on a &amp;quot;StartTimer&amp;quot; event. Use this to setup a stim that has its &#039;&#039;&#039;sr_state_N&#039;&#039;&#039; set to 0 at start and gets enabled after a certain amount of time. This is only effective if the sr_state is 0 (disabled) by the time this timer is elapsing &#039;&#039;(s &amp;amp; r editor = Active checkbox.)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_timer_waitforstart_N&#039;&#039;&#039; (0 or 1, default is 0)&lt;br /&gt;
If this key is TRUE = &amp;quot;1&amp;quot;, the timer has to be started by a StartTimer script event or the according response effect. If this is set to 0, the timer starts on spawning this entity (beware: the entities might be spawned quite some time before the map is actually started, on my testmap it sometimes took up to 20 seconds before the player is spawned, so this is not a very reliable measure).&lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_timer_type_N&#039;&#039;&#039; | possible values: &amp;quot;RELOAD&amp;quot; or &amp;quot;SINGLESHOT&amp;quot; (default)&lt;br /&gt;
When this is set to RELOAD, the timer is reactivated after the stim has been fired. This can be used to setup sophisticated time intervals. I intend to draw a graph explaining this, so if this is not yet in the wiki, you can bug greebo to do this. :)&lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_bounds_mins_N&#039;&#039;&#039; and &#039;&#039;&#039;sr_bounds_maxs_N&#039;&#039;&#039; (Type: Vector, default is &amp;quot;0 0 0&amp;quot;)&lt;br /&gt;
These two vectors define the bounding box of the stim. This is measured relatively to the stim origin (which might be moving), not the entity origin. A vector pair of &#039;&#039;&#039;-10 -10 -50&#039;&#039;&#039; and &#039;&#039;&#039;10 10 150&#039;&#039;&#039; defines a primarily vertical stim area.&lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_velocity_N&#039;&#039;&#039; (type: Vector, default: &amp;quot;0 0 &amp;quot;)&lt;br /&gt;
This defines the velocity of the stim in units per second. A vector of &#039;&#039;&#039;0 0 -10&#039;&#039;&#039; let&#039;s the stim move downward for 10 units per second for the stim duration time.&lt;br /&gt;
&lt;br /&gt;
== Response only ==&lt;br /&gt;
Key: &#039;&#039;&#039;sr_chance_timeout_N&#039;&#039;&#039;&lt;br /&gt;
Many stims like the water arrow stim are firing rapidly multiple times a second, distorting the &amp;quot;effective&amp;quot; probability of a response going off. Use this to give the response a timeout before it can be evaluated again after a failed probability check.&lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_random_effects_N&#039;&#039;&#039;&lt;br /&gt;
If this spawnarg contains non-zero values, exactly this number of random response effects is chosen from the available ones. So, if you set sr_random_effects to 2 and there are 5 effects available, two are randomly chosen (may also be one of them twice). If only one effect is available, just this one is fired twice.&lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_script_&amp;lt;STIM TYPE&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
First off, the name of this key: &amp;lt;STIM TYPE&amp;gt; should be replaced with the string name of one of the stim types. For example, sr_script_STIM_WATER defines the script to call in respone to a water stim. Apparently there can only be one of these per stim type. &amp;lt;STIM TYPE&amp;gt; can either be the name as a string (in case of default stims) or the number:&lt;br /&gt;
sr_script_STIM_WATER&lt;br /&gt;
sr_script_2&lt;br /&gt;
Both of which will have the same meaning, assuming that the water stim has the number two.&lt;br /&gt;
&lt;br /&gt;
The value this key contains the name of the script function to call. If it&#039;s a local script, you must put it in the form of &amp;quot;&amp;lt;script object name&amp;gt;::&amp;lt;local function&amp;gt;&amp;quot; otherwise &amp;quot;&amp;lt;global function name&amp;gt;&amp;quot; works as well.&lt;br /&gt;
&lt;br /&gt;
Note:  When using the stim/response editor, you must right-click on the Response Effects field in order to enter an effect.  Not sure how anyone would know that.&lt;br /&gt;
&lt;br /&gt;
Also note, responses set on AI persist when the AI goes to ragdoll state.&lt;br /&gt;
&lt;br /&gt;
== Important note about writing response scripts ==&lt;br /&gt;
There&#039;s some subtlety about writing these response scriptfunctions. Global scriptfunctions must take two arguments: an entity argument and int threadnum argument. The first argument is the entity that was stimmed. Local response functions (those on the entity being stimmed) should not have the entity argument, only taking one argument, the threadnum. This is because the entity being stimmed is the same as the entity running the script, so the argument is passed implicitly as the &amp;quot;self&amp;quot; entity, just like the &amp;quot;this&amp;quot; pointer is passed implicitly in C++.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Examples ==&lt;br /&gt;
=== Damage Stim ===&lt;br /&gt;
&lt;br /&gt;
An entity has a STIM_DAMAGE with a magnitude of 100 and a linear falloff (1). The further you&#039;re away from the stim origin, the smaller the magnitude gets.&lt;br /&gt;
&lt;br /&gt;
Once an entity with a response to STIM_DAMAGE comes into range and the stim fires, the magnitude is passed on to the response entity. The response entity needs to have a response effect defined for the DAMAGE stim, which tells the code which damage entityDef (e.g. &#039;&#039;atdm:damage_simple&#039;&#039;) it should use and which entity should be damaged (this should be &#039;&#039;_SELF&#039;&#039; by default).&lt;br /&gt;
&lt;br /&gt;
So, an example response setup can be found on the player:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 // The damage response&lt;br /&gt;
 &amp;quot;sr_class_3&amp;quot; &amp;quot;R&amp;quot;&lt;br /&gt;
 &amp;quot;sr_type_3&amp;quot; &amp;quot;STIM_DAMAGE&amp;quot;&lt;br /&gt;
 &amp;quot;sr_state_3&amp;quot; &amp;quot;1&amp;quot;&lt;br /&gt;
 &amp;quot;sr_effect_3_1&amp;quot; &amp;quot;effect_damage&amp;quot;&lt;br /&gt;
 &amp;quot;sr_effect_3_1_arg1&amp;quot; &amp;quot;_SELF&amp;quot;&lt;br /&gt;
 &amp;quot;sr_effect_3_1_arg2&amp;quot; &amp;quot;atdm:damage_simple&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As soon as the player comes into the range of a damage stim, the distance-based magnitude is passed over and the code multiplies this magnitude with the &amp;quot;damage&amp;quot; value defined in atdm:damage_simple. E.g. if a magnitude of 30 is passed, the atdm:damage_simple&#039;s value of 10 ends up at 300 =&amp;gt; insta-death.&lt;br /&gt;
&lt;br /&gt;
If you want to have a constant magnitude which is not depending on the distance, you need to define a 0 falloff on the stim.&lt;br /&gt;
&lt;br /&gt;
=== Remove torch damage if extinguished with water ===&lt;br /&gt;
If you have hot torches/ovens that damage the player if too close, but shouldn&#039;t if extinguished, first copy the name of the entity that has the damage stim.  Then use the Stim/Response editor to add a Water Response, effect &amp;quot;Deactivate Stim&amp;quot;, pasting/selecting the entity with the damage stim, and &amp;quot;Damage&amp;quot;.  (One would want a Fire Response, &amp;quot;Activate Stim&amp;quot; if they wished damage to return if reignited.)&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
*[[Stim/Response]] overview&lt;br /&gt;
*[[Triggers]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Editing]]&lt;/div&gt;</summary>
		<author><name>Springheel</name></author>
	</entry>
	<entry>
		<id>https://wiki.thedarkmod.com/index.php?title=Stim/Response_Key/Values&amp;diff=20526</id>
		<title>Stim/Response Key/Values</title>
		<link rel="alternate" type="text/html" href="https://wiki.thedarkmod.com/index.php?title=Stim/Response_Key/Values&amp;diff=20526"/>
		<updated>2018-08-07T00:47:37Z</updated>

		<summary type="html">&lt;p&gt;Springheel: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;Note:&#039;&#039;&#039; &#039;&#039;There is now a stim/response editor accessed via the Dark Radiant entity menu which makes it easier to set these key/values. The editor settings will be shown below next to their equivalent key/values (work in progress.)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I added two new key/vals to stim response, and figured I would document them all here including the new ones.&lt;br /&gt;
&lt;br /&gt;
In all of these, N is the number of the stim on the entity. It starts at 1 and goes up. Be aware of any stims that are defined on the entity in other places, like in the def file or in something inherited by it. Stims on the entity itself must start counting from the last one of these, so if the def file has 1 stim, the entitydef in the map would start at number 2.&lt;br /&gt;
&lt;br /&gt;
== Keys that can be used to set up both stims and responses ==&lt;br /&gt;
Key: &#039;&#039;&#039;sr_class_N&#039;&#039;&#039;&lt;br /&gt;
Set to &amp;quot;S&amp;quot; for stim, &amp;quot;R&amp;quot; for response.&lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_type_N&#039;&#039;&#039;&lt;br /&gt;
Type of stim (e.g. STIM_WATER). See /script/darkmod_stim_response.script for a complete list of stim types.&lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_state_N&#039;&#039;&#039;&lt;br /&gt;
Set to &amp;quot;1&amp;quot; for enabled, &amp;quot;0&amp;quot; for disabled. This may be altered later with scripting.&lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_chance_N&#039;&#039;&#039;&lt;br /&gt;
Probability for this stim/response to fire/react. Set this to 0.3 if you want to have a 30% chance.&lt;br /&gt;
&lt;br /&gt;
== Stim only ==&lt;br /&gt;
Key: &#039;&#039;&#039;sr_use_bounds_N&#039;&#039;&#039;&lt;br /&gt;
Set to &amp;quot;1&amp;quot; if you want to use the bounds of the entity as the basis for the intersection test. &amp;quot;0&amp;quot; (the default) uses a sphere centered on the entity origin.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Springheel:  I cannot confirm this. After a lot of tests, it seems that the game is measuring the distance from the origin of the stim to the bounds of the response.  It looks like the origin of the stim must be [radius + 5] =&amp;lt; 5 in order to avoid stimming the response.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Tests intersection between the physical models of entities A and B, where A carries the stim and B perhaps has a response set. Used for &#039;immersion&#039; in liquids. If A also has a radius set on the stim, the stim can be applied to B when the radius intersects with B&#039;s physical model. &lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_collision_N&#039;&#039;&#039;&lt;br /&gt;
Stim on entity A is applied to entity B when A and B collide.&lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_radius_N&#039;&#039;&#039;&lt;br /&gt;
Radius of the stim in doomunits. NOTE: If you set sr_use_bounds to &amp;quot;1&amp;quot;, the radius is applied as an expansion of the entity bounding box in all directions. So if you select use bounds and set the radius to &amp;quot;0&amp;quot;, this makes the stimmed region exactly equal to the stim bounds.&lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_radius_final_N&#039;&#039;&#039;&lt;br /&gt;
Final radius of the stim (i.e. the radius at the end of its lifetime). While the stim is active, the radius will linearly change within the [sr_radius..sr_radius_final] interval. The start value is defined by sr_radius, the end value by this spawnarg. Note that sr_radius_final is not necessarily larger than the sr_radius value, it&#039;s also possible to let a stim shrink. For this spawnarg to work, the &#039;&#039;&#039;sr_duration&#039;&#039;&#039; value must be greater than zero.&lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_magnitude_N&#039;&#039;&#039; (float)&lt;br /&gt;
The maximum magnitude of the stim at zero distance. If the responding entity&#039;s origin is exactly at the origin of the stimming entity (which is not always possible due to the collision boxes), this magnitude value is passed to the response effect scripts.&lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_falloffexponent_N&#039;&#039;&#039; (float)&lt;br /&gt;
The falloff exponent determining the magnitude in dependency of the distance. There is no limitation to this value, although only a few make sense.&lt;br /&gt;
&lt;br /&gt;
0 = no falloff (magnitude is constantly at maximum value over the whole radius)&lt;br /&gt;
&lt;br /&gt;
1 = linear falloff&lt;br /&gt;
&lt;br /&gt;
2 = quadratic falloff&lt;br /&gt;
&lt;br /&gt;
3 = etc.&lt;br /&gt;
&lt;br /&gt;
The higher the number, the faster the magnitude is decreasing with the distance. The magnitude is reaching zero as soon as the distance of the responding object is greater than or equal to the stim radius, except for falloffexponent = 0 (no falloff). Negative values are allowed as well, this way it should be possible to actually increase the magnitude of a stim with larger distance. Don&#039;t know if that makes sense, though and I haven&#039;t tested it either.&lt;br /&gt;
&lt;br /&gt;
For documentation purposes, this function is used to determine the actual magnitude: &#039;&#039;&#039;m(dist) = m0*[ 1 - dist/radius]^falloffExponent&#039;&#039;&#039; (math functions seem to be disabled for this wiki)&lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_duration_N&#039;&#039;&#039;&lt;br /&gt;
This specifies how long the stim is active before it gets disabled. If this is key is empty, the stim has infinite lifetime (apart from being disabled by scripts and such).&lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_time_interval_N&#039;&#039;&#039;&lt;br /&gt;
When this stim is active, the firings will be spread out by this many milliseconds. So a stim with sr_time_interval = 500 will fire every half second when active. Used for optimization for stims that don&#039;t have to be checked that often.&lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_max_fire_count_N&#039;&#039;&#039; (default: -1)&lt;br /&gt;
This specifies the maximum number of stim firings that are possible for this stim. The default is -1 which means that it can be fired infinitely often. With each firing, the counter is decreased. When it reaches zero, the stim is entirely ignored from then on. Currently there is no way to reactivate a stim whose max_fire_count has been depleted. Stims that fail because of their &#039;&#039;&#039;sr_chance_N&#039;&#039;&#039; spawnarg decrease the counter as well.&lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_timer_time_N&#039;&#039;&#039; (Format: hhhh:mm:ss:ms, for example: 0:3:20:0 which means 3 minutes and 20 secs) &#039;&#039;(s &amp;amp; r editor = Activation Timer.)&#039;&#039;&lt;br /&gt;
This can be used to enable the stim after a certain amount of time. Depending on the &#039;&#039;&#039;sr_timer_waitforstart&#039;&#039;&#039; key the timer is started on spawn or on a &amp;quot;StartTimer&amp;quot; event. Use this to setup a stim that has its &#039;&#039;&#039;sr_state_N&#039;&#039;&#039; set to 0 at start and gets enabled after a certain amount of time. This is only effective if the sr_state is 0 (disabled) by the time this timer is elapsing &#039;&#039;(s &amp;amp; r editor = Active checkbox.)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_timer_waitforstart_N&#039;&#039;&#039; (0 or 1, default is 0)&lt;br /&gt;
If this key is TRUE = &amp;quot;1&amp;quot;, the timer has to be started by a StartTimer script event or the according response effect. If this is set to 0, the timer starts on spawning this entity (beware: the entities might be spawned quite some time before the map is actually started, on my testmap it sometimes took up to 20 seconds before the player is spawned, so this is not a very reliable measure).&lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_timer_type_N&#039;&#039;&#039; | possible values: &amp;quot;RELOAD&amp;quot; or &amp;quot;SINGLESHOT&amp;quot; (default)&lt;br /&gt;
When this is set to RELOAD, the timer is reactivated after the stim has been fired. This can be used to setup sophisticated time intervals. I intend to draw a graph explaining this, so if this is not yet in the wiki, you can bug greebo to do this. :)&lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_bounds_mins_N&#039;&#039;&#039; and &#039;&#039;&#039;sr_bounds_maxs_N&#039;&#039;&#039; (Type: Vector, default is &amp;quot;0 0 0&amp;quot;)&lt;br /&gt;
These two vectors define the bounding box of the stim. This is measured relatively to the stim origin (which might be moving), not the entity origin. A vector pair of &#039;&#039;&#039;-10 -10 -50&#039;&#039;&#039; and &#039;&#039;&#039;10 10 150&#039;&#039;&#039; defines a primarily vertical stim area.&lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_velocity_N&#039;&#039;&#039; (type: Vector, default: &amp;quot;0 0 &amp;quot;)&lt;br /&gt;
This defines the velocity of the stim in units per second. A vector of &#039;&#039;&#039;0 0 -10&#039;&#039;&#039; let&#039;s the stim move downward for 10 units per second for the stim duration time.&lt;br /&gt;
&lt;br /&gt;
== Response only ==&lt;br /&gt;
Key: &#039;&#039;&#039;sr_chance_timeout_N&#039;&#039;&#039;&lt;br /&gt;
Many stims like the water arrow stim are firing rapidly multiple times a second, distorting the &amp;quot;effective&amp;quot; probability of a response going off. Use this to give the response a timeout before it can be evaluated again after a failed probability check.&lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_random_effects_N&#039;&#039;&#039;&lt;br /&gt;
If this spawnarg contains non-zero values, exactly this number of random response effects is chosen from the available ones. So, if you set sr_random_effects to 2 and there are 5 effects available, two are randomly chosen (may also be one of them twice). If only one effect is available, just this one is fired twice.&lt;br /&gt;
&lt;br /&gt;
Key: &#039;&#039;&#039;sr_script_&amp;lt;STIM TYPE&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
First off, the name of this key: &amp;lt;STIM TYPE&amp;gt; should be replaced with the string name of one of the stim types. For example, sr_script_STIM_WATER defines the script to call in respone to a water stim. Apparently there can only be one of these per stim type. &amp;lt;STIM TYPE&amp;gt; can either be the name as a string (in case of default stims) or the number:&lt;br /&gt;
sr_script_STIM_WATER&lt;br /&gt;
sr_script_2&lt;br /&gt;
Both of which will have the same meaning, assuming that the water stim has the number two.&lt;br /&gt;
&lt;br /&gt;
The value this key contains the name of the script function to call. If it&#039;s a local script, you must put it in the form of &amp;quot;&amp;lt;script object name&amp;gt;::&amp;lt;local function&amp;gt;&amp;quot; otherwise &amp;quot;&amp;lt;global function name&amp;gt;&amp;quot; works as well.&lt;br /&gt;
&lt;br /&gt;
Note:  When using the stim/response editor, you must right-click on the Response Effects field in order to enter an effect.  Not sure how anyone would know that.&lt;br /&gt;
&lt;br /&gt;
Also note, responses set on AI persist when the AI goes to ragdoll state.&lt;br /&gt;
&lt;br /&gt;
== Important note about writing response scripts ==&lt;br /&gt;
There&#039;s some subtlety about writing these response scriptfunctions. Global scriptfunctions must take two arguments: an entity argument and int threadnum argument. The first argument is the entity that was stimmed. Local response functions (those on the entity being stimmed) should not have the entity argument, only taking one argument, the threadnum. This is because the entity being stimmed is the same as the entity running the script, so the argument is passed implicitly as the &amp;quot;self&amp;quot; entity, just like the &amp;quot;this&amp;quot; pointer is passed implicitly in C++.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Examples ==&lt;br /&gt;
=== Damage Stim ===&lt;br /&gt;
&lt;br /&gt;
An entity has a STIM_DAMAGE with a magnitude of 100 and a linear falloff (1). The further you&#039;re away from the stim origin, the smaller the magnitude gets.&lt;br /&gt;
&lt;br /&gt;
Once an entity with a response to STIM_DAMAGE comes into range and the stim fires, the magnitude is passed on to the response entity. The response entity needs to have a response effect defined for the DAMAGE stim, which tells the code which damage entityDef (e.g. &#039;&#039;atdm:damage_simple&#039;&#039;) it should use and which entity should be damaged (this should be &#039;&#039;_SELF&#039;&#039; by default).&lt;br /&gt;
&lt;br /&gt;
So, an example response setup can be found on the player:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 // The damage response&lt;br /&gt;
 &amp;quot;sr_class_3&amp;quot; &amp;quot;R&amp;quot;&lt;br /&gt;
 &amp;quot;sr_type_3&amp;quot; &amp;quot;STIM_DAMAGE&amp;quot;&lt;br /&gt;
 &amp;quot;sr_state_3&amp;quot; &amp;quot;1&amp;quot;&lt;br /&gt;
 &amp;quot;sr_effect_3_1&amp;quot; &amp;quot;effect_damage&amp;quot;&lt;br /&gt;
 &amp;quot;sr_effect_3_1_arg1&amp;quot; &amp;quot;_SELF&amp;quot;&lt;br /&gt;
 &amp;quot;sr_effect_3_1_arg2&amp;quot; &amp;quot;atdm:damage_simple&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As soon as the player comes into the range of a damage stim, the distance-based magnitude is passed over and the code multiplies this magnitude with the &amp;quot;damage&amp;quot; value defined in atdm:damage_simple. E.g. if a magnitude of 30 is passed, the atdm:damage_simple&#039;s value of 10 ends up at 300 =&amp;gt; insta-death.&lt;br /&gt;
&lt;br /&gt;
If you want to have a constant magnitude which is not depending on the distance, you need to define a 0 falloff on the stim.&lt;br /&gt;
&lt;br /&gt;
=== Remove torch damage if extinguished with water ===&lt;br /&gt;
If you have hot torches/ovens that damage the player if too close, but shouldn&#039;t if extinguished, first copy the name of the entity that has the damage stim.  Then use the Stim/Response editor to add a Water Response, effect &amp;quot;Deactivate Stim&amp;quot;, pasting/selecting the entity with the damage stim, and &amp;quot;Damage&amp;quot;.  (One would want a Fire Response, &amp;quot;Activate Stim&amp;quot; if they wished damage to return if reignited.)&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
*[[Stim/Response]] overview&lt;br /&gt;
*[[Triggers]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Editing]]&lt;/div&gt;</summary>
		<author><name>Springheel</name></author>
	</entry>
	<entry>
		<id>https://wiki.thedarkmod.com/index.php?title=Random_Conversations&amp;diff=20494</id>
		<title>Random Conversations</title>
		<link rel="alternate" type="text/html" href="https://wiki.thedarkmod.com/index.php?title=Random_Conversations&amp;diff=20494"/>
		<updated>2018-07-04T21:43:21Z</updated>

		<summary type="html">&lt;p&gt;Springheel: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;Written by Springheel&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Tired of your AI sitting and staring at each other in silence?  There is a way to make them seem more responsive and alive.&lt;br /&gt;
&lt;br /&gt;
When writing the newer vocal scripts, I included a random sequence of questions and responses that can be used to create generic conversations between AI.  This is separate from the random greetings AI give, which are part of regular AI behaviour.  Random conversations won&#039;t happen by themselves; mappers have to set them up in their map.  The following vocal sets support random conversations (older ones do not):&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
1. vocal set_commander&lt;br /&gt;
&lt;br /&gt;
2. vocal set_jack&lt;br /&gt;
&lt;br /&gt;
3. vocal set_cynic&lt;br /&gt;
&lt;br /&gt;
4. vocal set_drunk&lt;br /&gt;
&lt;br /&gt;
5. vocal set_maiden&lt;br /&gt;
&lt;br /&gt;
6. vocal set_moor&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The sequence goes like this:&lt;br /&gt;
&lt;br /&gt;
AI 1: &amp;quot;convo_question&amp;quot; vocal,  ex, &amp;quot;So, how did the game go last night?&amp;quot;&lt;br /&gt;
&lt;br /&gt;
AI 2: &amp;quot;convo_answer/response&amp;quot; vocal, ex, &amp;quot;Could have been better.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
AI 1: &amp;quot;convo_close&amp;quot; vocal, ex, &amp;quot;Got it.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Each &amp;quot;convo_question&amp;quot; asks for a judgement response.  &amp;quot;How was X?  What did you think of X?&amp;quot; etc.  Each vocal set has four or five questions/answers that are chosen from randomly.  The overall effect is pretty good, I think, though some question/responses combinations make more sense than others.&lt;br /&gt;
&lt;br /&gt;
The sitting AI in Mission 1: A New Job use this system.  Basically, you create the conversation and then decide when and how you want to trigger it.  A trigger_entityname could be used for patrolling AI.  If the AI are sitting near each other, a trigger_sequencer could be used to have multiple conversations over time. In the latter case I would make two conversations to alternate between--one with AI 1 asking the questions, and the other with AI 2 asking the questions.&lt;/div&gt;</summary>
		<author><name>Springheel</name></author>
	</entry>
	<entry>
		<id>https://wiki.thedarkmod.com/index.php?title=Random_Conversations&amp;diff=20493</id>
		<title>Random Conversations</title>
		<link rel="alternate" type="text/html" href="https://wiki.thedarkmod.com/index.php?title=Random_Conversations&amp;diff=20493"/>
		<updated>2018-07-04T21:36:23Z</updated>

		<summary type="html">&lt;p&gt;Springheel: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;Written by Springheel&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
When writing the newer vocal scripts, I thought it might be a good idea to include a random sequence of questions and responses that can be used to create generic conversations between AI, so AI don&#039;t have to sit staring at each other in silence.  The following vocal sets support this (older ones do not):&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
1. vocal set_commander&lt;br /&gt;
&lt;br /&gt;
2. vocal set_jack&lt;br /&gt;
&lt;br /&gt;
3. vocal set_cynic&lt;br /&gt;
&lt;br /&gt;
4. vocal set_drunk&lt;br /&gt;
&lt;br /&gt;
5. vocal set_maiden&lt;br /&gt;
&lt;br /&gt;
6. vocal set_moor&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The sequence goes like this:&lt;br /&gt;
&lt;br /&gt;
AI 1: &amp;quot;convo_question&amp;quot; vocal,  ex, &amp;quot;So, how did the game go last night?&amp;quot;&lt;br /&gt;
&lt;br /&gt;
AI 2: &amp;quot;convo_answer/response&amp;quot; vocal, ex, &amp;quot;Could have been better.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
AI 1: &amp;quot;convo_close&amp;quot; vocal, ex, &amp;quot;Got it.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Each &amp;quot;convo_question&amp;quot; asks for a judgement response.  &amp;quot;How was X?  What did you think of X?&amp;quot; etc.  Each vocal set has four or five questions/answers that are chosen from randomly.  The overall effect is pretty good, I think, though some question/responses combinations make more sense than others.&lt;br /&gt;
&lt;br /&gt;
The sitting AI in Mission 1: A New Job use this system.  Basically, you create the conversation and then decide when and how you want to trigger it.  A trigger_entityname could be used for patrolling AI.  If the AI are sitting near each other, a trigger_sequencer could be used to have multiple conversations over time. In the latter case I would make two conversations to alternate between--one with AI 1 asking the questions, and the other with AI 2 asking the questions.&lt;/div&gt;</summary>
		<author><name>Springheel</name></author>
	</entry>
	<entry>
		<id>https://wiki.thedarkmod.com/index.php?title=Random_Conversations&amp;diff=20492</id>
		<title>Random Conversations</title>
		<link rel="alternate" type="text/html" href="https://wiki.thedarkmod.com/index.php?title=Random_Conversations&amp;diff=20492"/>
		<updated>2018-07-04T21:33:03Z</updated>

		<summary type="html">&lt;p&gt;Springheel: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;Written by Springheel&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
When writing the newer vocal scripts, I came up with the idea of including a random sequence of questions and responses that can be used to create generic conversations between AI, so AI don&#039;t have to sit staring at each other in silence.  The following vocal sets support this (older ones do not):&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
1. vocal set_commander&lt;br /&gt;
&lt;br /&gt;
2. vocal set_jack&lt;br /&gt;
&lt;br /&gt;
3. vocal set_cynic&lt;br /&gt;
&lt;br /&gt;
4. vocal set_drunk&lt;br /&gt;
&lt;br /&gt;
5. vocal set_maiden&lt;br /&gt;
&lt;br /&gt;
6. vocal set_moor&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The sequence goes like this:&lt;br /&gt;
&lt;br /&gt;
AI 1: &amp;quot;convo_question&amp;quot; vocal,  ex, &amp;quot;So, how did the game go last night?&amp;quot;&lt;br /&gt;
&lt;br /&gt;
AI 2: &amp;quot;convo_answer/response&amp;quot; vocal, ex, &amp;quot;Could have been better.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
AI 1: &amp;quot;convo_close&amp;quot; vocal, ex, &amp;quot;Got it.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Each &amp;quot;convo_question&amp;quot; asks for a judgement response.  &amp;quot;How was X?  What did you think of X?&amp;quot; etc.  Each vocal set has four or five questions/answers that are chosen from randomly.  The overall effect is pretty good, I think, though some question/responses combinations make more sense than others.&lt;br /&gt;
&lt;br /&gt;
The sitting AI in Mission 1: A New Job use this system.  Basically, you create the conversation and then decide when and how you want to trigger it.  A trigger_entityname could be used for patrolling AI.  If the AI are sitting near each other, a trigger_sequencer could be used to have multiple conversations over time. In the latter case I would make two conversations to alternate between--one with AI 1 asking the questions, and the other with AI 2 asking the questions.&lt;/div&gt;</summary>
		<author><name>Springheel</name></author>
	</entry>
	<entry>
		<id>https://wiki.thedarkmod.com/index.php?title=Random_Conversations&amp;diff=20491</id>
		<title>Random Conversations</title>
		<link rel="alternate" type="text/html" href="https://wiki.thedarkmod.com/index.php?title=Random_Conversations&amp;diff=20491"/>
		<updated>2018-07-04T21:31:08Z</updated>

		<summary type="html">&lt;p&gt;Springheel: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;Written by Springheel&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
When writing the newer vocal scripts, I came up with the idea of including a random sequence of questions and responses that can be used to create generic conversations between AI, so AI don&#039;t have to sit staring at each other in silence.  The following vocal sets support this (older ones do not):&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
1. vocal set_commander&lt;br /&gt;
&lt;br /&gt;
2. vocal set_jack&lt;br /&gt;
&lt;br /&gt;
3. vocal set_cynic&lt;br /&gt;
&lt;br /&gt;
4. vocal set_drunk&lt;br /&gt;
&lt;br /&gt;
5. vocal set_maiden&lt;br /&gt;
&lt;br /&gt;
6. vocal set_moor&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The sequence goes like this:&lt;br /&gt;
&lt;br /&gt;
AI 1: &amp;quot;convo_question&amp;quot; vocal,  ex, &amp;quot;So, how did the game go last night?&amp;quot;&lt;br /&gt;
&lt;br /&gt;
AI 2: &amp;quot;convo_answer/response&amp;quot; vocal, ex, &amp;quot;Could have been better.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
AI 1: &amp;quot;convo_close&amp;quot; vocal, ex, &amp;quot;Got it.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Each &amp;quot;convo_question&amp;quot; asks for a judgement response.  &amp;quot;How was X?  What did you think of X?&amp;quot; etc.  Each vocal set has four or five questions/answers that are chosen from randomly.  The overall effect is pretty good, I think, though some question/responses combinations make more sense than others.&lt;br /&gt;
&lt;br /&gt;
The sitting AI in Mission 1: A New Job use this system.  Basically, you create two conversations--one with AI 1 asking the questions, and the other with AI 2.  Then use a trigger of some kind to start the conversations when you want them.  A trigger_entityname could be used for patrolling AI.  If the AI are sitting near each other, a trigger_sequencer could be used to have multiple conversations over time.&lt;/div&gt;</summary>
		<author><name>Springheel</name></author>
	</entry>
	<entry>
		<id>https://wiki.thedarkmod.com/index.php?title=Random_Conversations&amp;diff=20490</id>
		<title>Random Conversations</title>
		<link rel="alternate" type="text/html" href="https://wiki.thedarkmod.com/index.php?title=Random_Conversations&amp;diff=20490"/>
		<updated>2018-07-04T21:30:25Z</updated>

		<summary type="html">&lt;p&gt;Springheel: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;Written by Springheel&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
When writing the newer vocal scripts, I came up with the idea of including a random sequence of questions and responses that can be used to create believable conversations between AI.  The following vocal sets support this (older ones do not):&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
1. vocal set_commander&lt;br /&gt;
&lt;br /&gt;
2. vocal set_jack&lt;br /&gt;
&lt;br /&gt;
3. vocal set_cynic&lt;br /&gt;
&lt;br /&gt;
4. vocal set_drunk&lt;br /&gt;
&lt;br /&gt;
5. vocal set_maiden&lt;br /&gt;
&lt;br /&gt;
6. vocal set_moor&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The sequence goes like this:&lt;br /&gt;
&lt;br /&gt;
AI 1: &amp;quot;convo_question&amp;quot; vocal,  ex, &amp;quot;So, how did the game go last night?&amp;quot;&lt;br /&gt;
&lt;br /&gt;
AI 2: &amp;quot;convo_answer/response&amp;quot; vocal, ex, &amp;quot;Could have been better.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
AI 1: &amp;quot;convo_close&amp;quot; vocal, ex, &amp;quot;Got it.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Each &amp;quot;convo_question&amp;quot; asks for a judgement response.  &amp;quot;How was X?  What did you think of X?&amp;quot; etc.  Each vocal set has four or five questions/answers that are chosen from randomly.  The overall effect is pretty good, I think, though some question/responses combinations make more sense than others.&lt;br /&gt;
&lt;br /&gt;
The sitting AI in Mission 1: A New Job use this system.  Basically, you create two conversations--one with AI 1 asking the questions, and the other with AI 2.  Then use a trigger of some kind to start the conversations when you want them.  A trigger_entityname could be used for patrolling AI.  If the AI are sitting near each other, a trigger_sequencer could be used to have multiple conversations over time.&lt;/div&gt;</summary>
		<author><name>Springheel</name></author>
	</entry>
	<entry>
		<id>https://wiki.thedarkmod.com/index.php?title=Random_Conversations&amp;diff=20489</id>
		<title>Random Conversations</title>
		<link rel="alternate" type="text/html" href="https://wiki.thedarkmod.com/index.php?title=Random_Conversations&amp;diff=20489"/>
		<updated>2018-07-04T21:29:55Z</updated>

		<summary type="html">&lt;p&gt;Springheel: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;Written by Springheel&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
When writing the newer vocal scripts, I came up with the idea of including a random sequence of questions and responses that can be used to create random conversations between AI.  The following vocal sets support this (older ones do not):&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
1. vocal set_commander&lt;br /&gt;
&lt;br /&gt;
2. vocal set_jack&lt;br /&gt;
&lt;br /&gt;
3. vocal set_cynic&lt;br /&gt;
&lt;br /&gt;
4. vocal set_drunk&lt;br /&gt;
&lt;br /&gt;
5. vocal set_maiden&lt;br /&gt;
&lt;br /&gt;
6. vocal set_moor&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The sequence goes like this:&lt;br /&gt;
&lt;br /&gt;
AI 1: &amp;quot;convo_question&amp;quot; vocal,  ex, &amp;quot;So, how did the game go last night?&amp;quot;&lt;br /&gt;
&lt;br /&gt;
AI 2: &amp;quot;convo_answer/response&amp;quot; vocal, ex, &amp;quot;Could have been better.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
AI 1: &amp;quot;convo_close&amp;quot; vocal, ex, &amp;quot;Got it.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Each &amp;quot;convo_question&amp;quot; asks for a judgement response.  &amp;quot;How was X?  What did you think of X?&amp;quot; etc.  Each vocal set has four or five questions/answers that are chosen from randomly.  The overall effect is pretty good, I think, though some question/responses combinations make more sense than others.&lt;br /&gt;
&lt;br /&gt;
The sitting AI in Mission 1: A New Job use this system.  Basically, you create two conversations--one with AI 1 asking the questions, and the other with AI 2.  Then use a trigger of some kind to start the conversations when you want them.  A trigger_entityname could be used for patrolling AI.  If the AI are sitting near each other, a trigger_sequencer could be used to have multiple conversations over time.&lt;/div&gt;</summary>
		<author><name>Springheel</name></author>
	</entry>
	<entry>
		<id>https://wiki.thedarkmod.com/index.php?title=Random_Conversations&amp;diff=20488</id>
		<title>Random Conversations</title>
		<link rel="alternate" type="text/html" href="https://wiki.thedarkmod.com/index.php?title=Random_Conversations&amp;diff=20488"/>
		<updated>2018-07-04T21:24:38Z</updated>

		<summary type="html">&lt;p&gt;Springheel: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;Written by Springheel&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
When writing the newer vocal scripts, I came up with the idea of including a random sequence of questions and responses that can be used to create random conversations between AI.  The following vocal sets support this (older ones do not):&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
1. vocal set_commander&lt;br /&gt;
&lt;br /&gt;
2. vocal set_jack&lt;br /&gt;
&lt;br /&gt;
3. vocal set_cynic&lt;br /&gt;
&lt;br /&gt;
4. vocal set_drunk&lt;br /&gt;
&lt;br /&gt;
5. vocal set_maiden&lt;br /&gt;
&lt;br /&gt;
6. vocal set_moor&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The sequence goes like this:&lt;br /&gt;
&lt;br /&gt;
AI 1: &amp;quot;convo_question&amp;quot; vocal,  ex, &amp;quot;So, how did the game go last night?&amp;quot;&lt;br /&gt;
&lt;br /&gt;
AI 2: &amp;quot;convo_answer/response&amp;quot; vocal, ex, &amp;quot;Could have been better.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
AI 1: &amp;quot;convo_close&amp;quot; vocal, ex, &amp;quot;Got it.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Each &amp;quot;convo_question&amp;quot; asks for a judgement response.  &amp;quot;How was X?  What did you think of X?&amp;quot; etc.  Each vocal set has four or five questions/answers that are chosen from randomly.  The overall effect is pretty good, I think, though some question/responses combinations make more sense than others.&lt;br /&gt;
&lt;br /&gt;
The sitting AI in Mission 1: A New Job use this system.&lt;/div&gt;</summary>
		<author><name>Springheel</name></author>
	</entry>
	<entry>
		<id>https://wiki.thedarkmod.com/index.php?title=Random_Conversations&amp;diff=20487</id>
		<title>Random Conversations</title>
		<link rel="alternate" type="text/html" href="https://wiki.thedarkmod.com/index.php?title=Random_Conversations&amp;diff=20487"/>
		<updated>2018-07-04T21:24:21Z</updated>

		<summary type="html">&lt;p&gt;Springheel: Created page with &amp;quot;&amp;#039;&amp;#039;Written by Springheel&amp;#039;&amp;#039;  When writing the newer vocal scripts, I came up with the idea of including a random sequence of questions and responses that can be used to create r...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;Written by Springheel&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
When writing the newer vocal scripts, I came up with the idea of including a random sequence of questions and responses that can be used to create random conversations between AI.  The following vocal sets support this (older ones do not):&lt;br /&gt;
&lt;br /&gt;
1. vocal set_commander&lt;br /&gt;
2. vocal set_jack&lt;br /&gt;
3. vocal set_cynic&lt;br /&gt;
4. vocal set_drunk&lt;br /&gt;
5. vocal set_maiden&lt;br /&gt;
6. vocal set_moor&lt;br /&gt;
&lt;br /&gt;
The sequence goes like this:&lt;br /&gt;
&lt;br /&gt;
AI 1: &amp;quot;convo_question&amp;quot; vocal,  ex, &amp;quot;So, how did the game go last night?&amp;quot;&lt;br /&gt;
AI 2: &amp;quot;convo_answer/response&amp;quot; vocal, ex, &amp;quot;Could have been better.&amp;quot;&lt;br /&gt;
AI 1: &amp;quot;convo_close&amp;quot; vocal, ex, &amp;quot;Got it.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Each &amp;quot;convo_question&amp;quot; asks for a judgement response.  &amp;quot;How was X?  What did you think of X?&amp;quot; etc.  Each vocal set has four or five questions/answers that are chosen from randomly.  The overall effect is pretty good, I think, though some question/responses combinations make more sense than others.&lt;br /&gt;
&lt;br /&gt;
The sitting AI in Mission 1: A New Job use this system.&lt;/div&gt;</summary>
		<author><name>Springheel</name></author>
	</entry>
	<entry>
		<id>https://wiki.thedarkmod.com/index.php?title=RIT_Networks&amp;diff=20486</id>
		<title>RIT Networks</title>
		<link rel="alternate" type="text/html" href="https://wiki.thedarkmod.com/index.php?title=RIT_Networks&amp;diff=20486"/>
		<updated>2018-07-04T20:53:28Z</updated>

		<summary type="html">&lt;p&gt;Springheel: /* Putting Even More Life to the AI */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= What are RITs? =&lt;br /&gt;
RITs (Random Interesting Things) can be used to make your AI more interesting, unpredictable and challenging. More lifelike AI can be achieved.&lt;br /&gt;
&lt;br /&gt;
= How Do They Work? =&lt;br /&gt;
For RITs, there are two types of path nodes: decision making nodes and normal nodes. The decision making ones are always path_waits and normal nodes can be any kind of path entities.&lt;br /&gt;
The core idea behind RITs is the following:&lt;br /&gt;
&lt;br /&gt;
[[Image:RIT_basic.png‎]]&lt;br /&gt;
&lt;br /&gt;
The blue boxes are path_waits. They should have wait 0 and the angle spawnarg removed. These path nodes are used as the decision making nodes. The AI does not need to walk to them, but it will choose some of the path nodes the path_wait is targeting. The red/green boxes mean any kind of combination of path nodes. Typically a path_corner to make the AI to walk to a certain location, maybe a path_anim to make the AI to play an animation there, and maybe a path_wait to make the AI stand still for a while.&lt;br /&gt;
&lt;br /&gt;
As you can see, the basic idea is that the AI targets a path_wait (enter), which doesn&#039;t do anything else, but sends the AI to some of its targets. The AI then goes and does one of the things dictated by the path_wait decision making node. Once the AI has gone through one of the paths, the final path node in that path targets another path_wait (exit). This exit path can then target what ever the mapper wishes, as long as the decision making nodes form an endless loop. If there is no loop, the AI will eventually stop and the path route terminus.&lt;br /&gt;
&lt;br /&gt;
= Practical Setup =&lt;br /&gt;
1) Build a room with RITs. A statue. A few chairs. Maybe a lit fireplace.&lt;br /&gt;
&lt;br /&gt;
2) On each RIT place the necessary interaction path_nodes to make an AI interact with them:  path_corner to walk over to them; path_sit on each of the chairs, path_anims for warming hands at the fireplace and standing in front of the statue and pondering, etc (A, B &amp;amp; C in image).&lt;br /&gt;
&lt;br /&gt;
3) Place two path_waits (1 &amp;amp; 2 in image) on the ceiling of the room. (They could be anywhere in the room, but it is easiest to manage if they are in the ceiling.)&lt;br /&gt;
&lt;br /&gt;
4) Name one of the path_waits &amp;quot;enter_room_decide_what_to_do.&amp;quot; (1) From that path_wait target each of the RIT path_corners. Set the path_wait &amp;quot;wait 0&amp;quot;. so AI won&#039;t stop there. The idea is to use the path_wait as a simple decision making node. Be sure that the path_wait has no angle-spawnarg. If it does, the AI will turn towards the angle each time he targets the node.&lt;br /&gt;
&lt;br /&gt;
5) Name the other path_wait &amp;quot;exit_room_decide_what_to_do.&amp;quot; (2) Make each RIT final path_node  target this path_wait. Make the path_wait target other rooms with similar decision making path_waits.&lt;br /&gt;
&lt;br /&gt;
6) Done.&lt;br /&gt;
&lt;br /&gt;
[[Image:Rits.jpg]] &lt;br /&gt;
&lt;br /&gt;
AI will come into the room, select A, B or C at random, and then leave.  Next time they enter, they&#039;ll again pick at random.&lt;br /&gt;
&lt;br /&gt;
This could be used to make servants to run around a mansion, cleaning, making food, taking sitting breaks, visit the toilet, etc. You could build room decision making network separately for different AI. Servants clean, cook and take breaks. Guards patrol, make random deviations once in a while, and of course take breaks. Controlling the RIT path_corner chance-spawnarg gives you control what RITs the AI do more likely.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Example RIT Network Setups =&lt;br /&gt;
The common situation in a map is a guarded location. The mapper could build a common RIT network for all the guards in a specific location. The mapper might still want to place static (or the RIT door guard setup) to ultra critical areas that must be manned at all times. Guard RIT patrol routes are fantastic for those ordinary patrolling guards. The benefit is that you only need a single network that can handle multiple AI at once. Also you can later inject more guards (for example sleeping AI that got alerted) into the network without the need to build individual patrol routes to new guards. The mapper could also inject additional guards in the network based on the difficulty the player chooses.&lt;br /&gt;
&lt;br /&gt;
== The Basic Guard Patrol RIT ==&lt;br /&gt;
The basic RIT guard network concept looks like this:&lt;br /&gt;
&lt;br /&gt;
[[Image:RIT_guard.png‎]]&lt;br /&gt;
&lt;br /&gt;
The green boxes are a static route the AI follows. They are path_corners. At some point the route either continues along the normal static route, or sends the AI to a side track RIT network. See the basic RIT unit to understand what the teal RIT circle means. Basically the AI goes side track, visit a room that is on his route. The mapper can use the chance spawnarg on the RIT enter path_wait, to control how likely the AI is to take the side road. The RITs might be room specific. AI guard RIT in the kitchen means snack time, side track RIT in the main hall might mean sitting down and chilling for a while.&lt;br /&gt;
&lt;br /&gt;
Note the shortcut in the rightmost RIT circle. RIT exits could make the AI take shortcut or even make the AI go back in the opposite direction. This is a good option to consider as you see the RIT patrol would always take a clockwise general direction. If there was a single anti-clockwise path, which the AI could occasionally take, the RIT would function in all directions.&lt;br /&gt;
&lt;br /&gt;
== The Basic Servant RIT ==&lt;br /&gt;
Servants do something else than the guards, therefore they should not use RITs designed for guards. An example of a good servant RIT network is presented here.&lt;br /&gt;
&lt;br /&gt;
[[Image:RIT_servant.png‎]]&lt;br /&gt;
&lt;br /&gt;
As you can see, the setup is room specific and there are no static patrol parts. Note also how the RIT cycles target each other and even themselves. This means that the servant roams to a room, doing tasks the RIT sidetracks make them do: cleaning, cooking, etc. Since the RIT circles target themselves, (and if the &amp;quot;exit&amp;quot; path_wait targets the &amp;quot;enter&amp;quot; path_wait of the room the AI is currently in with a high chance) the servant can spend some time doing tasks in a single room. Then after a while he moves to another location. Servants could thus be anywhere: cooking, cleaning, getting a bottle of wine from the cellar, sitting in the backyard for a break, etc...&lt;br /&gt;
&lt;br /&gt;
== The Basic Roaming RIT ==&lt;br /&gt;
Sometimes the guard and servant RITs are not enough and you need to do something specific. Maybe the lord of the house is strolling around the house and the manor grounds. Maybe there is a thief lurking in the city. Maybe there are some random civilians walking around. In these cases roaming RITs are good option.&lt;br /&gt;
&lt;br /&gt;
[[Image:roaming_RIT.png‎]]&lt;br /&gt;
&lt;br /&gt;
In this setup, the AI uses a single RIT circle, but the circle is spread across the whole map. The &amp;quot;enter&amp;quot; path_wait can send the arbitrarily anywhere in the map. Once the AI reaches the goal the &amp;quot;exit&amp;quot; path_wait targets again the &amp;quot;enter&amp;quot; path_wait. And again the AI goes somewhere totally else. This kind of AI can be really surprising as the AI can indeed be walking between any of the two points, giving large amount of different scenarios.&lt;br /&gt;
&lt;br /&gt;
== The Basic Door Guard RIT ==&lt;br /&gt;
The Basic Door Guard RIT is a good option for static guards that are supposed to guard a single critical location. In old thief games these were the guards that stay put, but turn to look the other way every now and then. With RIT version you can do exactly that but you can do so much more.&lt;br /&gt;
&lt;br /&gt;
[[Image:RIT_door_guard.png‎]]&lt;br /&gt;
&lt;br /&gt;
The basic idea is that there is a normal repeating RIT cycle (&amp;quot;enter&amp;quot; targets path nodes, which target &amp;quot;exit&amp;quot; which targets &amp;quot;enter&amp;quot; again; an endless loop.) In this case the AI is guarding the door. The mapper could build an interesting RIT network for all kinds of random stuff a bored door guard might do: take leak, get a snack, walk around a bit, etc. The thing is, that the mapper simply sets the chance spawnarg on the &amp;quot;guard door&amp;quot; path nodes (a path_corner, a path_anim (look around) and a path_wait) so that the AI spends 75% or similar time of the cycle at the door. Then occasionally the AI would leave the door and take the break action the mapper defined. In practice, the mapper could set the chance spawnargs so that the important path node chance sums up to 75% near the important door. In this case, the path_corner_1 near the door would have chance 0.37 and path_corner_2 chance 0.37. Some of the remaining path nodes would then be targeted at a 26% probability.&lt;br /&gt;
&lt;br /&gt;
== Putting Even More Life to the AI ==&lt;br /&gt;
RIT increases the liveliness of the AI but you can push the immersion even further. For instance, you could place trigger_entityname -entities in places where the AI of a certain name walks past. When the AI walks through the trigger, a conversation would be triggered between the passing AI and a nearby AI. A good example of this are all the conversations encountered in the Phrase Book mission. Designing the conversation so that you can mix and match different lines so that the discussion still works, would create a scene where AI behave like real people and occasionally stop and have a random chat. [[Random Conversations]]&lt;br /&gt;
&lt;br /&gt;
== RIT Troubleshooting and Testing ==&lt;br /&gt;
As the networks can seem quite complex at first, one might think that troubleshooting them is very difficult. It is not. You can simply test you RIT networks by letting you map run for a long time. If there are some mistakes that break the cycle, the AI are standing near the path entity that failed to send the AI back into the RIT network cycle. &lt;br /&gt;
&lt;br /&gt;
One way to efficiently test your RITs is to create temporary AIs in the map so you have large amount of AIs testing the network.&lt;br /&gt;
&lt;br /&gt;
If you generate a particularily challenging RIT branch for the AI (using path_nodes you are not familiar with, for example) it might be a good idea to create a test AI or a few which directly target the branch and check ingame how they manage.&lt;br /&gt;
&lt;br /&gt;
When creating separate guard partrol RITs, servant RITs and roaming RITs in your map, it might be a good idea to use the DR layer function so that you can hide all the non-related path_nodes and focus on the one RIT you are creating at that time.&lt;br /&gt;
&lt;br /&gt;
= Sitting and Sleeping RIT AI =&lt;br /&gt;
This is important. If you have sitting and sleeping AI in you RIT networks, be sure to put an extra path_corner so that the AI always walks away from the bed or the chair after they finish whatever they are doing there. If such a path is not set the situation might go like this:&lt;br /&gt;
 1) AI comes to bed, goes to sleep&lt;br /&gt;
 2) AI gets up, targets decision node&lt;br /&gt;
 3) By chance, decision node tells AI to go back to sleep&lt;br /&gt;
 4) AI goes back to sleep, but is too close to the bed and gets stuck.&lt;br /&gt;
 5) AI gets stuck.&lt;br /&gt;
&lt;br /&gt;
By adding a path_corner that makes the AI to walk away from the bed to a safe distance:&lt;br /&gt;
 1) AI comes to bed, goes to sleep&lt;br /&gt;
 2) AI gets up, targets the walk away path_corner. AI moves away from the bed.&lt;br /&gt;
 3) The AI targets the decision making node.&lt;br /&gt;
 4) By chance, decision node tells AI to go back to sleep&lt;br /&gt;
 5) AI goes back to sleep, but is safely away from the bed so he walks to the bed and goes to sleep without issue.&lt;br /&gt;
 6) All is well&lt;br /&gt;
&lt;br /&gt;
= Example map =&lt;br /&gt;
Here is a basic map for mappers to use and learn from - [http://www.southquarter.com/tdm/fms/rits.pk4 Link 1], [http://darkmod.taaaki.za.net/fms/rits.pk4 Link 2] &amp;amp; [http://www.fidcal.com/darkuser/missions/rits.pk4 Link 3]&lt;br /&gt;
&lt;br /&gt;
= Conclusion =&lt;br /&gt;
RIT networks are a nice and relatively simple way to add liveliness and unpredictability for your AI. It also makes it easy for the mapper to inject more AI to the mission flow if needed. However, the added unpredictability increases the mission challenge and difficulty so the mapper should be careful how many AI he adds to the networks. Generally a good RIT has the possibility of sending AI to any location in the map, but the probabilities should be tuned so that the golden rule of location security levels still apply. (Meaning, that the map has areas of varying danger: low tension, medium tension and high tension)&lt;br /&gt;
&lt;br /&gt;
{{editing}}&lt;/div&gt;</summary>
		<author><name>Springheel</name></author>
	</entry>
	<entry>
		<id>https://wiki.thedarkmod.com/index.php?title=The_Dark_Mod_Gameplay&amp;diff=19956</id>
		<title>The Dark Mod Gameplay</title>
		<link rel="alternate" type="text/html" href="https://wiki.thedarkmod.com/index.php?title=The_Dark_Mod_Gameplay&amp;diff=19956"/>
		<updated>2018-04-29T13:56:11Z</updated>

		<summary type="html">&lt;p&gt;Springheel: /* Blackjacking */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{red|Updates for versions after v1.00 are listed in red, so players can quickly see changes to gameplay since their last read.}}&lt;br /&gt;
&lt;br /&gt;
Since The Dark Mod is designed to simulate the stealth gameplay of Thief, many things will be familiar to veteran Thief players.  However, there are some features that works differently, and some things that are entirely new to TDM.  &lt;br /&gt;
&lt;br /&gt;
If you&#039;ve never played stealth games before, start with the [[Basics of Stealth Gaming]].&lt;br /&gt;
&lt;br /&gt;
Veteran stealth gamers can read the various sections below for more detail:&lt;br /&gt;
&lt;br /&gt;
= The Game Menus =&lt;br /&gt;
&lt;br /&gt;
Your experience with The Dark Mod will start with the Main Menu, where you may wish to adjust some settings before starting your first mission.  If you already have saved games from a currently installed mission, you can load them from the Load/Save menu.  &lt;br /&gt;
&lt;br /&gt;
{{red|Note: While missions remain compatible with all updates, your saved games will not necessarily work after updating, due to code changes.}}&lt;br /&gt;
&lt;br /&gt;
== Starting a Mission ==&lt;br /&gt;
[[Image:new_mission.jpg|thumb|The New Mission menu.]]&lt;br /&gt;
&lt;br /&gt;
# Select &#039;&#039;New Mission&#039;&#039; from the Main Menu.&lt;br /&gt;
# Click &amp;quot;Download&amp;quot; to see a list of missions available for download. Here you can also read details about, and look at screenshots from, the mission before downloading it. {{red|(1.04)}}&lt;br /&gt;
# Select a Mission from the Available Mission list on the right (start with the Training Mission if this is your first time playing) and click &#039;&#039;Install Mission&#039;&#039;.&lt;br /&gt;
# TDM will install the mission and restart. When back in the menu, select &#039;&#039;New Mission&#039;&#039; again and click &#039;&#039;Start Mission&#039;&#039;.&lt;br /&gt;
# You will see a briefing that introduces the mission.  Click &#039;&#039;Objectives&#039;&#039; to proceed.&lt;br /&gt;
# Read your objectives, and choose your Difficulty Level.  Then select &#039;&#039;Buy Equipment&#039;&#039; (or &#039;&#039;Start Mission&#039;&#039; in some missions).&lt;br /&gt;
# After purchasing the desired equipment, hit &#039;&#039;Start Mission&#039;&#039; (The option to &#039;&#039;Drop&#039;&#039; starting items is available, but use this with caution... dropping some items may make a mission impossible to complete).&lt;br /&gt;
# The Mission Loading screen should appear. Be patient... loading a mission for the first time can take several minutes.&lt;br /&gt;
&lt;br /&gt;
To call up the Main Menu while playing, press {{ESC}}).&lt;br /&gt;
&lt;br /&gt;
See [[Installing and Running Fan Missions]] for more information.&lt;br /&gt;
&lt;br /&gt;
== Changing Settings ==&lt;br /&gt;
&lt;br /&gt;
# Select &#039;&#039;Settings&#039;&#039; from the Main Menu&lt;br /&gt;
# Select the type of setting you wish to adjust: &#039;&#039;Audio&#039;&#039;, &#039;&#039;Video&#039;&#039;, &#039;&#039;Controls&#039;&#039;, or &#039;&#039;Gameplay&#039;&#039;.&lt;br /&gt;
# The controls are set to defaults familiar to &#039;&#039;Thief&#039;&#039; players, however there are new keys/features that are worth reviewing.&lt;br /&gt;
# There are difficulty settings for many things, including lockpicking and {{red| combat. (1.01)}} &lt;br /&gt;
# New graphics settings has been added for better graphic quality and bloom. {{red|(1.03)}}&lt;br /&gt;
# {{red|A new &amp;quot;AI Vision&amp;quot; option has been added.  This controls how quickly AI realizes you are an enemy when they spot you. (2.0)}}&lt;br /&gt;
&lt;br /&gt;
== Objectives ==&lt;br /&gt;
&lt;br /&gt;
When you call up the Main Menu during a mission (by hitting {{ESC}}), you will see an option for &amp;quot;Objectives&amp;quot;.  This is where you can check your progress.&lt;br /&gt;
&lt;br /&gt;
Your objectives are also displayed after the Mission Briefing when you first start a mission.&lt;br /&gt;
&lt;br /&gt;
You can also check your Objectives without opening the menus. Hitting {{key|O}} will bring up your objectives on screen.  You can use the mouse wheel to scroll up and down.  Note that this method &#039;&#039;does not pause the game&#039;&#039;! {{red| (1.01)}}&lt;br /&gt;
&lt;br /&gt;
When you complete an objective, a chime will sound and the message “Objective Completed” will be displayed at the top of the screen.  &lt;br /&gt;
&lt;br /&gt;
When you have completed all objectives, the map will close and a “Mission Succeeded” screen will appear.  Likewise, if you fail an objective or get killed, a “Failed Mission” screen will appear.  You can restart a mission by clicking &amp;quot;Restart&amp;quot;, or via the Main Menu.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
= HUD (Heads-Up Display) =&lt;br /&gt;
&lt;br /&gt;
[[Image:hud.jpg|thumb|The Game Screen indicators.]]&lt;br /&gt;
&lt;br /&gt;
1. WEAPON ICON: An icon of your currently selected weapon is displayed in the bottom left corner of the screen.&lt;br /&gt;
&lt;br /&gt;
2. BREATH INDICATOR: When you are underwater, a small blue bar will appear above the lightgem. This bar shows how much air you have left.  When the bar runs out, you&#039;ll begin to take damage. Surfacing or using a Breath Potion will restore your air bar.&lt;br /&gt;
&lt;br /&gt;
3. LIGHTGEM: The lightgem at the bottom of the screen indicates how visible you are. This is primarily based on how much light is hitting you, but also includes other factors, like whether you are crouched, moving, or have a weapon drawn. {{red|Being under water also reduces your lightgem. (1.03)}}&lt;br /&gt;
&lt;br /&gt;
The wings on either side of the gem works as a crouch indicator. When you are crouched, the wings &#039;crouch&#039; down as well. {{red| (1.01) }}&lt;br /&gt;
&lt;br /&gt;
4. HEALTH INDICATOR: When you are injured, a small red health bar appears below the lightgem. It will remain visible until your health is fully replenished. Health potions and various types of food will replenish health.&lt;br /&gt;
&lt;br /&gt;
5. INVENTORY ICON: Your currently selected inventory object (or your loot total) is displayed as an icon in the bottom right.&lt;br /&gt;
&lt;br /&gt;
== Weapons ==&lt;br /&gt;
&lt;br /&gt;
Weapon hotkeys were changed at the last minute, so this list may need modifying.&lt;br /&gt;
* {{key|`}} Put away weapons&lt;br /&gt;
* {{key|1}} Blackjack&lt;br /&gt;
* {{key|2}} Short Sword&lt;br /&gt;
[[Image:arrows.jpg|thumb|A selection of arrows you can choose from.]]&lt;br /&gt;
* {{key|3}} Broadheads&lt;br /&gt;
* {{key|4}} [[Water Arrows]]&lt;br /&gt;
* {{key|5}} [[Fire Arrows]]&lt;br /&gt;
* {{key|6}} [[Rope Arrows]] &lt;br /&gt;
* {{key|7}} [[Gas Arrows]]  &lt;br /&gt;
* {{key|8}} [[Noise Arrows]]&lt;br /&gt;
* {{key|9}} [[Moss Arrows]]&lt;br /&gt;
* {{key|0}} [[Vine Arrows]] {{red| (1.07)}}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;(Note that there has been a report that Linux users cannot use the {{key|`}} as it is mapped to the console. Linux users will need to choose a different key for &#039;Put away weapons&#039;.)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Inventory Objects ==&lt;br /&gt;
Cycle through your inventory using the Inventory Prev/Next keys (default: {{key|[}} or {{key|TAB}} for next item and {{key|]}} for prev item). Inventory objects are stored in groups, so all keys will be stored together, all readables, etc.  You can cycle through groups with the Prev/Next Group keys.&lt;br /&gt;
&lt;br /&gt;
To ‘use’ an inventory object, select it and then hit the Use key (default: {{key|U}}). This will execute commands; drink potions, throw mines, activate the spyglass, etc. To &amp;quot;use&amp;quot; objects on other objects (like using a key on a door), select the object in your inventory, highlight the thing you want to use it on, and hit Use.&lt;br /&gt;
&lt;br /&gt;
You can drop inventory items by hitting the Drop key (default: {{key|R}}) twice. See the section &amp;quot;Holding Junk Objects&amp;quot; for more information. Note that mappers may designate important inventory items as undroppable.&lt;br /&gt;
&lt;br /&gt;
You can clear the inventory selection by hitting the {{key| ← &amp;amp;nbsp; &amp;amp;nbsp; &amp;amp;nbsp;}} (backspace) key.&lt;br /&gt;
&lt;br /&gt;
To set hotkeys for your inventory items, please see [[Custom Settings for Players]].&lt;br /&gt;
&lt;br /&gt;
=== Inventory Object: Flashbomb === &lt;br /&gt;
[[Image:equipment.jpg|thumb|The tools of a professional burglar.]]&lt;br /&gt;
Activate a flashbomb by selecting it in the inventory and hit Use. Flashbombs detonate on impact. A short tap will cause it to fall and go off at your feet where it won&#039;t blind you. Holding down the Use key will throw the flashbomb farther away. If you use the Drop key to put the flashbomb down, it is not activated at all.&lt;br /&gt;
&lt;br /&gt;
A flashbomb will only be effective if it lands within the AI&#039;s FOV (Field Of View). If you look towards the point of impact, you&#039;ll also be blinded by it.&lt;br /&gt;
&lt;br /&gt;
AI are only blinded for a few seconds, and they are also alerted by the flash. This tool is most useful for getting away when you&#039;ve been spotted, or for stunning an enemy before an attack.&lt;br /&gt;
&lt;br /&gt;
Flashbombs have no effect on the undead.&lt;br /&gt;
&lt;br /&gt;
=== Inventory Object: Holy Water ===&lt;br /&gt;
&lt;br /&gt;
Select holy water in the inventory and hit the Use key.  This puts holy water into your water arrows, making them lethal to undead.  The effect only lasts 30 seconds, so use it wisely.&lt;br /&gt;
&lt;br /&gt;
=== Inventory Objects: Keys === &lt;br /&gt;
Some doors and chests require keys to open. To open a locked door, select the appropriate key by scrolling to it in your inventory and hit the Use key (or the Frob key if you wish) while highlighting the door. Note that certain types of door locks (like padlocks) might have to be frobbed separately.&lt;br /&gt;
&lt;br /&gt;
You can also assign a key to &#039;&#039;Cycle Keys&#039;&#039; to quickly cycle through all keys in your inventory.  This is a very useful way to get to your keys quickly when you have a lot of other items in your inventory.&lt;br /&gt;
&lt;br /&gt;
=== Inventory Objects: Lockpicks === &lt;br /&gt;
See [[#Lockpicking|Lockpicking]] for more information on lockpicks.&lt;br /&gt;
&lt;br /&gt;
=== Inventory Objects: Maps and Readables === &lt;br /&gt;
&lt;br /&gt;
In The Dark Mod, both maps and most readables (books, scrolls, etc) are inventory items. To read them, you scroll to the object in your inventory and then hit the Use key. The map or readable will be displayed on screen. Note that &#039;&#039;&#039;this does not pause the game&#039;&#039;&#039;. Unlike Thief, events continue to unfold around you, and you can be attacked while reading if you&#039;re not careful. You can see your environment around the edges of the map/readable, but make sure you find a safe place to read. With multi-page readables (distinguishable by folded corners on the page), use the next/prev inventory or next/prev weapon keys to scroll through pages. Hitting Use or Attack will put the readable away.&lt;br /&gt;
&lt;br /&gt;
The Map key (default: {{key|M}}) will also automatically bring up your map, if you have one. You can also define a readables key (default: not mapped) to cycle through any readables you have.&lt;br /&gt;
&lt;br /&gt;
=== Inventory Object: Mines === &lt;br /&gt;
&lt;br /&gt;
Place a mine by selecting it in your inventory and hitting Use. A short tap will drop the mine at your feet. Holding down Use will throw the mine farther away. After a few seconds, the mine is armed and {{red| starts making a distinct ticking sound (1.07) }}. Once you hear the ticking, it will go off if stepped on.&lt;br /&gt;
&lt;br /&gt;
{{red| Map authors can place a mine and arm it at mission start. It behaves the same as any mine you&#039;ve thrown: it will explode on contact, and it can be disarmed. So don&#039;t assume that any mine you come across is safe to pick up. Listen for the tell-tale armed ticking sound. (1.07) }}&lt;br /&gt;
&lt;br /&gt;
If you use the Drop key to put the mine down, it won&#039;t be armed.&lt;br /&gt;
&lt;br /&gt;
Note that you can set armed mines off by shooting at them with arrows.&lt;br /&gt;
&lt;br /&gt;
You can disarm an armed mine by using a lockpick on it, the same as you would on a locked door. {{red| (1.07) }} Armed mines give off a distinct ticking sound, which stops when the mine is disarmed. After disarming a mine, you can frob it to put it into your inventory.&lt;br /&gt;
&lt;br /&gt;
=== Inventory Object:  Player Lantern === &lt;br /&gt;
&lt;br /&gt;
Light is usually the bane of thieves everywhere, but there are times when you need just a little to make your way around.  To this end, some thieves carry a covered lantern with a hood that can be closed to hide the light. To use the lantern, select it in your inventory and hit Use.  This will lift the cover if the lantern is currently off, or close the cover if it is currently lit. There is also a hotkey for using the lantern; by default this is {{key|L}}. The lantern is clipped to your belt so your hands are free, and it can even be used underwater for short periods.&lt;br /&gt;
&lt;br /&gt;
Obviously using the lantern makes you clearly visible to any nearby opponents and NPCs (Non Playable Characters).&lt;br /&gt;
&lt;br /&gt;
=== Inventory Object: Potions ===&lt;br /&gt;
&lt;br /&gt;
Potions are used by selecting them in inventory and hitting Use. Healing potions will restore hit points (the effect is somewhat gradual). Breath potions refills the player&#039;s breath meter, allowing them to stay underwater longer.&lt;br /&gt;
&lt;br /&gt;
=== Inventory Object: Spyglass === &lt;br /&gt;
&lt;br /&gt;
A good Thief scouts ahead. To use the spyglass, select it in your inventory and hit Use. Also, you can use {{key|G}} as a shortcut. You can use the next/prev weapon keys to zoom in and out. You cannot use weapons or frob objects while using the spyglass.&lt;br /&gt;
&lt;br /&gt;
= Movement =&lt;br /&gt;
&lt;br /&gt;
Movement in The Dark Mod is not that different from Thief. You can run, walk, or creep, as well as any of the three while crouching.  The faster you move, the more noise you make.&lt;br /&gt;
&lt;br /&gt;
== Climbing ==&lt;br /&gt;
&lt;br /&gt;
In addition to ladders and ropes, many missions allows you to climb vines, pipes and chains.&lt;br /&gt;
&lt;br /&gt;
Move or jump onto a ladder or vines to &amp;quot;attach&amp;quot; to them. Moving &amp;quot;forward&amp;quot; will move in the direction of your view, be it up, down or to the side.  &amp;quot;Back&amp;quot; will reverse, and you may strafe to the side. Move away or jump off to detach.&lt;br /&gt;
&lt;br /&gt;
Holding crouch will let you slide down a rope or ladder. Release to stop sliding, or hold it down to slide all the way to the bottom.&lt;br /&gt;
&lt;br /&gt;
=== Swinging on Ropes ===&lt;br /&gt;
&lt;br /&gt;
Tapping the &amp;quot;attack&amp;quot; key while on a rope or chain will cause the rope to swing forward. You can actually gain more momentum by continuing to tap it every time you start swinging forward (think of it as swinging your legs forward on a swing). This can allow you to jump off the rope and grab ledges that would otherwise be unreachable).&lt;br /&gt;
&lt;br /&gt;
Note that the further down the rope you are, the more distance you can travel when swinging (just like a real rope).&lt;br /&gt;
&lt;br /&gt;
== Mantling ==&lt;br /&gt;
There are two different ways to mantle (pull yourself up onto ledges) in The Dark Mod. One is by holding down the Jump key, which Thief players will be familiar with. There is also a specific key for mantling (default: {{key|&lt;br /&gt;
C}}), so that failing to mantle will not result in jumping and making noise.  Ideally there should be no difference in these methods, but occasionally one method will work when the other will not.&lt;br /&gt;
Mantling is affected by where you are looking, so a successful mantle is more likely if you are looking directly at the edge of the object you wish to climb. To climb onto a chair, look down at the seat then press the mantle control. This means you can clamber over relatively low but awkward obstructions and even select one ledge above/below another.&lt;br /&gt;
&lt;br /&gt;
You cannot mantle while carrying a junk object or a body.&lt;br /&gt;
&lt;br /&gt;
= Interacting With Your Environment =&lt;br /&gt;
&lt;br /&gt;
The Dark Mod gives you far more flexibility than previous Thief games when it comes to interacting with things.&lt;br /&gt;
&lt;br /&gt;
== Manipulating Held Objects ==&lt;br /&gt;
This is one area that works quite differently from the Thief series. &amp;quot;Held Objects&amp;quot; (anything that you can carry that doesn’t go into your inventory, like chairs, candles, or bodies) are held out in front of you when frobbed. Unlike in Thief, they take up physical space, and can be used to push or manipulate other objects. They can also bump into other objects, making noise (or being knocked out of your hands), so be careful.&lt;br /&gt;
&lt;br /&gt;
Objects in the game world that gets highlighted when looked at can be picked up. To grab an object, frob it as normal. The object will stop being highlighted, and any weapons you had selected will lower. At this point, you can use the next/prev weapon keys (default: mousewheel up/down) to move the object closer/further away from you, and moving your mouse around will move the object.&lt;br /&gt;
&lt;br /&gt;
The heavier the object, the slower it moves, so you may notice a ‘lag’ if you turn quickly with heavy objects. It can take a while to get used to this.&lt;br /&gt;
&lt;br /&gt;
To drop an object, hit the Drop key (default: {{key|R}}). By crouching and angling your view downwards gently, you&#039;ll find that you can easily set down objects without making noise. You can also throw a held object by hitting the Attack key. Tapping the Attack key throws the object a short distance; holding the Attack key down and releasing it will throw it further away.&lt;br /&gt;
&lt;br /&gt;
To rotate a held object, hold down the {{key|Z}} key or middle mouse button, and move your mouse. (By default, horizontal movement of the mouse yaws the object around the vertical axis, and vertical movement pitches the object up and down. Holding down the Run key makes horizontal mouse movement roll the object around the forward axis.) This can be useful for replacing objects that have been knocked over, or for placing moveable objects in creative ways (like putting a plank over a gap, or stacking chairs).&lt;br /&gt;
It is possible to “drop” inventory items into your hands, where they can be manipulated as if they were held objects.  Select the object in your inventory, and hit the Drop key {{key|R}}.  The object will appear in front of you like a held object, and you can rotate it, set it down, etc.  To put it back into your inventory, you must &amp;quot;use&amp;quot; the item again ({{key|U}}) or scroll to the next inventory item ({{key|TAB}} or {{key|[}}/{{key|]}}).&lt;br /&gt;
[[Image:candles6.jpg|thumb|[http://www.youtube.com/watch?v=922ArtrKgC4 Click to see TDM candles in action.] ]]&lt;br /&gt;
AI will hear junk objects that are dropped or banged around.  It takes some skill to pick up objects on a crowded table without knocking them into each other.  Remember than an object moves to the center of the screen when you pick it up.  If you are looking slightly above the object, it will jump up to center screen (usually a good thing).  If you&#039;re looking slightly below the object, it will jump down, banging whatever surface it rests on (a bad thing).  A little practice may be required to smoothly and quietly sort through objects.&lt;br /&gt;
&lt;br /&gt;
Some objects that are too heavy to lift may still be movable (like large crates).  Walking or running into such objects may (mapper&#039;s choice) push them along the ground.&lt;br /&gt;
&lt;br /&gt;
=== Held Objects: Candles ===&lt;br /&gt;
&lt;br /&gt;
Lit candles can be frobbed and carried around to light your way (obviously you will be easily spotted while carrying a lit candle).  They can also be used to light flammable objects like other candles or torches.  Click the caption on the right for a demonstration.&lt;br /&gt;
&lt;br /&gt;
Candles can be extinguished by water, or you can pinch them out by picking them up and clicking the Use key.  (Note that this method can also be used on some movable lanterns). {{red|Candles will usually go out after a few seconds if they get knocked over. (1.06) }}&lt;br /&gt;
&lt;br /&gt;
Be aware that multiple light sources can cause a significant drain on your framerate.  If you go around a room lighting six or seven new candles, don&#039;t be surprised if your framerate drops significantly.&lt;br /&gt;
&lt;br /&gt;
=== Held Objects: Bodies ===&lt;br /&gt;
&lt;br /&gt;
Bodies work differently than most other objects.  There are two ways to deal with dead or unconscious bodies in The Dark Mod.  You can both drag them and carry them.&lt;br /&gt;
&lt;br /&gt;
To drag a body, you must ‘frob’ it (which probably requires crouching), and then move your mouse around.  The body will drag along with you until you frob it again or the body gets stuck on something.  &lt;br /&gt;
&lt;br /&gt;
This is not the most graceful way of moving bodies and is not recommended for long distances.  Bodies can catch on things and get pulled out of your hands.  It can be useful for quickly shifting a body into a shadow, however.  You can even move individual limbs to put a flailing arm back into a shadow.&lt;br /&gt;
&lt;br /&gt;
You can also carry a body over your shoulder.  While a body is being dragged, hitting the Use button will lift it up over your shoulder.  While carrying a body you move more slowly and cannot use weapons or inventory objects (though you can open doors).  When you are ready to drop the body, hit Use again.  If there is not enough room, you will hear a grunt and nothing will happen.  Back up a bit and try again.  When you drop a body, it will be the opposite orientation from the way you picked it up (if a body is face-up when you lift it, it will be face-down when you drop it).  This allows you to easily search a body for keys or other objects.&lt;br /&gt;
&lt;br /&gt;
=== Held Objects: Food ===&lt;br /&gt;
&lt;br /&gt;
Some food can be eaten.  When holding a piece of food (such as an apple) hit the &amp;quot;use&amp;quot; key.  If the food is edible, you will &#039;eat&#039; it. Discard any left-overs. Some of the healthy food will heal you by 1 HP.&lt;br /&gt;
&lt;br /&gt;
== Doors == &lt;br /&gt;
You can interrupt a door opening or closing by frobbing it again.  Frobbing a moving door stops it, allowing you to open a door just a crack to peer beyond.&lt;br /&gt;
&lt;br /&gt;
You can lean into a door (use the lean left/right keys) to press your ear up against it and hear what&#039;s on the other side.  Note that while you&#039;re concentrating on what&#039;s beyond the door you&#039;ll be less able to hear the sounds in the room you&#039;re currently in.&lt;br /&gt;
&lt;br /&gt;
Some doors or chests are locked and require keys (or lockpicks, see below) to open. To open a locked door, select the appropriate key by scrolling to it in your inventory and hit the Use key (or the Frob key if you wish) while highlighting the door. Note that certain types of door locks (like padlocks) might have to be frobbed separately.&lt;br /&gt;
&lt;br /&gt;
Depending on how important a specific door is, the mapper can choose to set flags on it. Check out the [[#AI_Behaviour| AI Behaviour]] section, for details on how the AI responds in such cases.&lt;br /&gt;
&lt;br /&gt;
== Lockpicking ==&lt;br /&gt;
You will definitely want to practice lockpicking in the Training Mission before trying a real map. Just reading the instructions is probably not enough to get the hang of it. &lt;br /&gt;
&lt;br /&gt;
There are two types of lockpicks, &#039;triangle&#039; and &#039;snake&#039;. To begin, you must have the correct lockpick selected in inventory.  If you do not, you will see a red flash behind the lockpick icon when you frob the locked door. To pick a lock, move close enough to highlight the door and hold the Use key.  You will start to hear a sequence of clicks, and see the door handle (or lock pin) jiggle in sync.&lt;br /&gt;
&lt;br /&gt;
The clicks are a random pattern.  At the end of the pattern is a brief period of silence, then the pattern will begin again. To be successful you must hit the Attack key (or release the Use key if you prefer) at the start of that silence.  If you hit the Attack key at the wrong time there is a dull &#039;fail&#039; sound and the pattern begins again.  Your goal is to learn the sequence of clicks so that you can anticipate when it will end.  This requires concentration.&lt;br /&gt;
&lt;br /&gt;
Some locks are more difficult than others and have multiple pins (which may require switching lockpicks).  You can make lockpicking harder or easier in the Settings Menu, by adjusting how much silence there is between each pattern (the more silence, the easier it is to react in time).  Setting Lockpicking to &amp;quot;Auto&amp;quot; will make locks open automatically after the pattern repeats 3 times.&lt;br /&gt;
&lt;br /&gt;
{{red| Armed mines can be disarmed by lockpicking them. Afterward, they can be frobbed and put into inventory. Either lockpick type can be used. (1.07) }}&lt;br /&gt;
&lt;br /&gt;
== Chests ==&lt;br /&gt;
It can sometimes be a little awkward frobbing items inside deep chests. Leaning forward (or even sideways) will usually help.&lt;br /&gt;
&lt;br /&gt;
If you get too close to a chest, you can sometimes get in the way of the lid opening or closing. Back up a little if the lid is not moving as expected.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
= Combat =&lt;br /&gt;
&lt;br /&gt;
There are a number of ways that combat is different in The Dark Mod.&lt;br /&gt;
&lt;br /&gt;
Keep in mind that you are not a warrior.  Guards are generally better trained than you are, and while you might win a few one-on-one battles, you will almost certainly die if facing two guards at once.&lt;br /&gt;
&lt;br /&gt;
== Blackjacking ==&lt;br /&gt;
&lt;br /&gt;
Your blackjack is more effective if your opponent is relaxed and not expecting trouble.&lt;br /&gt;
&lt;br /&gt;
You must hit an AI on the head to knock them out.  Hitting an AI anywhere else will simply alert them.  For best results, don&#039;t get too close to the AI, or you may hit them with your elbow instead of your blackjack.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;You can successfully knock out:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;1. Unarmed civilian AI from any direction, any time.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;2. Bare-headed guards from any direction when relaxed, or from behind when alert and/or their weapon is out.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;3. Helmeted guards from behind when relaxed (helmeted guards cannot be knocked out when alert and/or when their weapon is out).&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
All armed AI are harder to knock out when the AI has drawn a weapon, because they are assumed to be alert and ready for you.  Either they have searched for you or been warned by a friend that something is wrong.&lt;br /&gt;
&lt;br /&gt;
The blackjack does a small amount of damage, so you could theoretically beat someone to death with it, if you have a lot of time on your hands.&lt;br /&gt;
&lt;br /&gt;
Undead and some animals cannot be knocked out with the blackjack.&lt;br /&gt;
&lt;br /&gt;
{{update|1.01|Certain heavy-duty helmets make their wearer immune to the blackjack.  These can be identified by a face grill and a low back, which protects the base of the neck.}}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; the blackjack makes an overhead swing, so if there is something low in the way (like a doorframe) you might hit it instead of your target, especially if you are looking upwards.&lt;br /&gt;
&lt;br /&gt;
== Melee Combat ==&lt;br /&gt;
[[image:combat1.jpg|thumb|A guard winds up for an overhead attack]]&lt;br /&gt;
There is a combat arena in the Training Map for practicing combat.  After a few rounds you will have a much better feel for how it works.&lt;br /&gt;
&lt;br /&gt;
{{update|1.01|Different AI have different skill levels (novice, trained, skilled) when it comes to combat.  An armed commoner will not fight as well as an elite guard. You can also change the overall combat difficulty in the Settings menu.}}&lt;br /&gt;
&lt;br /&gt;
You can use your shortsword to attack an enemy, as well as block enemy weapons. Attacking a relaxed enemy (ie, backstabbing) does extra damage. &lt;br /&gt;
To attack, hit the Attack key. This will make a left-to-right, slashing attack. If you move the mouse while clicking the Attack key, you can select other kinds of attacks. Moving the mouse down will cause an overhead swing. Moving the mouse up will cause a thrust attack. Moving the mouse left or right will cause a right-to-left or left-to-right slash, respectively. &lt;br /&gt;
&lt;br /&gt;
AI can parry your swings (unless they are using a dagger), and they will do this more easily if you keep using the same kind of attack, so you will want to mix it up. &lt;br /&gt;
&lt;br /&gt;
The amount of damage you do varies depending on where you hit. Hitting an AI in the head will do more damage than hitting their arm or leg. Armour also plays a factor. Your sword can&#039;t penetrate plate armour, and even chainmail or leather armour will provide the AI some protection.&lt;br /&gt;
&lt;br /&gt;
To block an enemy strike, hold the Parry key.  You must hit the parry key &#039;&#039;after&#039;&#039; the AI starts winding up for their attack.  Too early and the AI will see the block and choose a different attack.  Obviously, you must also be facing the AI...holding up a block while looking off to the side won&#039;t help.&lt;br /&gt;
&lt;br /&gt;
If you are using Manual Parry (select in the Settings menu), you need to select the appropriate block.  If your opponent is making an overhead attack, you must select an overhead block.  Select blocks by moving the mouse while holding the Parry button down, just as you would for an attack.  &lt;br /&gt;
&lt;br /&gt;
If you successfully block an attack or damage your opponent the AI will be temporarily &amp;quot;flat-footed&amp;quot;. They can still attack and defend, but they will not chase you if you turn to run. The effect lasts only a second or two, but that can sometimes be enough time to give you a head start.&lt;br /&gt;
&lt;br /&gt;
The trick to a successful combat is timing. You need to try to anticipate your opponent&#039;s attacks, and then launch counter-attacks before he has a chance to parry.&lt;br /&gt;
&lt;br /&gt;
AI will usually try to flee if they are badly wounded.&lt;br /&gt;
&lt;br /&gt;
{{update|1.07|Different weapons do different amounts of damage when they hit you.  A longsword is one of the most damaging weapons, while short swords do less damage and daggers even less.}}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; It is possible to hit walls or ceilings instead of your target.  Keep track of how much space is around you when choosing your swing.&lt;br /&gt;
&lt;br /&gt;
== Missile Combat ==&lt;br /&gt;
&lt;br /&gt;
Your broadhead arrows cannot penetrate plate armour, and will do less damage if they hit chain or leather armour.  The best result is to hit unarmoured flesh.  A single arrow to the head will kill a relaxed guard.  Alert guards are assumed to be taking measures to minimize the damage from incoming arrows.  &lt;br /&gt;
&lt;br /&gt;
If you are hit while trying to fire an arrow, your attack will be canceled.&lt;br /&gt;
&lt;br /&gt;
AI will switch to missile combat if they can see you but cannot reach you.  If they don&#039;t have a missile weapon, they will become angry and start throwing things at you.&lt;br /&gt;
 &lt;br /&gt;
AI archers will fire arrows at you.  Some AI are better shots than others.  When you get within melee range of an archer, they will pull out their melee weapon to fight with it instead.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
= AI =&lt;br /&gt;
&lt;br /&gt;
== AI Senses ==&lt;br /&gt;
&lt;br /&gt;
AI can see you if your lightgem is not totally black.  The longer you&#039;re in their field of vision and the closer you are, the more likely they are to notice you and come and investigate.  &lt;br /&gt;
&lt;br /&gt;
Some AI have hoods, eyepatches, or other things that block their field of vision.  These can be exploited by clever thieves. {{red| (1.01) }}&lt;br /&gt;
&lt;br /&gt;
AI can hear your footsteps, and noise that you make from banging into things or dropping objects.  {{update|2.0|They can also hear the sound of falling bodies, so be careful where you knock out opponents.}}&lt;br /&gt;
&lt;br /&gt;
AI can also feel you if you bump into them, or vice versa.&lt;br /&gt;
&lt;br /&gt;
TDM AI are fairly intelligent about searching.  They can identify good hiding spots and will check them out first.&lt;br /&gt;
&lt;br /&gt;
When AI become alert, their senses get slightly better.  A shadow that is sufficient to hide you from a relaxed AI might not be enough for an AI that is alert and actively looking for trouble.&lt;br /&gt;
&lt;br /&gt;
AI do not forget about you after giving up the search.  They remain in an alert state, with heightened senses and their weapons out.&lt;br /&gt;
&lt;br /&gt;
== AI Behaviour ==&lt;br /&gt;
&lt;br /&gt;
AI don&#039;t necessarily patrol the exact same route every time, or stand for the same amount of time at every spot they go to.  Mappers can add as much randomness to the AI as they wish.&lt;br /&gt;
&lt;br /&gt;
AI need to see evidence in order to react to it.  If a bloodstain or missing loot is in shadow, an AI won&#039;t notice it.&lt;br /&gt;
&lt;br /&gt;
AI can react to missing objects, but only if mappers set the objects as noteworthy.&lt;br /&gt;
&lt;br /&gt;
AI become suspicious if they find a weapon lying around.  Finding blood or a body will cause them to go fully alert.&lt;br /&gt;
&lt;br /&gt;
AI can hear broadhead arrow impacts.  If you shoot an arrow and it hits a wall nearby, the AI will notice.  AI will also react to water arrows if you fire them too close (or if you hit an AI with one).  {{update|1.07|AI will notice and be suspicious of arrows that are left sticking into things.}}&lt;br /&gt;
&lt;br /&gt;
AI do not yet notice moss arrow impacts, broken objects or moss patches.  These things will likely cause minor alerts in the future.&lt;br /&gt;
&lt;br /&gt;
{{update|1.06| AI can notice and comment on lights that have been put out, and may relight ones that the mapper has set as important.  AI will start to become suspicious of an intruder if this happens frequently.}}&lt;br /&gt;
&lt;br /&gt;
{{update|1.07| AI that see a rope from a rope arrow will walk over to investigate, and will treat it as evidence of an intruder.}}&lt;br /&gt;
&lt;br /&gt;
{{update|1.07| AI can notice important doors (set by mapper) that have been left open, and will start to become suspicious.}}&lt;br /&gt;
&lt;br /&gt;
{{update|2.00| AI will turn towards doors that they see opening, and may get suspicious if they don&#039;t see anyone responsible.}} &lt;br /&gt;
&lt;br /&gt;
AI will look for 2s at a door opening in their FOV, unless they’re in combat mode.&lt;br /&gt;
&lt;br /&gt;
An AI will not look at an open door if they were the last one to handle it.&lt;br /&gt;
&lt;br /&gt;
{{update|2.03|Grabbing a closing door will cause the AI who closed it to turn and investigate, unless you let the door close almost all the way (&amp;lt;20% open?). }}&lt;br /&gt;
&lt;br /&gt;
===For an unsuspicious door:===&lt;br /&gt;
&lt;br /&gt;
The door starts to open, stims the AI, but the AI ignores it, because the door is &amp;lt; 20% open. One second later, when the next stim hits him, if the door is &amp;lt; 20% open, he&#039;ll continue to ignore it. Otherwise, he&#039;ll look at the door for 2 seconds.  Non-suspicious doors can be cracked open indefinitely w/o nearby AI noticing.&lt;br /&gt;
&lt;br /&gt;
===For a suspicious door:===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Allow player to crack open (&amp;lt; 20%) a suspicious door to peek out w/o grabbing the attention of a nearby AI. After 5s, the AI will notice the cracked open door.&lt;br /&gt;
&lt;br /&gt;
When the door is &amp;gt;20%, it stims the AI, and the AI immediately starts to look at it for 2 seconds. 1 to 1.5 seconds after the stim, while looking at the door, if no friendlies are apparent, the AI will bark and walk toward the door and begin his search.}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Gameplay]]&lt;/div&gt;</summary>
		<author><name>Springheel</name></author>
	</entry>
	<entry>
		<id>https://wiki.thedarkmod.com/index.php?title=Visportals&amp;diff=19751</id>
		<title>Visportals</title>
		<link rel="alternate" type="text/html" href="https://wiki.thedarkmod.com/index.php?title=Visportals&amp;diff=19751"/>
		<updated>2017-12-02T14:01:59Z</updated>

		<summary type="html">&lt;p&gt;Springheel: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;written by Fidcal. Visportals, Func_statics and Worldspawn Brushes added by Sotha.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Video Introduction to Visportals ==&lt;br /&gt;
[https://youtu.be/RmKjmt7IJr8 Video Introduction to Visportals.]&lt;br /&gt;
&lt;br /&gt;
== What are visportals? ==&lt;br /&gt;
Visportals are a very important part of mapping.  They are a kind of brush that helps separate your map into individual areas (called visleafs), which is important for both rendering and sound propagation.&lt;br /&gt;
&lt;br /&gt;
Without visportals, the Doom engine would render the entire map even if the player can only see one small area. This would reduce performance and slow the game down.  &lt;br /&gt;
&lt;br /&gt;
Visportals are also very important for sound propagation. Without them, sounds can travel through brushwork and reach areas of the map that they shouldn&#039;t (see &#039;&#039;Sound Propagation&#039;&#039; at the bottom of the page).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Visportals determine how far the engine should render from the player&#039;s position. When a visportal is in the player&#039;s view, the engine tests to see if there is a second visportal viewable from the position of the first. If yes then it tests to see if a third one can be seen from the second one. If the third is not viewable from the first then the engine won&#039;t waste time rendering the map beyond it. If it is, then the engine tests for a fourth one and so on. So for example, with a long corridor with lots of 90 degree turns in it and visportals at every bend then the engine will only render the section you are in plus any parts of the next section you can see. But as you get near to it and can see further down it to the next bend&#039;s visportal then it will render the next one too.&lt;br /&gt;
&lt;br /&gt;
Anything in the visleaf that the player is currently in is rendered (if it is your field of view) regardless of whether it is behind worldspawn.  But things in an adjacent visleaf will not be rendered if they are behind worldspawn.  The engine still has to calculate what the player can see and what he can&#039;t, and this still uses resources, but far less than if it were in the same visleaf as the player.  Any visleaf that is behind a closed portal is automatically beyond what the player can see, to the engine can skip testing it completely.  This is why closed visportals are so valuable for performance.&lt;br /&gt;
&lt;br /&gt;
The console command &#039;&#039;&#039;r_showPortals 1&#039;&#039;&#039; shows processed visportals as wireframe in-game for testing - even right through walls they are visible. A green wireframe is an &#039;open&#039; visportal and renders everything beyond it up to the next visportal.  A red wireframe is a &#039;closed&#039; visportal with nothing rendered beyond it and no further visportals beyond that are even processed so are not visible at all. If a visportal does not show then it is either beyond range of processing or it is not working so check it is set up correctly.&lt;br /&gt;
&lt;br /&gt;
== What is rendering? ==&lt;br /&gt;
Rendering might be regarded as the calculating of surface lighting, colour, texture, etc. Not all rendered surfaces are visible in-game but still have to be calculated. Others do not need rendering at all. Processing only takes place in the current portal area, that is, up to the nearest closed visportals. Surfaces are treated as divided into triangles for rendering purposes. The &#039;&#039;&#039;r_showTris&#039;&#039;&#039; console command shows those triangles as wireframes. In the console use &#039;&#039;&#039;r_showTris N&#039;&#039;&#039; where N is...&lt;br /&gt;
&lt;br /&gt;
*0 - Off - normal gameplay with no wireframes shown.&lt;br /&gt;
*1 - Shows only triangles that are visible in-game (not hidden behind other surfaces.) These visible surfaces are only part of what is rendered.&lt;br /&gt;
*2 - Shows as wireframes, all triangle surfaces that would be rendered in-game. This includes those hidden behind other surfaces BUT ONLY IF they face the player, even slightly. Surfaces facing away from the player are never rendered.&lt;br /&gt;
*3 - Shows as wireframes, all triangle surfaces even if not rendered.&lt;br /&gt;
&lt;br /&gt;
You can see that for the purpose of testing performance use 2 above which shows all that would be rendered (whether visible to the player or not.) You can use 3 to see &#039;&#039;all&#039;&#039; triangles up to the next closed visportal but remember not all of it will be rendered so will not affect performance.&lt;br /&gt;
&lt;br /&gt;
You might also use &#039;&#039;&#039;r_useScissor 0&#039;&#039;&#039; to show geometry outside the visportal wireframe that Doom still sends to the video card but tells it not to render. &#039;&#039;&#039;r_useScissor 1&#039;&#039;&#039; helps performance but even sending the geometry uses processor time so if you can reduce it by adjusting visportal placement so much the better.&lt;br /&gt;
&lt;br /&gt;
(Remember to return to &#039;&#039;&#039;r_useScissor 1&#039;&#039;&#039; when you are done with visportal testing.)&lt;br /&gt;
&lt;br /&gt;
Here is a short video with a decent visual breakdown:&lt;br /&gt;
&lt;br /&gt;
[http://www.gdcvault.com/play/1014234/Excerpt-Quake-Postmortem-Optimizing-Level Video]&lt;br /&gt;
&lt;br /&gt;
Another video:&lt;br /&gt;
&lt;br /&gt;
[http://youtu.be/cy4FIE7BhCQ http://img.youtube.com/vi/cy4FIE7BhCQ/1.jpg]&lt;br /&gt;
&lt;br /&gt;
== How and where to create visportals ==&lt;br /&gt;
&lt;br /&gt;
Visportals are just brushes with one face covered in visportal texture. That is the operative face. Only be concerned with that one surface as the rest of the brush merely carries it. So to create one you just....&lt;br /&gt;
&lt;br /&gt;
* Make a thin brush like a wall. Ideally make it rectangular for best sound propagation (see &#039;&#039;Sound Propagation&#039;&#039; later.) It can extend beyond the gap so does not necessarily need to be the same shape - see &#039;&#039;Where to place your Visportal&#039;&#039; later.&lt;br /&gt;
* Give it &#039;&#039;&#039;textures &amp;gt; editor &amp;gt; visportal&#039;&#039;&#039; to either of the main surfaces facing towards or away from you. It does not matter which except you need to be aware which it is because the visportal will be effective at that one face. (Use {{Ctrl}} + {{Shift}} + {{LMB}} on the face in the Dark Radiant camera view to select one face.)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Thickness ===&lt;br /&gt;
The exact thickness is not important to its effectiveness as it will only be effective from its one visportal-textured face anyway but it makes sense to keep it reasonably thin so you can see it clearly in the editor. Always think of visportals as one flat face and the rest of the brush can be ignored for functional purposes.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Where to place your Visportal ===&lt;br /&gt;
It will eventually be wedged tight like a plug into gaps, doorways, etc. between areas. The edges of the visportal-textured face of visportals should be completely sealed by or in solid &#039;&#039;worldspawn&#039;&#039; brush that has no gaps. The brush &#039;&#039;&#039;must&#039;&#039;&#039; be a child of worldspawn and &#039;&#039;&#039;not&#039;&#039;&#039; an entity. This is true even if the visportal is within a door (see next section.) For the visportal to be effective it does not matter if the rest of the visportal brush sticks out into space so long as the edges of the visportal-textured face are surrounded by worldspawn brush and/or another visportal brush (see later) In practice you will probably put most fully within a corridor or doorway, a city street (yes, the sky above is solid worldspawn brush), etc. Irregular shaped gaps must still be plugged with a rectangular visportal which should then overlap into the solid worldspawn and leave no gaps. This will also make sound propagation work correctly (see &#039;&#039;Sound Propagation&#039;&#039; later.)&lt;br /&gt;
&lt;br /&gt;
Each area you thus created must be totally enclosed with worldspawn brushes with no gaps of either space else an entity. So a closed building with visportals at the doors but a tiny gap under the eaves of the roof won&#039;t work! Also avoid only blocking gaps with entities whether brushes or models. For example, a two-sided window entity that completely fills the opening will not seal the area for portalling purposes. Do not put in a visportal unless the window is either transparent or can be opened (like a door.) Instead put in a worldspawn brush with nodraw texture on it so it will not be visible or collidable just in front of the window. &#039;&#039;[not sure what this means, but note that nodraw textures DO NOT seal visleafs.  As far as visportals are concerned, they don&#039;t exist]&#039;&#039; Or if you are using two windows back to back (say a lit one outside and an unlit one inside then a thin caulk brush between them.&lt;br /&gt;
&lt;br /&gt;
Generally you will place visportals on bends in the terrain around which the player cannot see from the current viewpoint. Avoid placing visportals in a line along a corridor or street for example. Since the player can see straight down through them all then they serve no purpose as they will all be open and visportals themselves create extra triangles and complexity (see downside section below.)&lt;br /&gt;
&lt;br /&gt;
With a large building surrounded by a walled open area then try visportals at each corner. If it is a very large building then also add visportals midway along each side. The player standing at one corner might be able to see up two sides, part of a far side, and even a small part of the fourth side so all sides would be rendered. By having extra visportals middway along each side then at least half of each side of the furthest corner need not be rendered (consider also preventing the player reaching such a viewpoint with an obstruction!)&lt;br /&gt;
&lt;br /&gt;
Subject to the above, try to find the smallest gaps where possible to place visportals. The smaller the visportal then the smaller the view aperture and so the less chance of lining up those apertures. Remember, visportals beyond the first one do not open unless they intersect all open visportals in that line of view. Even without a door, an open doorway is a better place for a visportal than a wider corridor or room beyond. Imagine trying to get a straight pole through as many of these visportal apertures as possible; the narrower and less aligned they are then the harder to get the pole very far.&lt;br /&gt;
&lt;br /&gt;
Don&#039;t get too hung up on perfect placement of every last visportal. Generally if you follow this guide and use your judgement you achieve a satisfactory game performance. Examine some large maps that you know work well to get some ideas where visportals are placed using the &#039;&#039;&#039;r_showPortals 1&#039;&#039;&#039; command.&lt;br /&gt;
&lt;br /&gt;
What if you put visportal texture on both main faces of the visportal brush? Only one will be effective. If the visportal brush juts out into space then visportal texture at that end will not work but the one at the other end will be the operative one. If you rotated the brush then it still works and uses whichever one is surrounded by solid. If both are in space it does not work at all. If both are surrounded by solid then only one works. Which one? Hard to tell. It seems to be determined by the local geometry. It is interesting to note that when you use r_showTris 3 to see what is rendered then the triangles are confined to either side of the visportal face. In other words, a long corridor wall rendered as two large triangles would now be split into four triangles. So a visportal might be considered to help with multiple lighting performance as you do not need to visually change the terrain with trim etc.&lt;br /&gt;
&lt;br /&gt;
What if you put visportal texture on all the surfaces of the brush? Only one is effective (must be surrounded by solid brush.) To be certain of optimum performance use nodraw on all surfaces except the one face with visportal texture.&lt;br /&gt;
&lt;br /&gt;
===Multiple Joined Visportals===&lt;br /&gt;
Because visportals are a single face, by their very nature they can only be placed on a single brush. But visportal brushes can be placed or merged together to fill more complex shaped gaps. For example, a wide rectangle might have one side clipped to slope over a roof while the rectangular part of its shape sits on top of another rectangle across the street below. But complexity affects performance so only do this if one rectangular visportal intruding into interior walls might do the same job. Remember, it does not matter if the visportal overlaps into solid so if there is an interior wall on the same plane (or indeed if the building is totally solid) then the visportal can penetrate it and still function. Do not use multiple visportals just to shape nicely around solid building trim and structure but intrude into it so long as the edge does not exit into space at any point it will be fine.&lt;br /&gt;
&lt;br /&gt;
== Visportals and doors ==&lt;br /&gt;
A visportal in contact with a door that has an openable property is automatically closed when the door is closed and automatically becomes conventionally operative when the door opens. By &#039;operative&#039; I mean it is then like a normal visportal and will be open or closed depending on the player&#039;s view. So when you first go through a door and leave it open then its visportal will be open as you look immediately back at it. But as you then proceed further through other visportals, the door visportal will eventually close (prevent rendering through it) even if the door itself is left open.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Doors standing in front of but not within a doorway ===&lt;br /&gt;
Note that the visportal only needs to be in contact with the door to be affected by it. Normally you would place the visportal within the door but it actually only needs its visportal-textured surface to touch it. This means that if you have a door that is stood in front of an opening in a wall then you cannot put the visportal inside the door because it will not be surrounded by solid brush. But you can put a visportal just inside the opening and flush with the mouth of the opening and the door immediately in front of that and in contact with the visportal. You can test this by placing the door offset well to one side but part of it still in contact with the visportal. In game you can see the opening as the door is only partially covering it. When the door is closed the visportal closes and stops rendering through the doorway. You will see this as a black panel in the doorway. As the door opens the black panel disappears and you can see through the doorway again. You might think that from the other side the black panel would obscure the door when closed but it doesn&#039;t. With the door centred in its normal position, typically you might have an entity frame around the door. If you had a solid brush frame without gaps then the visportal could be inside the door if you wanted as it would then have solid all round its edges. In many cases of course, the door frame, whether entity or brush, would be within the solid brush doorway anyway.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Windows, Doors with windows, bars, etc. ===&lt;br /&gt;
Openable doors that let you see through them such as windows, doors with windows, barred gates, etc. should not be in contact with a visportal. When the door is closed it will automatically close any visportal whose effective surface is in touch with it. The visportal will not then permit any rendering through it and will show as a black panel in the window or between the bars of a gate. Instead, move the visportal away from the door. It will still function effectively as a normal visportal just as if the door were not there. This does not of course apply to simulated windows such as a glazed textured panel on a door texture where you cannot actually see through.&lt;br /&gt;
&lt;br /&gt;
All doors and windows that do not have an openable property can have a visportal in touch with them as it will not be affected by them and it will just function as a normal visportal.&lt;br /&gt;
&lt;br /&gt;
{{red|Rev. 2.00:}}&lt;br /&gt;
&lt;br /&gt;
Starting with Rev. 2.00, you can touch a see-through door or window with a visportal, and the portal will not close when the door/window is closed, as long as you use the following spawnarg &#039;&#039;&#039;on the door/window&#039;&#039;&#039; (not the info_portalsettings entity):&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;transparent&#039;&#039;&#039; &amp;quot;If set to 1 (0 by default), a see-through door can touch a visportal and the visportal won&#039;t close when the door is closed.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
This is useful when you want the opening or closing of the door to affect the sound loss across the portal, but not affect visibility through the door/window. Imagine a closed window that muffles a sound beyond it, and as the window opens, the sound gets louder.&lt;br /&gt;
&lt;br /&gt;
==Visportal switches: func_portals==&lt;br /&gt;
&lt;br /&gt;
The preceding section &#039;&#039;Visportals and doors&#039;&#039; makes clear that doors can function like switches to enable and close visportals in contact with them. &#039;&#039;func_portals&#039;&#039; can be used to enact further control over portals. You can place a &#039;&#039;func_portal&#039;&#039; entity so that it intersects with a visportal, and then trigger the func_portal to close or open the visportal.  A second control method is had by using the &#039;&#039;portal_dist&#039;&#039; and &#039;&#039;distcheck_period&#039;&#039; properties on the &#039;&#039;func_portal&#039;&#039;.  They control the distance to the player and how frequently (in seconds) this distance should be checked, respectively, and make explicit triggering of the &#039;&#039;func_portal&#039;&#039; unnecessary.  As with doors, even if enabled, the visportal will not be open even if it is in the player&#039;s view.  Note, if you have a mover (door/window) in contact with the visportal, it will affect it as well, so typically a visportal controlled by func_portal is placed away from the mover, or use spawnarg &amp;quot;transparent&amp;quot; set to 1.&lt;br /&gt;
&lt;br /&gt;
Another clever trick exists with regard to &#039;&#039;func_portal&#039;&#039;s:  you can also build a func_static over the visportal, and target it with the &#039;&#039;func_portal&#039;&#039; as normal.  Now, in addition to opening and closing the portal, this will also toggle the drawing of the &#039;&#039;func_static&#039;&#039;.  This means you could place an appropriate texture (perhaps a low resolution image of a room&#039;s interior, drawn over a window) and have it turn on or off based on the player&#039;s distance away.  From a distance, the player wouldn&#039;t be able to tell that the the entire room wasn&#039;t being rendered.  This can be an effective way to create the illusion of long view distances.&lt;br /&gt;
&lt;br /&gt;
Note that the func_static must touch the visportal in order to work.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;One way to make this work is to create a patch, make it a func_static.  Texture the patch, and then target the func_portal at that func_static.  You must then add &amp;quot;hide&amp;quot; &amp;quot;1&amp;quot; to the func_static patch.  There may be other ways to make this work, but I had a lot of trouble until I took these steps.  -- Springheel&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
An interesting, recent discovery that needs some testing is that apparently:  you can take one visportal and cut it in half, and then put different func_portals on each half in order to close them at different ranges.  That has interesting implications for wide city streets.  They require big visportals, but if you can split them up and independently control each part, there may be some benefits there.  http://forums.thedarkmod.com/topic/9082-newbie-darkradiant-questions/?p=370473&lt;br /&gt;
&lt;br /&gt;
== Need I design, even compromise my map to make best use of visportals? ==&lt;br /&gt;
You need to design your map from the start as a series of connected boxes (brushes) with the player&#039;s view, sound propogation, and visportals in mind. And yes, sometimes you might need to add a bend you don&#039;t want or obstruct a view in some way so you can put in another visportal if you are having or expecting slow down in a large and/or complex area. This is a matter of experience. If you have large complex areas and are experiencing frame lag but can see no obvious place to put a visportal then you might need to compromise your terrain and add some solid brush barriers to block certain views with visportals in the access round or through them.&lt;br /&gt;
&lt;br /&gt;
Note that it is not essential that visportals be only at the actual joins between brushes; they still work even if they are half way down a corridor so long as they are wedged in tight without gaps. But you will mostly place them at joins.&lt;br /&gt;
&lt;br /&gt;
For rendering considerations, the player&#039;s view is everything and every room and street in front of you even if there are walls, etc. in the way. Imagine what you would see with X-Ray vision. What is behind you or just out of range of the screen does not matter. But visportals restrict the view to what can be seen through the aperture of the visportal.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
It is not necessary to put visportals at every tiny bend in the map; in fact that should be avoided in smaller areas because visportals themselves create extra triangles and complexity (see downside section below.) Try to keep in mind what will be rendered through the visportals and judge what would &#039;&#039;not&#039;&#039; cause frame lag slowdown if the player could actually see that view. Three or four bends without visportals in a restricted air duct is not going to cause any problem if the duct is correctly visportalled at the ends for example.&lt;br /&gt;
&lt;br /&gt;
== Is there a downside? ==&lt;br /&gt;
One downside to visportals is that is extra work for the mapper! Another is that they split the geometry and create extra triangles and batches. This will not normally cause a problem unless your map has a very large number of areas. The advantages in performance of using visportals far outweigh the downsides!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Sound Propagation==&lt;br /&gt;
&lt;br /&gt;
Correct propagation of sound (both to AI and to the player) relies on visportals.&lt;br /&gt;
&lt;br /&gt;
Think of vis-portals as sealing off separate &amp;quot;areas&amp;quot; in a map.  A sound that occurs inside a sealed &amp;quot;area&amp;quot; will travel in a straight line to anyone inside the same area, even through walls.  If you are not in the same area, however, the sound will travel in a straight line to the first visportal between you and the sound source, then to the next one, etc, until it reaches the area you are in.&lt;br /&gt;
&lt;br /&gt;
If the sound happens in an area that is not sealed, it essentially considers the whole map its &amp;quot;area&amp;quot;, and will go straight to the player, through walls, floors, or other brushwork.  This can result in confusion for players, as they will hear AI on the other side of a massive wall as if they were standing beside each other.&lt;br /&gt;
&lt;br /&gt;
In the following examples, &amp;quot;P&amp;quot; is the player and &amp;quot;S&amp;quot; is the sound source.  The Visportals are red lines. The green lines show how the sound would travel.&lt;br /&gt;
&lt;br /&gt;
[[image:vis.jpg]]&lt;br /&gt;
&lt;br /&gt;
Without any visportals, the sound goes in a straight line to the player, even through solid walls.  It will sound like the player is in the same room as the sound.&lt;br /&gt;
&lt;br /&gt;
One visportal is an improvement--it will sound further away, but the sound travels straight to the visportal and then straight to the player, so it will still sound like it is coming through the wall.  &lt;br /&gt;
&lt;br /&gt;
Two visportals are best in this case, however.  The sound will seem like it is coming from the opening to the room, which is where you would expect it to come from.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Sound &#039;&#039;going to the AI&#039;&#039; travels the shortest distance through a visportal, passing at any point on the visportal surface.  Mappers should always use rectangular visportals unless you have no choice with an awkwardly shaped gap or if the gap is out of range of AI, for example along a sloping roof where AI never go. &#039;&#039;&#039;It also still assumes that when you do have four sides, they are perpendicular.&#039;&#039;&#039; If you have some non-90 degree angles between the sides, some wierdness may ensue. For example, an AI that is alerted in the dark (or facing away) by hearing a sound from the player that passes through an irregular visportal might run to the center of the visportal rather than directly to where the player made the noise. Irregular visportals large enough to make this effect noticeable are likely to be uncommon.&lt;br /&gt;
&lt;br /&gt;
This will be okay for smaller irregular visportals, but the error (path difference from the minimal path) will get more noticeable the larger the visportal.&lt;br /&gt;
&lt;br /&gt;
Visportals function individually even if joined together into complex shapes. So a rectangle at ground level topped by an angled visportal above it tilting out over a roof will be treated separately, not as one aperture. &lt;br /&gt;
&lt;br /&gt;
The bottom line is, with any non-rectangular visportals keep the above in mind and if in doubt then consider early testing of AI&#039;s alert to player sound.&lt;br /&gt;
&lt;br /&gt;
Visportals do NOT need to be closed to correctly channel sound to the player.  Sometimes it is worth adding visportals even if they will not help with rendering (because they will always be open) in order to make sound travel the way it should.  &lt;br /&gt;
&lt;br /&gt;
To make less sound go through a visportal (through a small hole, for example):&lt;br /&gt;
Soundprop can use info_locationSeparator or info_portalSettings to make sound incur a certain loss when going through the portal it&#039;s touching. The key/value pair is the following:&lt;br /&gt;
&lt;br /&gt;
    sound_loss &amp;quot;Soundprop: Loss in dB incurred when a sound travels through this portal. Cumulative with door loss if a door is present.&amp;quot; &lt;br /&gt;
&lt;br /&gt;
The loss must be a positive number, and negative numbers will automatically be converted to positive.&lt;br /&gt;
&lt;br /&gt;
{{red|Rev 2.00:}}&lt;br /&gt;
&lt;br /&gt;
Prior to Rev 2.00, &#039;&#039;&#039;sound_loss&#039;&#039;&#039; affected the sound propagation to AI &#039;&#039;&#039;only&#039;&#039;&#039;.  Sound propagation to the player was not affected.&lt;br /&gt;
&lt;br /&gt;
Starting with Rev 2.00, &#039;&#039;&#039;sound_loss&#039;&#039;&#039; is also used in determining sound volume to the player. This aligns what AI hear with what the player hears. It also allows sound coming through the door to increase as the door opens, or decrease as the door closes, making for a more realistic experience.&lt;br /&gt;
&lt;br /&gt;
For details study: &lt;br /&gt;
[[Sound Propagation: Part 1]] and&lt;br /&gt;
[[Sound Propagation: Part 2]]&lt;br /&gt;
&lt;br /&gt;
== Trouble-shooting ==&lt;br /&gt;
&lt;br /&gt;
There are two possible problems I can think of: the visportal doesn&#039;t work at all or it works yet there is too much being rendered giving poor performance and frame lag. The latter problem is a matter of experience and experimentation. Often much ingenuity is needed to place visportals to reduce the size of areas being rendered at any one time. There is probably a different solution for every situation. Ultimately you might be forced to change the terrain to help visportalling.&lt;br /&gt;
&lt;br /&gt;
If a visportal doesn&#039;t work at all (eg, does not show as either red or green while you are directly in its area and looking at it and you have &#039;&#039;&#039;r_showPortals&#039;&#039;&#039; enabled) then that means there is a &amp;quot;leak&amp;quot; in that &#039;&#039;area&#039;&#039;.  It does not necessarily mean the visportal itself is the problem.&lt;br /&gt;
&lt;br /&gt;
Try the following to track down the problem.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Check the visportal itself:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* Check which face of the visportal is facing which way. It sometimes happen one clones a visportal and rotates it the wrong way without realizing. So the wrong face is in the right place but the visportal face is not in contact with worldspawn.&lt;br /&gt;
&lt;br /&gt;
* Make sure the visportal hasn&#039;t been assigned to an entity but is worldspawn.&lt;br /&gt;
&lt;br /&gt;
* Search for gaps anywhere around the edges of the visportal face. Check for grid snapping not only of the visportal but the surrounding brushes. A tiny difference might not be visible in the Dark Radiant grid if you are not zoomed in sufficiently.&lt;br /&gt;
&lt;br /&gt;
* Check all surrounding items to see if any are entities. Remember, the visportal &#039;&#039;&#039;face&#039;&#039;&#039; must only be surrounded by worldspawn brushes. It seems to be mostly OK if the visportal &#039;&#039;cuts through&#039;&#039; an entity so long as it meets worldspawn at its edges.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Check the area for internal leaks:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
There is a way to test an individual area for leaks.  It sounds more complicated than it is.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
1.  Filter off all entities.  Make sure visportals are NOT filtered.&lt;br /&gt;
&lt;br /&gt;
2.  Select your entire visible map (which will now be only brushwork).&lt;br /&gt;
&lt;br /&gt;
3.  Copy and paste into a new blank map.&lt;br /&gt;
&lt;br /&gt;
4.  Put the player start into the area where you think you have an internal leak. &lt;br /&gt;
 &lt;br /&gt;
5.  Take the visportals sealing that area and texture them with a solid texture.&lt;br /&gt;
&lt;br /&gt;
6.  Make sure there is only void around the map (if you have your entire map encased in a skybox brush, open a hole in a distant corner of the map).&lt;br /&gt;
&lt;br /&gt;
7.  Save the map as a new filename and run dmap.  If you do not get a leak, then the area with the player start is properly sealed.  Move the player start to a new area and repeat as needed.&lt;br /&gt;
&lt;br /&gt;
8.  If you do get a leak, open the pointfile in DR.  Because the player entity is the only entity in the map, the red line will always start there and will show you where the gap is.&lt;br /&gt;
&lt;br /&gt;
9.  Go back to your original map and fix the gap.  Repeat as needed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Having visportals that line up in parallel with each other can cause problems, usually appearing as pieces of wall that appear black or show skybox.  This can usually be fixed by moving a visportal slightly or turning one on a slight angle so they&#039;re no longer parallel.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;If all else fails, try:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* Clone the visportal and drag one edge to one side, that is, reduce its size to say half.  &lt;br /&gt;
* Select the original and drag its opposite edge the other way so you now have two visportals pressed together and which together fill the gap. Guess which side unless you suspect one side particularly (see later.)&lt;br /&gt;
* Change one of the visportals to any normal visible simple texture, stone, wood, whatever so that now the original gap is smaller and filled by just one smaller visportal. (with hindsight, I think this would probably work anyway and might even be better just leaving it as visportal so you can see which one works but I&#039;ll continue with what I did!)&lt;br /&gt;
* Check it in game.&lt;br /&gt;
* If it still does not work then reduce it further, perhaps by half as much again. In particular, go past edges of surrounding brushes (eg, if working downwards with two brushes on the left then maybe it&#039;s the top brush that is the problem so reduce the top of the visportal below its bottom edge.) Obviously as you reduce the visportal you increase the solid temporary brush you made equally to keep up so there is never a gap.&lt;br /&gt;
* If the visportal still does not work even when reduced to a slither then try the same for all four sides noting that the three sides against the slither of visportal are obviously first suspects.&lt;br /&gt;
* If eventually the visportal starts to work then you know the error is in the other section where you have the solid temporary brush. Use a process of elimination to track down exactly where the error is.&lt;br /&gt;
* You might even have to create a third temporary brush or even a fourth but you must eventually force the visportal to work even if you surround it with four new brushes! Once working, then reduce, remove, gradually until the error re-appears - that must be where the error lies. So by a process of elimination you should track down the source of the problem.&lt;br /&gt;
* The result might make not seem to make sense but at least if you locate the error you can try things to solve the problem. I had a visportal up to the sky and on its left against the top of a triangle of bricks on which rested a roof. The visportal seemed to be perfectly surrounded by worldspawn but I reduced it slightly with just a slim temporary solid test brush only one unit high above it pressing against the top of this triangle. The visportal was now working yet if I removed that slim test brush and raised the visportal to the top again then it would not work. Made no sense to me unless mathematically the very top pixel of the triangle might be regarded as infinitely thin and therefore a gap. So, I left the thin test brush and gave it sky texture so it&#039;s completely invisible and everything works.&lt;br /&gt;
&lt;br /&gt;
(Note: Some mappers at Doom3world reported that cloned visportal brushes can cause problems in a map. This was reported in an earlier Doom 3 build.)&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
There are other good visportal tutorials to be found under:&lt;br /&gt;
http://www.iddevnet.com/doom3/visportals.php and http://www.modwiki.net/wiki/Visportal&lt;br /&gt;
&lt;br /&gt;
== Visportals, Func_statics and Worldspawn Brushes  ==&lt;br /&gt;
Sometimes a visportal (VP) looks just fine in-game, but AI&#039;s behave erratically near them: cannot walk through the portal, walk into walls near the portal, can patrol through the portal but cannot chase the player through the portal. This may be due to worldspawn brushes penetrating the visportal.&lt;br /&gt;
&lt;br /&gt;
Image shows scenarios A-D of different VP placement.&lt;br /&gt;
[[image:visportal_scenarios.png]]&lt;br /&gt;
&lt;br /&gt;
*Scenario A, when VP is snugly placed in the worldspawn corridor, it always works.&lt;br /&gt;
*Scenario B, where a worldspawn brush penetrates the VP has often caused problems. It will fail with very high probability if the worldspawn brush is a monsterclip brush. Never do this scenario!  &#039;&#039;[Springheel -- I&#039;d like more confirmation on this...I&#039;m certain I&#039;ve done this on a regular basis in uneven city streets without causing any obvious problems]&#039;&#039;&lt;br /&gt;
*Scenario C is what could be used if the scene absolutely requires somethings going through the VP and scenario A or D cannot be used. Usually this must be done for big outdoors VP&#039;s as seen in Knightons Manor exterior behind the manor (it is the hedge, which goes through the VP there). Note how the worldspawn brush is cut just at the VP and it is only func_static which penetrates the VP. This has worked without issues. Note that no monsterclipping is required if the func_static segment of the VP penetrating brush is short enough. The blue worldspawn brushes could also be monsterclipped func_statics as well. If so, mapper must be certain monsterclip brushes do not penetrate the VP!&lt;br /&gt;
*Scenario D where the VP is penetrated by func_static detail work, has not been reported to break visportals. Usually this kind of case is used in vaulted corridors etc. Works just fine. If the FS detail work is in reach of AI, special care to monsterclipping should be paid and it must be absolutely sure the monsterclip does not penetrate the VP as this will always cause trouble. In this scenario it is recommended that each side of the visportal have their own func_statics and one func_static brush should never penetrate more than one visportal.&lt;br /&gt;
&lt;br /&gt;
===Conclusion===&lt;br /&gt;
Mappers should favour scenario A when possible. If detailwork requires, scenario D is okay, as well as scenario C. Never, ever use scenario B.&lt;br /&gt;
&lt;br /&gt;
If mapper has some issues with their AI pathfinding, they should check the portal isn&#039;t broken as in scenario B. It is really easy to forget wall trims etc which could pass through the VP. Also typical mistake is to automatically surround a model near the VP with monsterclip, which results monsterclip brush which penetrates the VP. It is recommended that the mapper tests every visportal (which an AI is likely to pass) in their map before the map is released. Firstly the mapper should check in DR and make sure visportals are correctly set. Ingame testing should be done both with non-alerted path_corner patrolling AI&#039;s and with an alerted AI chasing the player.&lt;br /&gt;
&lt;br /&gt;
[[Category:Skybox]]&lt;br /&gt;
[[Category:Visportal]]&lt;br /&gt;
{{tutorial-editing}}&lt;/div&gt;</summary>
		<author><name>Springheel</name></author>
	</entry>
	<entry>
		<id>https://wiki.thedarkmod.com/index.php?title=Visportals&amp;diff=19750</id>
		<title>Visportals</title>
		<link rel="alternate" type="text/html" href="https://wiki.thedarkmod.com/index.php?title=Visportals&amp;diff=19750"/>
		<updated>2017-12-02T14:01:35Z</updated>

		<summary type="html">&lt;p&gt;Springheel: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;written by Fidcal. Visportals, Func_statics and Worldspawn Brushes added by Sotha.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== What are visportals? ==&lt;br /&gt;
Visportals are a very important part of mapping.  They are a kind of brush that helps separate your map into individual areas (called visleafs), which is important for both rendering and sound propagation.&lt;br /&gt;
&lt;br /&gt;
Without visportals, the Doom engine would render the entire map even if the player can only see one small area. This would reduce performance and slow the game down.  &lt;br /&gt;
&lt;br /&gt;
Visportals are also very important for sound propagation. Without them, sounds can travel through brushwork and reach areas of the map that they shouldn&#039;t (see &#039;&#039;Sound Propagation&#039;&#039; at the bottom of the page).&lt;br /&gt;
&lt;br /&gt;
== Video Introduction to Visportals ==&lt;br /&gt;
[https://youtu.be/RmKjmt7IJr8 Video Introduction to Visportals.]&lt;br /&gt;
&lt;br /&gt;
Visportals determine how far the engine should render from the player&#039;s position. When a visportal is in the player&#039;s view, the engine tests to see if there is a second visportal viewable from the position of the first. If yes then it tests to see if a third one can be seen from the second one. If the third is not viewable from the first then the engine won&#039;t waste time rendering the map beyond it. If it is, then the engine tests for a fourth one and so on. So for example, with a long corridor with lots of 90 degree turns in it and visportals at every bend then the engine will only render the section you are in plus any parts of the next section you can see. But as you get near to it and can see further down it to the next bend&#039;s visportal then it will render the next one too.&lt;br /&gt;
&lt;br /&gt;
Anything in the visleaf that the player is currently in is rendered (if it is your field of view) regardless of whether it is behind worldspawn.  But things in an adjacent visleaf will not be rendered if they are behind worldspawn.  The engine still has to calculate what the player can see and what he can&#039;t, and this still uses resources, but far less than if it were in the same visleaf as the player.  Any visleaf that is behind a closed portal is automatically beyond what the player can see, to the engine can skip testing it completely.  This is why closed visportals are so valuable for performance.&lt;br /&gt;
&lt;br /&gt;
The console command &#039;&#039;&#039;r_showPortals 1&#039;&#039;&#039; shows processed visportals as wireframe in-game for testing - even right through walls they are visible. A green wireframe is an &#039;open&#039; visportal and renders everything beyond it up to the next visportal.  A red wireframe is a &#039;closed&#039; visportal with nothing rendered beyond it and no further visportals beyond that are even processed so are not visible at all. If a visportal does not show then it is either beyond range of processing or it is not working so check it is set up correctly.&lt;br /&gt;
&lt;br /&gt;
== What is rendering? ==&lt;br /&gt;
Rendering might be regarded as the calculating of surface lighting, colour, texture, etc. Not all rendered surfaces are visible in-game but still have to be calculated. Others do not need rendering at all. Processing only takes place in the current portal area, that is, up to the nearest closed visportals. Surfaces are treated as divided into triangles for rendering purposes. The &#039;&#039;&#039;r_showTris&#039;&#039;&#039; console command shows those triangles as wireframes. In the console use &#039;&#039;&#039;r_showTris N&#039;&#039;&#039; where N is...&lt;br /&gt;
&lt;br /&gt;
*0 - Off - normal gameplay with no wireframes shown.&lt;br /&gt;
*1 - Shows only triangles that are visible in-game (not hidden behind other surfaces.) These visible surfaces are only part of what is rendered.&lt;br /&gt;
*2 - Shows as wireframes, all triangle surfaces that would be rendered in-game. This includes those hidden behind other surfaces BUT ONLY IF they face the player, even slightly. Surfaces facing away from the player are never rendered.&lt;br /&gt;
*3 - Shows as wireframes, all triangle surfaces even if not rendered.&lt;br /&gt;
&lt;br /&gt;
You can see that for the purpose of testing performance use 2 above which shows all that would be rendered (whether visible to the player or not.) You can use 3 to see &#039;&#039;all&#039;&#039; triangles up to the next closed visportal but remember not all of it will be rendered so will not affect performance.&lt;br /&gt;
&lt;br /&gt;
You might also use &#039;&#039;&#039;r_useScissor 0&#039;&#039;&#039; to show geometry outside the visportal wireframe that Doom still sends to the video card but tells it not to render. &#039;&#039;&#039;r_useScissor 1&#039;&#039;&#039; helps performance but even sending the geometry uses processor time so if you can reduce it by adjusting visportal placement so much the better.&lt;br /&gt;
&lt;br /&gt;
(Remember to return to &#039;&#039;&#039;r_useScissor 1&#039;&#039;&#039; when you are done with visportal testing.)&lt;br /&gt;
&lt;br /&gt;
Here is a short video with a decent visual breakdown:&lt;br /&gt;
&lt;br /&gt;
[http://www.gdcvault.com/play/1014234/Excerpt-Quake-Postmortem-Optimizing-Level Video]&lt;br /&gt;
&lt;br /&gt;
Another video:&lt;br /&gt;
&lt;br /&gt;
[http://youtu.be/cy4FIE7BhCQ http://img.youtube.com/vi/cy4FIE7BhCQ/1.jpg]&lt;br /&gt;
&lt;br /&gt;
== How and where to create visportals ==&lt;br /&gt;
&lt;br /&gt;
Visportals are just brushes with one face covered in visportal texture. That is the operative face. Only be concerned with that one surface as the rest of the brush merely carries it. So to create one you just....&lt;br /&gt;
&lt;br /&gt;
* Make a thin brush like a wall. Ideally make it rectangular for best sound propagation (see &#039;&#039;Sound Propagation&#039;&#039; later.) It can extend beyond the gap so does not necessarily need to be the same shape - see &#039;&#039;Where to place your Visportal&#039;&#039; later.&lt;br /&gt;
* Give it &#039;&#039;&#039;textures &amp;gt; editor &amp;gt; visportal&#039;&#039;&#039; to either of the main surfaces facing towards or away from you. It does not matter which except you need to be aware which it is because the visportal will be effective at that one face. (Use {{Ctrl}} + {{Shift}} + {{LMB}} on the face in the Dark Radiant camera view to select one face.)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Thickness ===&lt;br /&gt;
The exact thickness is not important to its effectiveness as it will only be effective from its one visportal-textured face anyway but it makes sense to keep it reasonably thin so you can see it clearly in the editor. Always think of visportals as one flat face and the rest of the brush can be ignored for functional purposes.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Where to place your Visportal ===&lt;br /&gt;
It will eventually be wedged tight like a plug into gaps, doorways, etc. between areas. The edges of the visportal-textured face of visportals should be completely sealed by or in solid &#039;&#039;worldspawn&#039;&#039; brush that has no gaps. The brush &#039;&#039;&#039;must&#039;&#039;&#039; be a child of worldspawn and &#039;&#039;&#039;not&#039;&#039;&#039; an entity. This is true even if the visportal is within a door (see next section.) For the visportal to be effective it does not matter if the rest of the visportal brush sticks out into space so long as the edges of the visportal-textured face are surrounded by worldspawn brush and/or another visportal brush (see later) In practice you will probably put most fully within a corridor or doorway, a city street (yes, the sky above is solid worldspawn brush), etc. Irregular shaped gaps must still be plugged with a rectangular visportal which should then overlap into the solid worldspawn and leave no gaps. This will also make sound propagation work correctly (see &#039;&#039;Sound Propagation&#039;&#039; later.)&lt;br /&gt;
&lt;br /&gt;
Each area you thus created must be totally enclosed with worldspawn brushes with no gaps of either space else an entity. So a closed building with visportals at the doors but a tiny gap under the eaves of the roof won&#039;t work! Also avoid only blocking gaps with entities whether brushes or models. For example, a two-sided window entity that completely fills the opening will not seal the area for portalling purposes. Do not put in a visportal unless the window is either transparent or can be opened (like a door.) Instead put in a worldspawn brush with nodraw texture on it so it will not be visible or collidable just in front of the window. &#039;&#039;[not sure what this means, but note that nodraw textures DO NOT seal visleafs.  As far as visportals are concerned, they don&#039;t exist]&#039;&#039; Or if you are using two windows back to back (say a lit one outside and an unlit one inside then a thin caulk brush between them.&lt;br /&gt;
&lt;br /&gt;
Generally you will place visportals on bends in the terrain around which the player cannot see from the current viewpoint. Avoid placing visportals in a line along a corridor or street for example. Since the player can see straight down through them all then they serve no purpose as they will all be open and visportals themselves create extra triangles and complexity (see downside section below.)&lt;br /&gt;
&lt;br /&gt;
With a large building surrounded by a walled open area then try visportals at each corner. If it is a very large building then also add visportals midway along each side. The player standing at one corner might be able to see up two sides, part of a far side, and even a small part of the fourth side so all sides would be rendered. By having extra visportals middway along each side then at least half of each side of the furthest corner need not be rendered (consider also preventing the player reaching such a viewpoint with an obstruction!)&lt;br /&gt;
&lt;br /&gt;
Subject to the above, try to find the smallest gaps where possible to place visportals. The smaller the visportal then the smaller the view aperture and so the less chance of lining up those apertures. Remember, visportals beyond the first one do not open unless they intersect all open visportals in that line of view. Even without a door, an open doorway is a better place for a visportal than a wider corridor or room beyond. Imagine trying to get a straight pole through as many of these visportal apertures as possible; the narrower and less aligned they are then the harder to get the pole very far.&lt;br /&gt;
&lt;br /&gt;
Don&#039;t get too hung up on perfect placement of every last visportal. Generally if you follow this guide and use your judgement you achieve a satisfactory game performance. Examine some large maps that you know work well to get some ideas where visportals are placed using the &#039;&#039;&#039;r_showPortals 1&#039;&#039;&#039; command.&lt;br /&gt;
&lt;br /&gt;
What if you put visportal texture on both main faces of the visportal brush? Only one will be effective. If the visportal brush juts out into space then visportal texture at that end will not work but the one at the other end will be the operative one. If you rotated the brush then it still works and uses whichever one is surrounded by solid. If both are in space it does not work at all. If both are surrounded by solid then only one works. Which one? Hard to tell. It seems to be determined by the local geometry. It is interesting to note that when you use r_showTris 3 to see what is rendered then the triangles are confined to either side of the visportal face. In other words, a long corridor wall rendered as two large triangles would now be split into four triangles. So a visportal might be considered to help with multiple lighting performance as you do not need to visually change the terrain with trim etc.&lt;br /&gt;
&lt;br /&gt;
What if you put visportal texture on all the surfaces of the brush? Only one is effective (must be surrounded by solid brush.) To be certain of optimum performance use nodraw on all surfaces except the one face with visportal texture.&lt;br /&gt;
&lt;br /&gt;
===Multiple Joined Visportals===&lt;br /&gt;
Because visportals are a single face, by their very nature they can only be placed on a single brush. But visportal brushes can be placed or merged together to fill more complex shaped gaps. For example, a wide rectangle might have one side clipped to slope over a roof while the rectangular part of its shape sits on top of another rectangle across the street below. But complexity affects performance so only do this if one rectangular visportal intruding into interior walls might do the same job. Remember, it does not matter if the visportal overlaps into solid so if there is an interior wall on the same plane (or indeed if the building is totally solid) then the visportal can penetrate it and still function. Do not use multiple visportals just to shape nicely around solid building trim and structure but intrude into it so long as the edge does not exit into space at any point it will be fine.&lt;br /&gt;
&lt;br /&gt;
== Visportals and doors ==&lt;br /&gt;
A visportal in contact with a door that has an openable property is automatically closed when the door is closed and automatically becomes conventionally operative when the door opens. By &#039;operative&#039; I mean it is then like a normal visportal and will be open or closed depending on the player&#039;s view. So when you first go through a door and leave it open then its visportal will be open as you look immediately back at it. But as you then proceed further through other visportals, the door visportal will eventually close (prevent rendering through it) even if the door itself is left open.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Doors standing in front of but not within a doorway ===&lt;br /&gt;
Note that the visportal only needs to be in contact with the door to be affected by it. Normally you would place the visportal within the door but it actually only needs its visportal-textured surface to touch it. This means that if you have a door that is stood in front of an opening in a wall then you cannot put the visportal inside the door because it will not be surrounded by solid brush. But you can put a visportal just inside the opening and flush with the mouth of the opening and the door immediately in front of that and in contact with the visportal. You can test this by placing the door offset well to one side but part of it still in contact with the visportal. In game you can see the opening as the door is only partially covering it. When the door is closed the visportal closes and stops rendering through the doorway. You will see this as a black panel in the doorway. As the door opens the black panel disappears and you can see through the doorway again. You might think that from the other side the black panel would obscure the door when closed but it doesn&#039;t. With the door centred in its normal position, typically you might have an entity frame around the door. If you had a solid brush frame without gaps then the visportal could be inside the door if you wanted as it would then have solid all round its edges. In many cases of course, the door frame, whether entity or brush, would be within the solid brush doorway anyway.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Windows, Doors with windows, bars, etc. ===&lt;br /&gt;
Openable doors that let you see through them such as windows, doors with windows, barred gates, etc. should not be in contact with a visportal. When the door is closed it will automatically close any visportal whose effective surface is in touch with it. The visportal will not then permit any rendering through it and will show as a black panel in the window or between the bars of a gate. Instead, move the visportal away from the door. It will still function effectively as a normal visportal just as if the door were not there. This does not of course apply to simulated windows such as a glazed textured panel on a door texture where you cannot actually see through.&lt;br /&gt;
&lt;br /&gt;
All doors and windows that do not have an openable property can have a visportal in touch with them as it will not be affected by them and it will just function as a normal visportal.&lt;br /&gt;
&lt;br /&gt;
{{red|Rev. 2.00:}}&lt;br /&gt;
&lt;br /&gt;
Starting with Rev. 2.00, you can touch a see-through door or window with a visportal, and the portal will not close when the door/window is closed, as long as you use the following spawnarg &#039;&#039;&#039;on the door/window&#039;&#039;&#039; (not the info_portalsettings entity):&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;transparent&#039;&#039;&#039; &amp;quot;If set to 1 (0 by default), a see-through door can touch a visportal and the visportal won&#039;t close when the door is closed.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
This is useful when you want the opening or closing of the door to affect the sound loss across the portal, but not affect visibility through the door/window. Imagine a closed window that muffles a sound beyond it, and as the window opens, the sound gets louder.&lt;br /&gt;
&lt;br /&gt;
==Visportal switches: func_portals==&lt;br /&gt;
&lt;br /&gt;
The preceding section &#039;&#039;Visportals and doors&#039;&#039; makes clear that doors can function like switches to enable and close visportals in contact with them. &#039;&#039;func_portals&#039;&#039; can be used to enact further control over portals. You can place a &#039;&#039;func_portal&#039;&#039; entity so that it intersects with a visportal, and then trigger the func_portal to close or open the visportal.  A second control method is had by using the &#039;&#039;portal_dist&#039;&#039; and &#039;&#039;distcheck_period&#039;&#039; properties on the &#039;&#039;func_portal&#039;&#039;.  They control the distance to the player and how frequently (in seconds) this distance should be checked, respectively, and make explicit triggering of the &#039;&#039;func_portal&#039;&#039; unnecessary.  As with doors, even if enabled, the visportal will not be open even if it is in the player&#039;s view.  Note, if you have a mover (door/window) in contact with the visportal, it will affect it as well, so typically a visportal controlled by func_portal is placed away from the mover, or use spawnarg &amp;quot;transparent&amp;quot; set to 1.&lt;br /&gt;
&lt;br /&gt;
Another clever trick exists with regard to &#039;&#039;func_portal&#039;&#039;s:  you can also build a func_static over the visportal, and target it with the &#039;&#039;func_portal&#039;&#039; as normal.  Now, in addition to opening and closing the portal, this will also toggle the drawing of the &#039;&#039;func_static&#039;&#039;.  This means you could place an appropriate texture (perhaps a low resolution image of a room&#039;s interior, drawn over a window) and have it turn on or off based on the player&#039;s distance away.  From a distance, the player wouldn&#039;t be able to tell that the the entire room wasn&#039;t being rendered.  This can be an effective way to create the illusion of long view distances.&lt;br /&gt;
&lt;br /&gt;
Note that the func_static must touch the visportal in order to work.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;One way to make this work is to create a patch, make it a func_static.  Texture the patch, and then target the func_portal at that func_static.  You must then add &amp;quot;hide&amp;quot; &amp;quot;1&amp;quot; to the func_static patch.  There may be other ways to make this work, but I had a lot of trouble until I took these steps.  -- Springheel&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
An interesting, recent discovery that needs some testing is that apparently:  you can take one visportal and cut it in half, and then put different func_portals on each half in order to close them at different ranges.  That has interesting implications for wide city streets.  They require big visportals, but if you can split them up and independently control each part, there may be some benefits there.  http://forums.thedarkmod.com/topic/9082-newbie-darkradiant-questions/?p=370473&lt;br /&gt;
&lt;br /&gt;
== Need I design, even compromise my map to make best use of visportals? ==&lt;br /&gt;
You need to design your map from the start as a series of connected boxes (brushes) with the player&#039;s view, sound propogation, and visportals in mind. And yes, sometimes you might need to add a bend you don&#039;t want or obstruct a view in some way so you can put in another visportal if you are having or expecting slow down in a large and/or complex area. This is a matter of experience. If you have large complex areas and are experiencing frame lag but can see no obvious place to put a visportal then you might need to compromise your terrain and add some solid brush barriers to block certain views with visportals in the access round or through them.&lt;br /&gt;
&lt;br /&gt;
Note that it is not essential that visportals be only at the actual joins between brushes; they still work even if they are half way down a corridor so long as they are wedged in tight without gaps. But you will mostly place them at joins.&lt;br /&gt;
&lt;br /&gt;
For rendering considerations, the player&#039;s view is everything and every room and street in front of you even if there are walls, etc. in the way. Imagine what you would see with X-Ray vision. What is behind you or just out of range of the screen does not matter. But visportals restrict the view to what can be seen through the aperture of the visportal.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
It is not necessary to put visportals at every tiny bend in the map; in fact that should be avoided in smaller areas because visportals themselves create extra triangles and complexity (see downside section below.) Try to keep in mind what will be rendered through the visportals and judge what would &#039;&#039;not&#039;&#039; cause frame lag slowdown if the player could actually see that view. Three or four bends without visportals in a restricted air duct is not going to cause any problem if the duct is correctly visportalled at the ends for example.&lt;br /&gt;
&lt;br /&gt;
== Is there a downside? ==&lt;br /&gt;
One downside to visportals is that is extra work for the mapper! Another is that they split the geometry and create extra triangles and batches. This will not normally cause a problem unless your map has a very large number of areas. The advantages in performance of using visportals far outweigh the downsides!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Sound Propagation==&lt;br /&gt;
&lt;br /&gt;
Correct propagation of sound (both to AI and to the player) relies on visportals.&lt;br /&gt;
&lt;br /&gt;
Think of vis-portals as sealing off separate &amp;quot;areas&amp;quot; in a map.  A sound that occurs inside a sealed &amp;quot;area&amp;quot; will travel in a straight line to anyone inside the same area, even through walls.  If you are not in the same area, however, the sound will travel in a straight line to the first visportal between you and the sound source, then to the next one, etc, until it reaches the area you are in.&lt;br /&gt;
&lt;br /&gt;
If the sound happens in an area that is not sealed, it essentially considers the whole map its &amp;quot;area&amp;quot;, and will go straight to the player, through walls, floors, or other brushwork.  This can result in confusion for players, as they will hear AI on the other side of a massive wall as if they were standing beside each other.&lt;br /&gt;
&lt;br /&gt;
In the following examples, &amp;quot;P&amp;quot; is the player and &amp;quot;S&amp;quot; is the sound source.  The Visportals are red lines. The green lines show how the sound would travel.&lt;br /&gt;
&lt;br /&gt;
[[image:vis.jpg]]&lt;br /&gt;
&lt;br /&gt;
Without any visportals, the sound goes in a straight line to the player, even through solid walls.  It will sound like the player is in the same room as the sound.&lt;br /&gt;
&lt;br /&gt;
One visportal is an improvement--it will sound further away, but the sound travels straight to the visportal and then straight to the player, so it will still sound like it is coming through the wall.  &lt;br /&gt;
&lt;br /&gt;
Two visportals are best in this case, however.  The sound will seem like it is coming from the opening to the room, which is where you would expect it to come from.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Sound &#039;&#039;going to the AI&#039;&#039; travels the shortest distance through a visportal, passing at any point on the visportal surface.  Mappers should always use rectangular visportals unless you have no choice with an awkwardly shaped gap or if the gap is out of range of AI, for example along a sloping roof where AI never go. &#039;&#039;&#039;It also still assumes that when you do have four sides, they are perpendicular.&#039;&#039;&#039; If you have some non-90 degree angles between the sides, some wierdness may ensue. For example, an AI that is alerted in the dark (or facing away) by hearing a sound from the player that passes through an irregular visportal might run to the center of the visportal rather than directly to where the player made the noise. Irregular visportals large enough to make this effect noticeable are likely to be uncommon.&lt;br /&gt;
&lt;br /&gt;
This will be okay for smaller irregular visportals, but the error (path difference from the minimal path) will get more noticeable the larger the visportal.&lt;br /&gt;
&lt;br /&gt;
Visportals function individually even if joined together into complex shapes. So a rectangle at ground level topped by an angled visportal above it tilting out over a roof will be treated separately, not as one aperture. &lt;br /&gt;
&lt;br /&gt;
The bottom line is, with any non-rectangular visportals keep the above in mind and if in doubt then consider early testing of AI&#039;s alert to player sound.&lt;br /&gt;
&lt;br /&gt;
Visportals do NOT need to be closed to correctly channel sound to the player.  Sometimes it is worth adding visportals even if they will not help with rendering (because they will always be open) in order to make sound travel the way it should.  &lt;br /&gt;
&lt;br /&gt;
To make less sound go through a visportal (through a small hole, for example):&lt;br /&gt;
Soundprop can use info_locationSeparator or info_portalSettings to make sound incur a certain loss when going through the portal it&#039;s touching. The key/value pair is the following:&lt;br /&gt;
&lt;br /&gt;
    sound_loss &amp;quot;Soundprop: Loss in dB incurred when a sound travels through this portal. Cumulative with door loss if a door is present.&amp;quot; &lt;br /&gt;
&lt;br /&gt;
The loss must be a positive number, and negative numbers will automatically be converted to positive.&lt;br /&gt;
&lt;br /&gt;
{{red|Rev 2.00:}}&lt;br /&gt;
&lt;br /&gt;
Prior to Rev 2.00, &#039;&#039;&#039;sound_loss&#039;&#039;&#039; affected the sound propagation to AI &#039;&#039;&#039;only&#039;&#039;&#039;.  Sound propagation to the player was not affected.&lt;br /&gt;
&lt;br /&gt;
Starting with Rev 2.00, &#039;&#039;&#039;sound_loss&#039;&#039;&#039; is also used in determining sound volume to the player. This aligns what AI hear with what the player hears. It also allows sound coming through the door to increase as the door opens, or decrease as the door closes, making for a more realistic experience.&lt;br /&gt;
&lt;br /&gt;
For details study: &lt;br /&gt;
[[Sound Propagation: Part 1]] and&lt;br /&gt;
[[Sound Propagation: Part 2]]&lt;br /&gt;
&lt;br /&gt;
== Trouble-shooting ==&lt;br /&gt;
&lt;br /&gt;
There are two possible problems I can think of: the visportal doesn&#039;t work at all or it works yet there is too much being rendered giving poor performance and frame lag. The latter problem is a matter of experience and experimentation. Often much ingenuity is needed to place visportals to reduce the size of areas being rendered at any one time. There is probably a different solution for every situation. Ultimately you might be forced to change the terrain to help visportalling.&lt;br /&gt;
&lt;br /&gt;
If a visportal doesn&#039;t work at all (eg, does not show as either red or green while you are directly in its area and looking at it and you have &#039;&#039;&#039;r_showPortals&#039;&#039;&#039; enabled) then that means there is a &amp;quot;leak&amp;quot; in that &#039;&#039;area&#039;&#039;.  It does not necessarily mean the visportal itself is the problem.&lt;br /&gt;
&lt;br /&gt;
Try the following to track down the problem.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Check the visportal itself:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* Check which face of the visportal is facing which way. It sometimes happen one clones a visportal and rotates it the wrong way without realizing. So the wrong face is in the right place but the visportal face is not in contact with worldspawn.&lt;br /&gt;
&lt;br /&gt;
* Make sure the visportal hasn&#039;t been assigned to an entity but is worldspawn.&lt;br /&gt;
&lt;br /&gt;
* Search for gaps anywhere around the edges of the visportal face. Check for grid snapping not only of the visportal but the surrounding brushes. A tiny difference might not be visible in the Dark Radiant grid if you are not zoomed in sufficiently.&lt;br /&gt;
&lt;br /&gt;
* Check all surrounding items to see if any are entities. Remember, the visportal &#039;&#039;&#039;face&#039;&#039;&#039; must only be surrounded by worldspawn brushes. It seems to be mostly OK if the visportal &#039;&#039;cuts through&#039;&#039; an entity so long as it meets worldspawn at its edges.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Check the area for internal leaks:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
There is a way to test an individual area for leaks.  It sounds more complicated than it is.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
1.  Filter off all entities.  Make sure visportals are NOT filtered.&lt;br /&gt;
&lt;br /&gt;
2.  Select your entire visible map (which will now be only brushwork).&lt;br /&gt;
&lt;br /&gt;
3.  Copy and paste into a new blank map.&lt;br /&gt;
&lt;br /&gt;
4.  Put the player start into the area where you think you have an internal leak. &lt;br /&gt;
 &lt;br /&gt;
5.  Take the visportals sealing that area and texture them with a solid texture.&lt;br /&gt;
&lt;br /&gt;
6.  Make sure there is only void around the map (if you have your entire map encased in a skybox brush, open a hole in a distant corner of the map).&lt;br /&gt;
&lt;br /&gt;
7.  Save the map as a new filename and run dmap.  If you do not get a leak, then the area with the player start is properly sealed.  Move the player start to a new area and repeat as needed.&lt;br /&gt;
&lt;br /&gt;
8.  If you do get a leak, open the pointfile in DR.  Because the player entity is the only entity in the map, the red line will always start there and will show you where the gap is.&lt;br /&gt;
&lt;br /&gt;
9.  Go back to your original map and fix the gap.  Repeat as needed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Having visportals that line up in parallel with each other can cause problems, usually appearing as pieces of wall that appear black or show skybox.  This can usually be fixed by moving a visportal slightly or turning one on a slight angle so they&#039;re no longer parallel.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;If all else fails, try:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* Clone the visportal and drag one edge to one side, that is, reduce its size to say half.  &lt;br /&gt;
* Select the original and drag its opposite edge the other way so you now have two visportals pressed together and which together fill the gap. Guess which side unless you suspect one side particularly (see later.)&lt;br /&gt;
* Change one of the visportals to any normal visible simple texture, stone, wood, whatever so that now the original gap is smaller and filled by just one smaller visportal. (with hindsight, I think this would probably work anyway and might even be better just leaving it as visportal so you can see which one works but I&#039;ll continue with what I did!)&lt;br /&gt;
* Check it in game.&lt;br /&gt;
* If it still does not work then reduce it further, perhaps by half as much again. In particular, go past edges of surrounding brushes (eg, if working downwards with two brushes on the left then maybe it&#039;s the top brush that is the problem so reduce the top of the visportal below its bottom edge.) Obviously as you reduce the visportal you increase the solid temporary brush you made equally to keep up so there is never a gap.&lt;br /&gt;
* If the visportal still does not work even when reduced to a slither then try the same for all four sides noting that the three sides against the slither of visportal are obviously first suspects.&lt;br /&gt;
* If eventually the visportal starts to work then you know the error is in the other section where you have the solid temporary brush. Use a process of elimination to track down exactly where the error is.&lt;br /&gt;
* You might even have to create a third temporary brush or even a fourth but you must eventually force the visportal to work even if you surround it with four new brushes! Once working, then reduce, remove, gradually until the error re-appears - that must be where the error lies. So by a process of elimination you should track down the source of the problem.&lt;br /&gt;
* The result might make not seem to make sense but at least if you locate the error you can try things to solve the problem. I had a visportal up to the sky and on its left against the top of a triangle of bricks on which rested a roof. The visportal seemed to be perfectly surrounded by worldspawn but I reduced it slightly with just a slim temporary solid test brush only one unit high above it pressing against the top of this triangle. The visportal was now working yet if I removed that slim test brush and raised the visportal to the top again then it would not work. Made no sense to me unless mathematically the very top pixel of the triangle might be regarded as infinitely thin and therefore a gap. So, I left the thin test brush and gave it sky texture so it&#039;s completely invisible and everything works.&lt;br /&gt;
&lt;br /&gt;
(Note: Some mappers at Doom3world reported that cloned visportal brushes can cause problems in a map. This was reported in an earlier Doom 3 build.)&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
There are other good visportal tutorials to be found under:&lt;br /&gt;
http://www.iddevnet.com/doom3/visportals.php and http://www.modwiki.net/wiki/Visportal&lt;br /&gt;
&lt;br /&gt;
== Visportals, Func_statics and Worldspawn Brushes  ==&lt;br /&gt;
Sometimes a visportal (VP) looks just fine in-game, but AI&#039;s behave erratically near them: cannot walk through the portal, walk into walls near the portal, can patrol through the portal but cannot chase the player through the portal. This may be due to worldspawn brushes penetrating the visportal.&lt;br /&gt;
&lt;br /&gt;
Image shows scenarios A-D of different VP placement.&lt;br /&gt;
[[image:visportal_scenarios.png]]&lt;br /&gt;
&lt;br /&gt;
*Scenario A, when VP is snugly placed in the worldspawn corridor, it always works.&lt;br /&gt;
*Scenario B, where a worldspawn brush penetrates the VP has often caused problems. It will fail with very high probability if the worldspawn brush is a monsterclip brush. Never do this scenario!  &#039;&#039;[Springheel -- I&#039;d like more confirmation on this...I&#039;m certain I&#039;ve done this on a regular basis in uneven city streets without causing any obvious problems]&#039;&#039;&lt;br /&gt;
*Scenario C is what could be used if the scene absolutely requires somethings going through the VP and scenario A or D cannot be used. Usually this must be done for big outdoors VP&#039;s as seen in Knightons Manor exterior behind the manor (it is the hedge, which goes through the VP there). Note how the worldspawn brush is cut just at the VP and it is only func_static which penetrates the VP. This has worked without issues. Note that no monsterclipping is required if the func_static segment of the VP penetrating brush is short enough. The blue worldspawn brushes could also be monsterclipped func_statics as well. If so, mapper must be certain monsterclip brushes do not penetrate the VP!&lt;br /&gt;
*Scenario D where the VP is penetrated by func_static detail work, has not been reported to break visportals. Usually this kind of case is used in vaulted corridors etc. Works just fine. If the FS detail work is in reach of AI, special care to monsterclipping should be paid and it must be absolutely sure the monsterclip does not penetrate the VP as this will always cause trouble. In this scenario it is recommended that each side of the visportal have their own func_statics and one func_static brush should never penetrate more than one visportal.&lt;br /&gt;
&lt;br /&gt;
===Conclusion===&lt;br /&gt;
Mappers should favour scenario A when possible. If detailwork requires, scenario D is okay, as well as scenario C. Never, ever use scenario B.&lt;br /&gt;
&lt;br /&gt;
If mapper has some issues with their AI pathfinding, they should check the portal isn&#039;t broken as in scenario B. It is really easy to forget wall trims etc which could pass through the VP. Also typical mistake is to automatically surround a model near the VP with monsterclip, which results monsterclip brush which penetrates the VP. It is recommended that the mapper tests every visportal (which an AI is likely to pass) in their map before the map is released. Firstly the mapper should check in DR and make sure visportals are correctly set. Ingame testing should be done both with non-alerted path_corner patrolling AI&#039;s and with an alerted AI chasing the player.&lt;br /&gt;
&lt;br /&gt;
[[Category:Skybox]]&lt;br /&gt;
[[Category:Visportal]]&lt;br /&gt;
{{tutorial-editing}}&lt;/div&gt;</summary>
		<author><name>Springheel</name></author>
	</entry>
	<entry>
		<id>https://wiki.thedarkmod.com/index.php?title=Visportals&amp;diff=19749</id>
		<title>Visportals</title>
		<link rel="alternate" type="text/html" href="https://wiki.thedarkmod.com/index.php?title=Visportals&amp;diff=19749"/>
		<updated>2017-12-02T13:44:22Z</updated>

		<summary type="html">&lt;p&gt;Springheel: /* Where to place your Visportal */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;written by Fidcal. Visportals, Func_statics and Worldspawn Brushes added by Sotha.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== What are visportals? ==&lt;br /&gt;
Visportals are a very important part of mapping.  They are a kind of brush that helps separate your map into individual areas (called visleafs), which is important for both rendering and sound propagation.&lt;br /&gt;
&lt;br /&gt;
Without visportals, the Doom engine would render the entire map even if the player can only see one small area. This would reduce performance and slow the game down.  &lt;br /&gt;
&lt;br /&gt;
Visportals are also very important for sound propagation. Without them, sounds can travel through brushwork and reach areas of the map that they shouldn&#039;t (see &#039;&#039;Sound Propagation&#039;&#039; at the bottom of the page).&lt;br /&gt;
&lt;br /&gt;
[https://youtu.be/RmKjmt7IJr8 Video Introduction to Visportals.]&lt;br /&gt;
&lt;br /&gt;
Visportals determine how far the engine should render from the player&#039;s position. When a visportal is in the player&#039;s view, the engine tests to see if there is a second visportal viewable from the position of the first. If yes then it tests to see if a third one can be seen from the second one. If the third is not viewable from the first then the engine won&#039;t waste time rendering the map beyond it. If it is, then the engine tests for a fourth one and so on. So for example, with a long corridor with lots of 90 degree turns in it and visportals at every bend then the engine will only render the section you are in plus any parts of the next section you can see. But as you get near to it and can see further down it to the next bend&#039;s visportal then it will render the next one too.&lt;br /&gt;
&lt;br /&gt;
Anything in the visleaf that the player is currently in is rendered (if it is your field of view) regardless of whether it is behind worldspawn.  But things in an adjacent visleaf will not be rendered if they are behind worldspawn.  The engine still has to calculate what the player can see and what he can&#039;t, and this still uses resources, but far less than if it were in the same visleaf as the player.  Any visleaf that is behind a closed portal is automatically beyond what the player can see, to the engine can skip testing it completely.  This is why closed visportals are so valuable for performance.&lt;br /&gt;
&lt;br /&gt;
The console command &#039;&#039;&#039;r_showPortals 1&#039;&#039;&#039; shows processed visportals as wireframe in-game for testing - even right through walls they are visible. A green wireframe is an &#039;open&#039; visportal and renders everything beyond it up to the next visportal.  A red wireframe is a &#039;closed&#039; visportal with nothing rendered beyond it and no further visportals beyond that are even processed so are not visible at all. If a visportal does not show then it is either beyond range of processing or it is not working so check it is set up correctly.&lt;br /&gt;
&lt;br /&gt;
== What is rendering? ==&lt;br /&gt;
Rendering might be regarded as the calculating of surface lighting, colour, texture, etc. Not all rendered surfaces are visible in-game but still have to be calculated. Others do not need rendering at all. Processing only takes place in the current portal area, that is, up to the nearest closed visportals. Surfaces are treated as divided into triangles for rendering purposes. The &#039;&#039;&#039;r_showTris&#039;&#039;&#039; console command shows those triangles as wireframes. In the console use &#039;&#039;&#039;r_showTris N&#039;&#039;&#039; where N is...&lt;br /&gt;
&lt;br /&gt;
*0 - Off - normal gameplay with no wireframes shown.&lt;br /&gt;
*1 - Shows only triangles that are visible in-game (not hidden behind other surfaces.) These visible surfaces are only part of what is rendered.&lt;br /&gt;
*2 - Shows as wireframes, all triangle surfaces that would be rendered in-game. This includes those hidden behind other surfaces BUT ONLY IF they face the player, even slightly. Surfaces facing away from the player are never rendered.&lt;br /&gt;
*3 - Shows as wireframes, all triangle surfaces even if not rendered.&lt;br /&gt;
&lt;br /&gt;
You can see that for the purpose of testing performance use 2 above which shows all that would be rendered (whether visible to the player or not.) You can use 3 to see &#039;&#039;all&#039;&#039; triangles up to the next closed visportal but remember not all of it will be rendered so will not affect performance.&lt;br /&gt;
&lt;br /&gt;
You might also use &#039;&#039;&#039;r_useScissor 0&#039;&#039;&#039; to show geometry outside the visportal wireframe that Doom still sends to the video card but tells it not to render. &#039;&#039;&#039;r_useScissor 1&#039;&#039;&#039; helps performance but even sending the geometry uses processor time so if you can reduce it by adjusting visportal placement so much the better.&lt;br /&gt;
&lt;br /&gt;
(Remember to return to &#039;&#039;&#039;r_useScissor 1&#039;&#039;&#039; when you are done with visportal testing.)&lt;br /&gt;
&lt;br /&gt;
Here is a short video with a decent visual breakdown:&lt;br /&gt;
&lt;br /&gt;
[http://www.gdcvault.com/play/1014234/Excerpt-Quake-Postmortem-Optimizing-Level Video]&lt;br /&gt;
&lt;br /&gt;
Another video:&lt;br /&gt;
&lt;br /&gt;
[http://youtu.be/cy4FIE7BhCQ http://img.youtube.com/vi/cy4FIE7BhCQ/1.jpg]&lt;br /&gt;
&lt;br /&gt;
== How and where to create visportals ==&lt;br /&gt;
&lt;br /&gt;
Visportals are just brushes with one face covered in visportal texture. That is the operative face. Only be concerned with that one surface as the rest of the brush merely carries it. So to create one you just....&lt;br /&gt;
&lt;br /&gt;
* Make a thin brush like a wall. Ideally make it rectangular for best sound propagation (see &#039;&#039;Sound Propagation&#039;&#039; later.) It can extend beyond the gap so does not necessarily need to be the same shape - see &#039;&#039;Where to place your Visportal&#039;&#039; later.&lt;br /&gt;
* Give it &#039;&#039;&#039;textures &amp;gt; editor &amp;gt; visportal&#039;&#039;&#039; to either of the main surfaces facing towards or away from you. It does not matter which except you need to be aware which it is because the visportal will be effective at that one face. (Use {{Ctrl}} + {{Shift}} + {{LMB}} on the face in the Dark Radiant camera view to select one face.)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Thickness ===&lt;br /&gt;
The exact thickness is not important to its effectiveness as it will only be effective from its one visportal-textured face anyway but it makes sense to keep it reasonably thin so you can see it clearly in the editor. Always think of visportals as one flat face and the rest of the brush can be ignored for functional purposes.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Where to place your Visportal ===&lt;br /&gt;
It will eventually be wedged tight like a plug into gaps, doorways, etc. between areas. The edges of the visportal-textured face of visportals should be completely sealed by or in solid &#039;&#039;worldspawn&#039;&#039; brush that has no gaps. The brush &#039;&#039;&#039;must&#039;&#039;&#039; be a child of worldspawn and &#039;&#039;&#039;not&#039;&#039;&#039; an entity. This is true even if the visportal is within a door (see next section.) For the visportal to be effective it does not matter if the rest of the visportal brush sticks out into space so long as the edges of the visportal-textured face are surrounded by worldspawn brush and/or another visportal brush (see later) In practice you will probably put most fully within a corridor or doorway, a city street (yes, the sky above is solid worldspawn brush), etc. Irregular shaped gaps must still be plugged with a rectangular visportal which should then overlap into the solid worldspawn and leave no gaps. This will also make sound propagation work correctly (see &#039;&#039;Sound Propagation&#039;&#039; later.)&lt;br /&gt;
&lt;br /&gt;
Each area you thus created must be totally enclosed with worldspawn brushes with no gaps of either space else an entity. So a closed building with visportals at the doors but a tiny gap under the eaves of the roof won&#039;t work! Also avoid only blocking gaps with entities whether brushes or models. For example, a two-sided window entity that completely fills the opening will not seal the area for portalling purposes. Do not put in a visportal unless the window is either transparent or can be opened (like a door.) Instead put in a worldspawn brush with nodraw texture on it so it will not be visible or collidable just in front of the window. &#039;&#039;[not sure what this means, but note that nodraw textures DO NOT seal visleafs.  As far as visportals are concerned, they don&#039;t exist]&#039;&#039; Or if you are using two windows back to back (say a lit one outside and an unlit one inside then a thin caulk brush between them.&lt;br /&gt;
&lt;br /&gt;
Generally you will place visportals on bends in the terrain around which the player cannot see from the current viewpoint. Avoid placing visportals in a line along a corridor or street for example. Since the player can see straight down through them all then they serve no purpose as they will all be open and visportals themselves create extra triangles and complexity (see downside section below.)&lt;br /&gt;
&lt;br /&gt;
With a large building surrounded by a walled open area then try visportals at each corner. If it is a very large building then also add visportals midway along each side. The player standing at one corner might be able to see up two sides, part of a far side, and even a small part of the fourth side so all sides would be rendered. By having extra visportals middway along each side then at least half of each side of the furthest corner need not be rendered (consider also preventing the player reaching such a viewpoint with an obstruction!)&lt;br /&gt;
&lt;br /&gt;
Subject to the above, try to find the smallest gaps where possible to place visportals. The smaller the visportal then the smaller the view aperture and so the less chance of lining up those apertures. Remember, visportals beyond the first one do not open unless they intersect all open visportals in that line of view. Even without a door, an open doorway is a better place for a visportal than a wider corridor or room beyond. Imagine trying to get a straight pole through as many of these visportal apertures as possible; the narrower and less aligned they are then the harder to get the pole very far.&lt;br /&gt;
&lt;br /&gt;
Don&#039;t get too hung up on perfect placement of every last visportal. Generally if you follow this guide and use your judgement you achieve a satisfactory game performance. Examine some large maps that you know work well to get some ideas where visportals are placed using the &#039;&#039;&#039;r_showPortals 1&#039;&#039;&#039; command.&lt;br /&gt;
&lt;br /&gt;
What if you put visportal texture on both main faces of the visportal brush? Only one will be effective. If the visportal brush juts out into space then visportal texture at that end will not work but the one at the other end will be the operative one. If you rotated the brush then it still works and uses whichever one is surrounded by solid. If both are in space it does not work at all. If both are surrounded by solid then only one works. Which one? Hard to tell. It seems to be determined by the local geometry. It is interesting to note that when you use r_showTris 3 to see what is rendered then the triangles are confined to either side of the visportal face. In other words, a long corridor wall rendered as two large triangles would now be split into four triangles. So a visportal might be considered to help with multiple lighting performance as you do not need to visually change the terrain with trim etc.&lt;br /&gt;
&lt;br /&gt;
What if you put visportal texture on all the surfaces of the brush? Only one is effective (must be surrounded by solid brush.) To be certain of optimum performance use nodraw on all surfaces except the one face with visportal texture.&lt;br /&gt;
&lt;br /&gt;
===Multiple Joined Visportals===&lt;br /&gt;
Because visportals are a single face, by their very nature they can only be placed on a single brush. But visportal brushes can be placed or merged together to fill more complex shaped gaps. For example, a wide rectangle might have one side clipped to slope over a roof while the rectangular part of its shape sits on top of another rectangle across the street below. But complexity affects performance so only do this if one rectangular visportal intruding into interior walls might do the same job. Remember, it does not matter if the visportal overlaps into solid so if there is an interior wall on the same plane (or indeed if the building is totally solid) then the visportal can penetrate it and still function. Do not use multiple visportals just to shape nicely around solid building trim and structure but intrude into it so long as the edge does not exit into space at any point it will be fine.&lt;br /&gt;
&lt;br /&gt;
== Visportals and doors ==&lt;br /&gt;
A visportal in contact with a door that has an openable property is automatically closed when the door is closed and automatically becomes conventionally operative when the door opens. By &#039;operative&#039; I mean it is then like a normal visportal and will be open or closed depending on the player&#039;s view. So when you first go through a door and leave it open then its visportal will be open as you look immediately back at it. But as you then proceed further through other visportals, the door visportal will eventually close (prevent rendering through it) even if the door itself is left open.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Doors standing in front of but not within a doorway ===&lt;br /&gt;
Note that the visportal only needs to be in contact with the door to be affected by it. Normally you would place the visportal within the door but it actually only needs its visportal-textured surface to touch it. This means that if you have a door that is stood in front of an opening in a wall then you cannot put the visportal inside the door because it will not be surrounded by solid brush. But you can put a visportal just inside the opening and flush with the mouth of the opening and the door immediately in front of that and in contact with the visportal. You can test this by placing the door offset well to one side but part of it still in contact with the visportal. In game you can see the opening as the door is only partially covering it. When the door is closed the visportal closes and stops rendering through the doorway. You will see this as a black panel in the doorway. As the door opens the black panel disappears and you can see through the doorway again. You might think that from the other side the black panel would obscure the door when closed but it doesn&#039;t. With the door centred in its normal position, typically you might have an entity frame around the door. If you had a solid brush frame without gaps then the visportal could be inside the door if you wanted as it would then have solid all round its edges. In many cases of course, the door frame, whether entity or brush, would be within the solid brush doorway anyway.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Windows, Doors with windows, bars, etc. ===&lt;br /&gt;
Openable doors that let you see through them such as windows, doors with windows, barred gates, etc. should not be in contact with a visportal. When the door is closed it will automatically close any visportal whose effective surface is in touch with it. The visportal will not then permit any rendering through it and will show as a black panel in the window or between the bars of a gate. Instead, move the visportal away from the door. It will still function effectively as a normal visportal just as if the door were not there. This does not of course apply to simulated windows such as a glazed textured panel on a door texture where you cannot actually see through.&lt;br /&gt;
&lt;br /&gt;
All doors and windows that do not have an openable property can have a visportal in touch with them as it will not be affected by them and it will just function as a normal visportal.&lt;br /&gt;
&lt;br /&gt;
{{red|Rev. 2.00:}}&lt;br /&gt;
&lt;br /&gt;
Starting with Rev. 2.00, you can touch a see-through door or window with a visportal, and the portal will not close when the door/window is closed, as long as you use the following spawnarg &#039;&#039;&#039;on the door/window&#039;&#039;&#039; (not the info_portalsettings entity):&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;transparent&#039;&#039;&#039; &amp;quot;If set to 1 (0 by default), a see-through door can touch a visportal and the visportal won&#039;t close when the door is closed.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
This is useful when you want the opening or closing of the door to affect the sound loss across the portal, but not affect visibility through the door/window. Imagine a closed window that muffles a sound beyond it, and as the window opens, the sound gets louder.&lt;br /&gt;
&lt;br /&gt;
==Visportal switches: func_portals==&lt;br /&gt;
&lt;br /&gt;
The preceding section &#039;&#039;Visportals and doors&#039;&#039; makes clear that doors can function like switches to enable and close visportals in contact with them. &#039;&#039;func_portals&#039;&#039; can be used to enact further control over portals. You can place a &#039;&#039;func_portal&#039;&#039; entity so that it intersects with a visportal, and then trigger the func_portal to close or open the visportal.  A second control method is had by using the &#039;&#039;portal_dist&#039;&#039; and &#039;&#039;distcheck_period&#039;&#039; properties on the &#039;&#039;func_portal&#039;&#039;.  They control the distance to the player and how frequently (in seconds) this distance should be checked, respectively, and make explicit triggering of the &#039;&#039;func_portal&#039;&#039; unnecessary.  As with doors, even if enabled, the visportal will not be open even if it is in the player&#039;s view.  Note, if you have a mover (door/window) in contact with the visportal, it will affect it as well, so typically a visportal controlled by func_portal is placed away from the mover, or use spawnarg &amp;quot;transparent&amp;quot; set to 1.&lt;br /&gt;
&lt;br /&gt;
Another clever trick exists with regard to &#039;&#039;func_portal&#039;&#039;s:  you can also build a func_static over the visportal, and target it with the &#039;&#039;func_portal&#039;&#039; as normal.  Now, in addition to opening and closing the portal, this will also toggle the drawing of the &#039;&#039;func_static&#039;&#039;.  This means you could place an appropriate texture (perhaps a low resolution image of a room&#039;s interior, drawn over a window) and have it turn on or off based on the player&#039;s distance away.  From a distance, the player wouldn&#039;t be able to tell that the the entire room wasn&#039;t being rendered.  This can be an effective way to create the illusion of long view distances.&lt;br /&gt;
&lt;br /&gt;
Note that the func_static must touch the visportal in order to work.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;One way to make this work is to create a patch, make it a func_static.  Texture the patch, and then target the func_portal at that func_static.  You must then add &amp;quot;hide&amp;quot; &amp;quot;1&amp;quot; to the func_static patch.  There may be other ways to make this work, but I had a lot of trouble until I took these steps.  -- Springheel&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
An interesting, recent discovery that needs some testing is that apparently:  you can take one visportal and cut it in half, and then put different func_portals on each half in order to close them at different ranges.  That has interesting implications for wide city streets.  They require big visportals, but if you can split them up and independently control each part, there may be some benefits there.  http://forums.thedarkmod.com/topic/9082-newbie-darkradiant-questions/?p=370473&lt;br /&gt;
&lt;br /&gt;
== Need I design, even compromise my map to make best use of visportals? ==&lt;br /&gt;
You need to design your map from the start as a series of connected boxes (brushes) with the player&#039;s view, sound propogation, and visportals in mind. And yes, sometimes you might need to add a bend you don&#039;t want or obstruct a view in some way so you can put in another visportal if you are having or expecting slow down in a large and/or complex area. This is a matter of experience. If you have large complex areas and are experiencing frame lag but can see no obvious place to put a visportal then you might need to compromise your terrain and add some solid brush barriers to block certain views with visportals in the access round or through them.&lt;br /&gt;
&lt;br /&gt;
Note that it is not essential that visportals be only at the actual joins between brushes; they still work even if they are half way down a corridor so long as they are wedged in tight without gaps. But you will mostly place them at joins.&lt;br /&gt;
&lt;br /&gt;
For rendering considerations, the player&#039;s view is everything and every room and street in front of you even if there are walls, etc. in the way. Imagine what you would see with X-Ray vision. What is behind you or just out of range of the screen does not matter. But visportals restrict the view to what can be seen through the aperture of the visportal.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
It is not necessary to put visportals at every tiny bend in the map; in fact that should be avoided in smaller areas because visportals themselves create extra triangles and complexity (see downside section below.) Try to keep in mind what will be rendered through the visportals and judge what would &#039;&#039;not&#039;&#039; cause frame lag slowdown if the player could actually see that view. Three or four bends without visportals in a restricted air duct is not going to cause any problem if the duct is correctly visportalled at the ends for example.&lt;br /&gt;
&lt;br /&gt;
== Is there a downside? ==&lt;br /&gt;
One downside to visportals is that is extra work for the mapper! Another is that they split the geometry and create extra triangles and batches. This will not normally cause a problem unless your map has a very large number of areas. The advantages in performance of using visportals far outweigh the downsides!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Sound Propagation==&lt;br /&gt;
&lt;br /&gt;
Correct propagation of sound (both to AI and to the player) relies on visportals.&lt;br /&gt;
&lt;br /&gt;
Think of vis-portals as sealing off separate &amp;quot;areas&amp;quot; in a map.  A sound that occurs inside a sealed &amp;quot;area&amp;quot; will travel in a straight line to anyone inside the same area, even through walls.  If you are not in the same area, however, the sound will travel in a straight line to the first visportal between you and the sound source, then to the next one, etc, until it reaches the area you are in.&lt;br /&gt;
&lt;br /&gt;
If the sound happens in an area that is not sealed, it essentially considers the whole map its &amp;quot;area&amp;quot;, and will go straight to the player, through walls, floors, or other brushwork.  This can result in confusion for players, as they will hear AI on the other side of a massive wall as if they were standing beside each other.&lt;br /&gt;
&lt;br /&gt;
In the following examples, &amp;quot;P&amp;quot; is the player and &amp;quot;S&amp;quot; is the sound source.  The Visportals are red lines. The green lines show how the sound would travel.&lt;br /&gt;
&lt;br /&gt;
[[image:vis.jpg]]&lt;br /&gt;
&lt;br /&gt;
Without any visportals, the sound goes in a straight line to the player, even through solid walls.  It will sound like the player is in the same room as the sound.&lt;br /&gt;
&lt;br /&gt;
One visportal is an improvement--it will sound further away, but the sound travels straight to the visportal and then straight to the player, so it will still sound like it is coming through the wall.  &lt;br /&gt;
&lt;br /&gt;
Two visportals are best in this case, however.  The sound will seem like it is coming from the opening to the room, which is where you would expect it to come from.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Sound &#039;&#039;going to the AI&#039;&#039; travels the shortest distance through a visportal, passing at any point on the visportal surface.  Mappers should always use rectangular visportals unless you have no choice with an awkwardly shaped gap or if the gap is out of range of AI, for example along a sloping roof where AI never go. &#039;&#039;&#039;It also still assumes that when you do have four sides, they are perpendicular.&#039;&#039;&#039; If you have some non-90 degree angles between the sides, some wierdness may ensue. For example, an AI that is alerted in the dark (or facing away) by hearing a sound from the player that passes through an irregular visportal might run to the center of the visportal rather than directly to where the player made the noise. Irregular visportals large enough to make this effect noticeable are likely to be uncommon.&lt;br /&gt;
&lt;br /&gt;
This will be okay for smaller irregular visportals, but the error (path difference from the minimal path) will get more noticeable the larger the visportal.&lt;br /&gt;
&lt;br /&gt;
Visportals function individually even if joined together into complex shapes. So a rectangle at ground level topped by an angled visportal above it tilting out over a roof will be treated separately, not as one aperture. &lt;br /&gt;
&lt;br /&gt;
The bottom line is, with any non-rectangular visportals keep the above in mind and if in doubt then consider early testing of AI&#039;s alert to player sound.&lt;br /&gt;
&lt;br /&gt;
Visportals do NOT need to be closed to correctly channel sound to the player.  Sometimes it is worth adding visportals even if they will not help with rendering (because they will always be open) in order to make sound travel the way it should.  &lt;br /&gt;
&lt;br /&gt;
To make less sound go through a visportal (through a small hole, for example):&lt;br /&gt;
Soundprop can use info_locationSeparator or info_portalSettings to make sound incur a certain loss when going through the portal it&#039;s touching. The key/value pair is the following:&lt;br /&gt;
&lt;br /&gt;
    sound_loss &amp;quot;Soundprop: Loss in dB incurred when a sound travels through this portal. Cumulative with door loss if a door is present.&amp;quot; &lt;br /&gt;
&lt;br /&gt;
The loss must be a positive number, and negative numbers will automatically be converted to positive.&lt;br /&gt;
&lt;br /&gt;
{{red|Rev 2.00:}}&lt;br /&gt;
&lt;br /&gt;
Prior to Rev 2.00, &#039;&#039;&#039;sound_loss&#039;&#039;&#039; affected the sound propagation to AI &#039;&#039;&#039;only&#039;&#039;&#039;.  Sound propagation to the player was not affected.&lt;br /&gt;
&lt;br /&gt;
Starting with Rev 2.00, &#039;&#039;&#039;sound_loss&#039;&#039;&#039; is also used in determining sound volume to the player. This aligns what AI hear with what the player hears. It also allows sound coming through the door to increase as the door opens, or decrease as the door closes, making for a more realistic experience.&lt;br /&gt;
&lt;br /&gt;
For details study: &lt;br /&gt;
[[Sound Propagation: Part 1]] and&lt;br /&gt;
[[Sound Propagation: Part 2]]&lt;br /&gt;
&lt;br /&gt;
== Trouble-shooting ==&lt;br /&gt;
&lt;br /&gt;
There are two possible problems I can think of: the visportal doesn&#039;t work at all or it works yet there is too much being rendered giving poor performance and frame lag. The latter problem is a matter of experience and experimentation. Often much ingenuity is needed to place visportals to reduce the size of areas being rendered at any one time. There is probably a different solution for every situation. Ultimately you might be forced to change the terrain to help visportalling.&lt;br /&gt;
&lt;br /&gt;
If a visportal doesn&#039;t work at all (eg, does not show as either red or green while you are directly in its area and looking at it and you have &#039;&#039;&#039;r_showPortals&#039;&#039;&#039; enabled) then that means there is a &amp;quot;leak&amp;quot; in that &#039;&#039;area&#039;&#039;.  It does not necessarily mean the visportal itself is the problem.&lt;br /&gt;
&lt;br /&gt;
Try the following to track down the problem.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Check the visportal itself:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* Check which face of the visportal is facing which way. It sometimes happen one clones a visportal and rotates it the wrong way without realizing. So the wrong face is in the right place but the visportal face is not in contact with worldspawn.&lt;br /&gt;
&lt;br /&gt;
* Make sure the visportal hasn&#039;t been assigned to an entity but is worldspawn.&lt;br /&gt;
&lt;br /&gt;
* Search for gaps anywhere around the edges of the visportal face. Check for grid snapping not only of the visportal but the surrounding brushes. A tiny difference might not be visible in the Dark Radiant grid if you are not zoomed in sufficiently.&lt;br /&gt;
&lt;br /&gt;
* Check all surrounding items to see if any are entities. Remember, the visportal &#039;&#039;&#039;face&#039;&#039;&#039; must only be surrounded by worldspawn brushes. It seems to be mostly OK if the visportal &#039;&#039;cuts through&#039;&#039; an entity so long as it meets worldspawn at its edges.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Check the area for internal leaks:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
There is a way to test an individual area for leaks.  It sounds more complicated than it is.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
1.  Filter off all entities.  Make sure visportals are NOT filtered.&lt;br /&gt;
&lt;br /&gt;
2.  Select your entire visible map (which will now be only brushwork).&lt;br /&gt;
&lt;br /&gt;
3.  Copy and paste into a new blank map.&lt;br /&gt;
&lt;br /&gt;
4.  Put the player start into the area where you think you have an internal leak. &lt;br /&gt;
 &lt;br /&gt;
5.  Take the visportals sealing that area and texture them with a solid texture.&lt;br /&gt;
&lt;br /&gt;
6.  Make sure there is only void around the map (if you have your entire map encased in a skybox brush, open a hole in a distant corner of the map).&lt;br /&gt;
&lt;br /&gt;
7.  Save the map as a new filename and run dmap.  If you do not get a leak, then the area with the player start is properly sealed.  Move the player start to a new area and repeat as needed.&lt;br /&gt;
&lt;br /&gt;
8.  If you do get a leak, open the pointfile in DR.  Because the player entity is the only entity in the map, the red line will always start there and will show you where the gap is.&lt;br /&gt;
&lt;br /&gt;
9.  Go back to your original map and fix the gap.  Repeat as needed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Having visportals that line up in parallel with each other can cause problems, usually appearing as pieces of wall that appear black or show skybox.  This can usually be fixed by moving a visportal slightly or turning one on a slight angle so they&#039;re no longer parallel.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;If all else fails, try:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* Clone the visportal and drag one edge to one side, that is, reduce its size to say half.  &lt;br /&gt;
* Select the original and drag its opposite edge the other way so you now have two visportals pressed together and which together fill the gap. Guess which side unless you suspect one side particularly (see later.)&lt;br /&gt;
* Change one of the visportals to any normal visible simple texture, stone, wood, whatever so that now the original gap is smaller and filled by just one smaller visportal. (with hindsight, I think this would probably work anyway and might even be better just leaving it as visportal so you can see which one works but I&#039;ll continue with what I did!)&lt;br /&gt;
* Check it in game.&lt;br /&gt;
* If it still does not work then reduce it further, perhaps by half as much again. In particular, go past edges of surrounding brushes (eg, if working downwards with two brushes on the left then maybe it&#039;s the top brush that is the problem so reduce the top of the visportal below its bottom edge.) Obviously as you reduce the visportal you increase the solid temporary brush you made equally to keep up so there is never a gap.&lt;br /&gt;
* If the visportal still does not work even when reduced to a slither then try the same for all four sides noting that the three sides against the slither of visportal are obviously first suspects.&lt;br /&gt;
* If eventually the visportal starts to work then you know the error is in the other section where you have the solid temporary brush. Use a process of elimination to track down exactly where the error is.&lt;br /&gt;
* You might even have to create a third temporary brush or even a fourth but you must eventually force the visportal to work even if you surround it with four new brushes! Once working, then reduce, remove, gradually until the error re-appears - that must be where the error lies. So by a process of elimination you should track down the source of the problem.&lt;br /&gt;
* The result might make not seem to make sense but at least if you locate the error you can try things to solve the problem. I had a visportal up to the sky and on its left against the top of a triangle of bricks on which rested a roof. The visportal seemed to be perfectly surrounded by worldspawn but I reduced it slightly with just a slim temporary solid test brush only one unit high above it pressing against the top of this triangle. The visportal was now working yet if I removed that slim test brush and raised the visportal to the top again then it would not work. Made no sense to me unless mathematically the very top pixel of the triangle might be regarded as infinitely thin and therefore a gap. So, I left the thin test brush and gave it sky texture so it&#039;s completely invisible and everything works.&lt;br /&gt;
&lt;br /&gt;
(Note: Some mappers at Doom3world reported that cloned visportal brushes can cause problems in a map. This was reported in an earlier Doom 3 build.)&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
There are other good visportal tutorials to be found under:&lt;br /&gt;
http://www.iddevnet.com/doom3/visportals.php and http://www.modwiki.net/wiki/Visportal&lt;br /&gt;
&lt;br /&gt;
== Visportals, Func_statics and Worldspawn Brushes  ==&lt;br /&gt;
Sometimes a visportal (VP) looks just fine in-game, but AI&#039;s behave erratically near them: cannot walk through the portal, walk into walls near the portal, can patrol through the portal but cannot chase the player through the portal. This may be due to worldspawn brushes penetrating the visportal.&lt;br /&gt;
&lt;br /&gt;
Image shows scenarios A-D of different VP placement.&lt;br /&gt;
[[image:visportal_scenarios.png]]&lt;br /&gt;
&lt;br /&gt;
*Scenario A, when VP is snugly placed in the worldspawn corridor, it always works.&lt;br /&gt;
*Scenario B, where a worldspawn brush penetrates the VP has often caused problems. It will fail with very high probability if the worldspawn brush is a monsterclip brush. Never do this scenario!  &#039;&#039;[Springheel -- I&#039;d like more confirmation on this...I&#039;m certain I&#039;ve done this on a regular basis in uneven city streets without causing any obvious problems]&#039;&#039;&lt;br /&gt;
*Scenario C is what could be used if the scene absolutely requires somethings going through the VP and scenario A or D cannot be used. Usually this must be done for big outdoors VP&#039;s as seen in Knightons Manor exterior behind the manor (it is the hedge, which goes through the VP there). Note how the worldspawn brush is cut just at the VP and it is only func_static which penetrates the VP. This has worked without issues. Note that no monsterclipping is required if the func_static segment of the VP penetrating brush is short enough. The blue worldspawn brushes could also be monsterclipped func_statics as well. If so, mapper must be certain monsterclip brushes do not penetrate the VP!&lt;br /&gt;
*Scenario D where the VP is penetrated by func_static detail work, has not been reported to break visportals. Usually this kind of case is used in vaulted corridors etc. Works just fine. If the FS detail work is in reach of AI, special care to monsterclipping should be paid and it must be absolutely sure the monsterclip does not penetrate the VP as this will always cause trouble. In this scenario it is recommended that each side of the visportal have their own func_statics and one func_static brush should never penetrate more than one visportal.&lt;br /&gt;
&lt;br /&gt;
===Conclusion===&lt;br /&gt;
Mappers should favour scenario A when possible. If detailwork requires, scenario D is okay, as well as scenario C. Never, ever use scenario B.&lt;br /&gt;
&lt;br /&gt;
If mapper has some issues with their AI pathfinding, they should check the portal isn&#039;t broken as in scenario B. It is really easy to forget wall trims etc which could pass through the VP. Also typical mistake is to automatically surround a model near the VP with monsterclip, which results monsterclip brush which penetrates the VP. It is recommended that the mapper tests every visportal (which an AI is likely to pass) in their map before the map is released. Firstly the mapper should check in DR and make sure visportals are correctly set. Ingame testing should be done both with non-alerted path_corner patrolling AI&#039;s and with an alerted AI chasing the player.&lt;br /&gt;
&lt;br /&gt;
[[Category:Skybox]]&lt;br /&gt;
[[Category:Visportal]]&lt;br /&gt;
{{tutorial-editing}}&lt;/div&gt;</summary>
		<author><name>Springheel</name></author>
	</entry>
	<entry>
		<id>https://wiki.thedarkmod.com/index.php?title=Visportals&amp;diff=19748</id>
		<title>Visportals</title>
		<link rel="alternate" type="text/html" href="https://wiki.thedarkmod.com/index.php?title=Visportals&amp;diff=19748"/>
		<updated>2017-12-02T13:43:55Z</updated>

		<summary type="html">&lt;p&gt;Springheel: /* Where to place your Visportal */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;written by Fidcal. Visportals, Func_statics and Worldspawn Brushes added by Sotha.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== What are visportals? ==&lt;br /&gt;
Visportals are a very important part of mapping.  They are a kind of brush that helps separate your map into individual areas (called visleafs), which is important for both rendering and sound propagation.&lt;br /&gt;
&lt;br /&gt;
Without visportals, the Doom engine would render the entire map even if the player can only see one small area. This would reduce performance and slow the game down.  &lt;br /&gt;
&lt;br /&gt;
Visportals are also very important for sound propagation. Without them, sounds can travel through brushwork and reach areas of the map that they shouldn&#039;t (see &#039;&#039;Sound Propagation&#039;&#039; at the bottom of the page).&lt;br /&gt;
&lt;br /&gt;
[https://youtu.be/RmKjmt7IJr8 Video Introduction to Visportals.]&lt;br /&gt;
&lt;br /&gt;
Visportals determine how far the engine should render from the player&#039;s position. When a visportal is in the player&#039;s view, the engine tests to see if there is a second visportal viewable from the position of the first. If yes then it tests to see if a third one can be seen from the second one. If the third is not viewable from the first then the engine won&#039;t waste time rendering the map beyond it. If it is, then the engine tests for a fourth one and so on. So for example, with a long corridor with lots of 90 degree turns in it and visportals at every bend then the engine will only render the section you are in plus any parts of the next section you can see. But as you get near to it and can see further down it to the next bend&#039;s visportal then it will render the next one too.&lt;br /&gt;
&lt;br /&gt;
Anything in the visleaf that the player is currently in is rendered (if it is your field of view) regardless of whether it is behind worldspawn.  But things in an adjacent visleaf will not be rendered if they are behind worldspawn.  The engine still has to calculate what the player can see and what he can&#039;t, and this still uses resources, but far less than if it were in the same visleaf as the player.  Any visleaf that is behind a closed portal is automatically beyond what the player can see, to the engine can skip testing it completely.  This is why closed visportals are so valuable for performance.&lt;br /&gt;
&lt;br /&gt;
The console command &#039;&#039;&#039;r_showPortals 1&#039;&#039;&#039; shows processed visportals as wireframe in-game for testing - even right through walls they are visible. A green wireframe is an &#039;open&#039; visportal and renders everything beyond it up to the next visportal.  A red wireframe is a &#039;closed&#039; visportal with nothing rendered beyond it and no further visportals beyond that are even processed so are not visible at all. If a visportal does not show then it is either beyond range of processing or it is not working so check it is set up correctly.&lt;br /&gt;
&lt;br /&gt;
== What is rendering? ==&lt;br /&gt;
Rendering might be regarded as the calculating of surface lighting, colour, texture, etc. Not all rendered surfaces are visible in-game but still have to be calculated. Others do not need rendering at all. Processing only takes place in the current portal area, that is, up to the nearest closed visportals. Surfaces are treated as divided into triangles for rendering purposes. The &#039;&#039;&#039;r_showTris&#039;&#039;&#039; console command shows those triangles as wireframes. In the console use &#039;&#039;&#039;r_showTris N&#039;&#039;&#039; where N is...&lt;br /&gt;
&lt;br /&gt;
*0 - Off - normal gameplay with no wireframes shown.&lt;br /&gt;
*1 - Shows only triangles that are visible in-game (not hidden behind other surfaces.) These visible surfaces are only part of what is rendered.&lt;br /&gt;
*2 - Shows as wireframes, all triangle surfaces that would be rendered in-game. This includes those hidden behind other surfaces BUT ONLY IF they face the player, even slightly. Surfaces facing away from the player are never rendered.&lt;br /&gt;
*3 - Shows as wireframes, all triangle surfaces even if not rendered.&lt;br /&gt;
&lt;br /&gt;
You can see that for the purpose of testing performance use 2 above which shows all that would be rendered (whether visible to the player or not.) You can use 3 to see &#039;&#039;all&#039;&#039; triangles up to the next closed visportal but remember not all of it will be rendered so will not affect performance.&lt;br /&gt;
&lt;br /&gt;
You might also use &#039;&#039;&#039;r_useScissor 0&#039;&#039;&#039; to show geometry outside the visportal wireframe that Doom still sends to the video card but tells it not to render. &#039;&#039;&#039;r_useScissor 1&#039;&#039;&#039; helps performance but even sending the geometry uses processor time so if you can reduce it by adjusting visportal placement so much the better.&lt;br /&gt;
&lt;br /&gt;
(Remember to return to &#039;&#039;&#039;r_useScissor 1&#039;&#039;&#039; when you are done with visportal testing.)&lt;br /&gt;
&lt;br /&gt;
Here is a short video with a decent visual breakdown:&lt;br /&gt;
&lt;br /&gt;
[http://www.gdcvault.com/play/1014234/Excerpt-Quake-Postmortem-Optimizing-Level Video]&lt;br /&gt;
&lt;br /&gt;
Another video:&lt;br /&gt;
&lt;br /&gt;
[http://youtu.be/cy4FIE7BhCQ http://img.youtube.com/vi/cy4FIE7BhCQ/1.jpg]&lt;br /&gt;
&lt;br /&gt;
== How and where to create visportals ==&lt;br /&gt;
&lt;br /&gt;
Visportals are just brushes with one face covered in visportal texture. That is the operative face. Only be concerned with that one surface as the rest of the brush merely carries it. So to create one you just....&lt;br /&gt;
&lt;br /&gt;
* Make a thin brush like a wall. Ideally make it rectangular for best sound propagation (see &#039;&#039;Sound Propagation&#039;&#039; later.) It can extend beyond the gap so does not necessarily need to be the same shape - see &#039;&#039;Where to place your Visportal&#039;&#039; later.&lt;br /&gt;
* Give it &#039;&#039;&#039;textures &amp;gt; editor &amp;gt; visportal&#039;&#039;&#039; to either of the main surfaces facing towards or away from you. It does not matter which except you need to be aware which it is because the visportal will be effective at that one face. (Use {{Ctrl}} + {{Shift}} + {{LMB}} on the face in the Dark Radiant camera view to select one face.)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Thickness ===&lt;br /&gt;
The exact thickness is not important to its effectiveness as it will only be effective from its one visportal-textured face anyway but it makes sense to keep it reasonably thin so you can see it clearly in the editor. Always think of visportals as one flat face and the rest of the brush can be ignored for functional purposes.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Where to place your Visportal ===&lt;br /&gt;
It will eventually be wedged tight like a plug into gaps, doorways, etc. between areas. The edges of the visportal-textured face of visportals should be completely sealed by or in solid &#039;&#039;worldspawn&#039;&#039; brush that has no gaps. The brush &#039;&#039;&#039;must&#039;&#039;&#039; be a child of worldspawn and &#039;&#039;&#039;not&#039;&#039;&#039; an entity. This is true even if the visportal is within a door (see next section.) For the visportal to be effective it does not matter if the rest of the visportal brush sticks out into space so long as the edges of the visportal-textured face are surrounded by worldspawn brush and/or another visportal brush (see later) In practice you will probably put most fully within a corridor or doorway, a city street (yes, the sky above is solid worldspawn brush), etc. Irregular shaped gaps must still be plugged with a rectangular visportal which should then overlap into the solid worldspawn and leave no gaps. This will also make sound propagation work correctly (see &#039;&#039;Sound Propagation&#039;&#039; later.)&lt;br /&gt;
&lt;br /&gt;
Each area you thus created must be totally enclosed with worldspawn brushes with no gaps of either space else an entity. So a closed building with visportals at the doors but a tiny gap under the eaves of the roof won&#039;t work! Also avoid only blocking gaps with entities whether brushes or models. For example, a two-sided window entity that completely fills the opening will not seal the area for portalling purposes. Do not put in a visportal unless the window is either transparent or can be opened (like a door.) Instead put in a worldspawn brush with nodraw texture on it so it will not be visible or collidable just in front of the window.[not sure what this means, but note that nodraw textures DO NOT seal visleafs.  As far as visportals are concerned, they don&#039;t exist] Or if you are using two windows back to back (say a lit one outside and an unlit one inside then a thin caulk brush between them.&lt;br /&gt;
&lt;br /&gt;
Generally you will place visportals on bends in the terrain around which the player cannot see from the current viewpoint. Avoid placing visportals in a line along a corridor or street for example. Since the player can see straight down through them all then they serve no purpose as they will all be open and visportals themselves create extra triangles and complexity (see downside section below.)&lt;br /&gt;
&lt;br /&gt;
With a large building surrounded by a walled open area then try visportals at each corner. If it is a very large building then also add visportals midway along each side. The player standing at one corner might be able to see up two sides, part of a far side, and even a small part of the fourth side so all sides would be rendered. By having extra visportals middway along each side then at least half of each side of the furthest corner need not be rendered (consider also preventing the player reaching such a viewpoint with an obstruction!)&lt;br /&gt;
&lt;br /&gt;
Subject to the above, try to find the smallest gaps where possible to place visportals. The smaller the visportal then the smaller the view aperture and so the less chance of lining up those apertures. Remember, visportals beyond the first one do not open unless they intersect all open visportals in that line of view. Even without a door, an open doorway is a better place for a visportal than a wider corridor or room beyond. Imagine trying to get a straight pole through as many of these visportal apertures as possible; the narrower and less aligned they are then the harder to get the pole very far.&lt;br /&gt;
&lt;br /&gt;
Don&#039;t get too hung up on perfect placement of every last visportal. Generally if you follow this guide and use your judgement you achieve a satisfactory game performance. Examine some large maps that you know work well to get some ideas where visportals are placed using the &#039;&#039;&#039;r_showPortals 1&#039;&#039;&#039; command.&lt;br /&gt;
&lt;br /&gt;
What if you put visportal texture on both main faces of the visportal brush? Only one will be effective. If the visportal brush juts out into space then visportal texture at that end will not work but the one at the other end will be the operative one. If you rotated the brush then it still works and uses whichever one is surrounded by solid. If both are in space it does not work at all. If both are surrounded by solid then only one works. Which one? Hard to tell. It seems to be determined by the local geometry. It is interesting to note that when you use r_showTris 3 to see what is rendered then the triangles are confined to either side of the visportal face. In other words, a long corridor wall rendered as two large triangles would now be split into four triangles. So a visportal might be considered to help with multiple lighting performance as you do not need to visually change the terrain with trim etc.&lt;br /&gt;
&lt;br /&gt;
What if you put visportal texture on all the surfaces of the brush? Only one is effective (must be surrounded by solid brush.) To be certain of optimum performance use nodraw on all surfaces except the one face with visportal texture.&lt;br /&gt;
&lt;br /&gt;
===Multiple Joined Visportals===&lt;br /&gt;
Because visportals are a single face, by their very nature they can only be placed on a single brush. But visportal brushes can be placed or merged together to fill more complex shaped gaps. For example, a wide rectangle might have one side clipped to slope over a roof while the rectangular part of its shape sits on top of another rectangle across the street below. But complexity affects performance so only do this if one rectangular visportal intruding into interior walls might do the same job. Remember, it does not matter if the visportal overlaps into solid so if there is an interior wall on the same plane (or indeed if the building is totally solid) then the visportal can penetrate it and still function. Do not use multiple visportals just to shape nicely around solid building trim and structure but intrude into it so long as the edge does not exit into space at any point it will be fine.&lt;br /&gt;
&lt;br /&gt;
== Visportals and doors ==&lt;br /&gt;
A visportal in contact with a door that has an openable property is automatically closed when the door is closed and automatically becomes conventionally operative when the door opens. By &#039;operative&#039; I mean it is then like a normal visportal and will be open or closed depending on the player&#039;s view. So when you first go through a door and leave it open then its visportal will be open as you look immediately back at it. But as you then proceed further through other visportals, the door visportal will eventually close (prevent rendering through it) even if the door itself is left open.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Doors standing in front of but not within a doorway ===&lt;br /&gt;
Note that the visportal only needs to be in contact with the door to be affected by it. Normally you would place the visportal within the door but it actually only needs its visportal-textured surface to touch it. This means that if you have a door that is stood in front of an opening in a wall then you cannot put the visportal inside the door because it will not be surrounded by solid brush. But you can put a visportal just inside the opening and flush with the mouth of the opening and the door immediately in front of that and in contact with the visportal. You can test this by placing the door offset well to one side but part of it still in contact with the visportal. In game you can see the opening as the door is only partially covering it. When the door is closed the visportal closes and stops rendering through the doorway. You will see this as a black panel in the doorway. As the door opens the black panel disappears and you can see through the doorway again. You might think that from the other side the black panel would obscure the door when closed but it doesn&#039;t. With the door centred in its normal position, typically you might have an entity frame around the door. If you had a solid brush frame without gaps then the visportal could be inside the door if you wanted as it would then have solid all round its edges. In many cases of course, the door frame, whether entity or brush, would be within the solid brush doorway anyway.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Windows, Doors with windows, bars, etc. ===&lt;br /&gt;
Openable doors that let you see through them such as windows, doors with windows, barred gates, etc. should not be in contact with a visportal. When the door is closed it will automatically close any visportal whose effective surface is in touch with it. The visportal will not then permit any rendering through it and will show as a black panel in the window or between the bars of a gate. Instead, move the visportal away from the door. It will still function effectively as a normal visportal just as if the door were not there. This does not of course apply to simulated windows such as a glazed textured panel on a door texture where you cannot actually see through.&lt;br /&gt;
&lt;br /&gt;
All doors and windows that do not have an openable property can have a visportal in touch with them as it will not be affected by them and it will just function as a normal visportal.&lt;br /&gt;
&lt;br /&gt;
{{red|Rev. 2.00:}}&lt;br /&gt;
&lt;br /&gt;
Starting with Rev. 2.00, you can touch a see-through door or window with a visportal, and the portal will not close when the door/window is closed, as long as you use the following spawnarg &#039;&#039;&#039;on the door/window&#039;&#039;&#039; (not the info_portalsettings entity):&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;transparent&#039;&#039;&#039; &amp;quot;If set to 1 (0 by default), a see-through door can touch a visportal and the visportal won&#039;t close when the door is closed.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
This is useful when you want the opening or closing of the door to affect the sound loss across the portal, but not affect visibility through the door/window. Imagine a closed window that muffles a sound beyond it, and as the window opens, the sound gets louder.&lt;br /&gt;
&lt;br /&gt;
==Visportal switches: func_portals==&lt;br /&gt;
&lt;br /&gt;
The preceding section &#039;&#039;Visportals and doors&#039;&#039; makes clear that doors can function like switches to enable and close visportals in contact with them. &#039;&#039;func_portals&#039;&#039; can be used to enact further control over portals. You can place a &#039;&#039;func_portal&#039;&#039; entity so that it intersects with a visportal, and then trigger the func_portal to close or open the visportal.  A second control method is had by using the &#039;&#039;portal_dist&#039;&#039; and &#039;&#039;distcheck_period&#039;&#039; properties on the &#039;&#039;func_portal&#039;&#039;.  They control the distance to the player and how frequently (in seconds) this distance should be checked, respectively, and make explicit triggering of the &#039;&#039;func_portal&#039;&#039; unnecessary.  As with doors, even if enabled, the visportal will not be open even if it is in the player&#039;s view.  Note, if you have a mover (door/window) in contact with the visportal, it will affect it as well, so typically a visportal controlled by func_portal is placed away from the mover, or use spawnarg &amp;quot;transparent&amp;quot; set to 1.&lt;br /&gt;
&lt;br /&gt;
Another clever trick exists with regard to &#039;&#039;func_portal&#039;&#039;s:  you can also build a func_static over the visportal, and target it with the &#039;&#039;func_portal&#039;&#039; as normal.  Now, in addition to opening and closing the portal, this will also toggle the drawing of the &#039;&#039;func_static&#039;&#039;.  This means you could place an appropriate texture (perhaps a low resolution image of a room&#039;s interior, drawn over a window) and have it turn on or off based on the player&#039;s distance away.  From a distance, the player wouldn&#039;t be able to tell that the the entire room wasn&#039;t being rendered.  This can be an effective way to create the illusion of long view distances.&lt;br /&gt;
&lt;br /&gt;
Note that the func_static must touch the visportal in order to work.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;One way to make this work is to create a patch, make it a func_static.  Texture the patch, and then target the func_portal at that func_static.  You must then add &amp;quot;hide&amp;quot; &amp;quot;1&amp;quot; to the func_static patch.  There may be other ways to make this work, but I had a lot of trouble until I took these steps.  -- Springheel&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
An interesting, recent discovery that needs some testing is that apparently:  you can take one visportal and cut it in half, and then put different func_portals on each half in order to close them at different ranges.  That has interesting implications for wide city streets.  They require big visportals, but if you can split them up and independently control each part, there may be some benefits there.  http://forums.thedarkmod.com/topic/9082-newbie-darkradiant-questions/?p=370473&lt;br /&gt;
&lt;br /&gt;
== Need I design, even compromise my map to make best use of visportals? ==&lt;br /&gt;
You need to design your map from the start as a series of connected boxes (brushes) with the player&#039;s view, sound propogation, and visportals in mind. And yes, sometimes you might need to add a bend you don&#039;t want or obstruct a view in some way so you can put in another visportal if you are having or expecting slow down in a large and/or complex area. This is a matter of experience. If you have large complex areas and are experiencing frame lag but can see no obvious place to put a visportal then you might need to compromise your terrain and add some solid brush barriers to block certain views with visportals in the access round or through them.&lt;br /&gt;
&lt;br /&gt;
Note that it is not essential that visportals be only at the actual joins between brushes; they still work even if they are half way down a corridor so long as they are wedged in tight without gaps. But you will mostly place them at joins.&lt;br /&gt;
&lt;br /&gt;
For rendering considerations, the player&#039;s view is everything and every room and street in front of you even if there are walls, etc. in the way. Imagine what you would see with X-Ray vision. What is behind you or just out of range of the screen does not matter. But visportals restrict the view to what can be seen through the aperture of the visportal.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
It is not necessary to put visportals at every tiny bend in the map; in fact that should be avoided in smaller areas because visportals themselves create extra triangles and complexity (see downside section below.) Try to keep in mind what will be rendered through the visportals and judge what would &#039;&#039;not&#039;&#039; cause frame lag slowdown if the player could actually see that view. Three or four bends without visportals in a restricted air duct is not going to cause any problem if the duct is correctly visportalled at the ends for example.&lt;br /&gt;
&lt;br /&gt;
== Is there a downside? ==&lt;br /&gt;
One downside to visportals is that is extra work for the mapper! Another is that they split the geometry and create extra triangles and batches. This will not normally cause a problem unless your map has a very large number of areas. The advantages in performance of using visportals far outweigh the downsides!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Sound Propagation==&lt;br /&gt;
&lt;br /&gt;
Correct propagation of sound (both to AI and to the player) relies on visportals.&lt;br /&gt;
&lt;br /&gt;
Think of vis-portals as sealing off separate &amp;quot;areas&amp;quot; in a map.  A sound that occurs inside a sealed &amp;quot;area&amp;quot; will travel in a straight line to anyone inside the same area, even through walls.  If you are not in the same area, however, the sound will travel in a straight line to the first visportal between you and the sound source, then to the next one, etc, until it reaches the area you are in.&lt;br /&gt;
&lt;br /&gt;
If the sound happens in an area that is not sealed, it essentially considers the whole map its &amp;quot;area&amp;quot;, and will go straight to the player, through walls, floors, or other brushwork.  This can result in confusion for players, as they will hear AI on the other side of a massive wall as if they were standing beside each other.&lt;br /&gt;
&lt;br /&gt;
In the following examples, &amp;quot;P&amp;quot; is the player and &amp;quot;S&amp;quot; is the sound source.  The Visportals are red lines. The green lines show how the sound would travel.&lt;br /&gt;
&lt;br /&gt;
[[image:vis.jpg]]&lt;br /&gt;
&lt;br /&gt;
Without any visportals, the sound goes in a straight line to the player, even through solid walls.  It will sound like the player is in the same room as the sound.&lt;br /&gt;
&lt;br /&gt;
One visportal is an improvement--it will sound further away, but the sound travels straight to the visportal and then straight to the player, so it will still sound like it is coming through the wall.  &lt;br /&gt;
&lt;br /&gt;
Two visportals are best in this case, however.  The sound will seem like it is coming from the opening to the room, which is where you would expect it to come from.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Sound &#039;&#039;going to the AI&#039;&#039; travels the shortest distance through a visportal, passing at any point on the visportal surface.  Mappers should always use rectangular visportals unless you have no choice with an awkwardly shaped gap or if the gap is out of range of AI, for example along a sloping roof where AI never go. &#039;&#039;&#039;It also still assumes that when you do have four sides, they are perpendicular.&#039;&#039;&#039; If you have some non-90 degree angles between the sides, some wierdness may ensue. For example, an AI that is alerted in the dark (or facing away) by hearing a sound from the player that passes through an irregular visportal might run to the center of the visportal rather than directly to where the player made the noise. Irregular visportals large enough to make this effect noticeable are likely to be uncommon.&lt;br /&gt;
&lt;br /&gt;
This will be okay for smaller irregular visportals, but the error (path difference from the minimal path) will get more noticeable the larger the visportal.&lt;br /&gt;
&lt;br /&gt;
Visportals function individually even if joined together into complex shapes. So a rectangle at ground level topped by an angled visportal above it tilting out over a roof will be treated separately, not as one aperture. &lt;br /&gt;
&lt;br /&gt;
The bottom line is, with any non-rectangular visportals keep the above in mind and if in doubt then consider early testing of AI&#039;s alert to player sound.&lt;br /&gt;
&lt;br /&gt;
Visportals do NOT need to be closed to correctly channel sound to the player.  Sometimes it is worth adding visportals even if they will not help with rendering (because they will always be open) in order to make sound travel the way it should.  &lt;br /&gt;
&lt;br /&gt;
To make less sound go through a visportal (through a small hole, for example):&lt;br /&gt;
Soundprop can use info_locationSeparator or info_portalSettings to make sound incur a certain loss when going through the portal it&#039;s touching. The key/value pair is the following:&lt;br /&gt;
&lt;br /&gt;
    sound_loss &amp;quot;Soundprop: Loss in dB incurred when a sound travels through this portal. Cumulative with door loss if a door is present.&amp;quot; &lt;br /&gt;
&lt;br /&gt;
The loss must be a positive number, and negative numbers will automatically be converted to positive.&lt;br /&gt;
&lt;br /&gt;
{{red|Rev 2.00:}}&lt;br /&gt;
&lt;br /&gt;
Prior to Rev 2.00, &#039;&#039;&#039;sound_loss&#039;&#039;&#039; affected the sound propagation to AI &#039;&#039;&#039;only&#039;&#039;&#039;.  Sound propagation to the player was not affected.&lt;br /&gt;
&lt;br /&gt;
Starting with Rev 2.00, &#039;&#039;&#039;sound_loss&#039;&#039;&#039; is also used in determining sound volume to the player. This aligns what AI hear with what the player hears. It also allows sound coming through the door to increase as the door opens, or decrease as the door closes, making for a more realistic experience.&lt;br /&gt;
&lt;br /&gt;
For details study: &lt;br /&gt;
[[Sound Propagation: Part 1]] and&lt;br /&gt;
[[Sound Propagation: Part 2]]&lt;br /&gt;
&lt;br /&gt;
== Trouble-shooting ==&lt;br /&gt;
&lt;br /&gt;
There are two possible problems I can think of: the visportal doesn&#039;t work at all or it works yet there is too much being rendered giving poor performance and frame lag. The latter problem is a matter of experience and experimentation. Often much ingenuity is needed to place visportals to reduce the size of areas being rendered at any one time. There is probably a different solution for every situation. Ultimately you might be forced to change the terrain to help visportalling.&lt;br /&gt;
&lt;br /&gt;
If a visportal doesn&#039;t work at all (eg, does not show as either red or green while you are directly in its area and looking at it and you have &#039;&#039;&#039;r_showPortals&#039;&#039;&#039; enabled) then that means there is a &amp;quot;leak&amp;quot; in that &#039;&#039;area&#039;&#039;.  It does not necessarily mean the visportal itself is the problem.&lt;br /&gt;
&lt;br /&gt;
Try the following to track down the problem.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Check the visportal itself:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* Check which face of the visportal is facing which way. It sometimes happen one clones a visportal and rotates it the wrong way without realizing. So the wrong face is in the right place but the visportal face is not in contact with worldspawn.&lt;br /&gt;
&lt;br /&gt;
* Make sure the visportal hasn&#039;t been assigned to an entity but is worldspawn.&lt;br /&gt;
&lt;br /&gt;
* Search for gaps anywhere around the edges of the visportal face. Check for grid snapping not only of the visportal but the surrounding brushes. A tiny difference might not be visible in the Dark Radiant grid if you are not zoomed in sufficiently.&lt;br /&gt;
&lt;br /&gt;
* Check all surrounding items to see if any are entities. Remember, the visportal &#039;&#039;&#039;face&#039;&#039;&#039; must only be surrounded by worldspawn brushes. It seems to be mostly OK if the visportal &#039;&#039;cuts through&#039;&#039; an entity so long as it meets worldspawn at its edges.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Check the area for internal leaks:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
There is a way to test an individual area for leaks.  It sounds more complicated than it is.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
1.  Filter off all entities.  Make sure visportals are NOT filtered.&lt;br /&gt;
&lt;br /&gt;
2.  Select your entire visible map (which will now be only brushwork).&lt;br /&gt;
&lt;br /&gt;
3.  Copy and paste into a new blank map.&lt;br /&gt;
&lt;br /&gt;
4.  Put the player start into the area where you think you have an internal leak. &lt;br /&gt;
 &lt;br /&gt;
5.  Take the visportals sealing that area and texture them with a solid texture.&lt;br /&gt;
&lt;br /&gt;
6.  Make sure there is only void around the map (if you have your entire map encased in a skybox brush, open a hole in a distant corner of the map).&lt;br /&gt;
&lt;br /&gt;
7.  Save the map as a new filename and run dmap.  If you do not get a leak, then the area with the player start is properly sealed.  Move the player start to a new area and repeat as needed.&lt;br /&gt;
&lt;br /&gt;
8.  If you do get a leak, open the pointfile in DR.  Because the player entity is the only entity in the map, the red line will always start there and will show you where the gap is.&lt;br /&gt;
&lt;br /&gt;
9.  Go back to your original map and fix the gap.  Repeat as needed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Having visportals that line up in parallel with each other can cause problems, usually appearing as pieces of wall that appear black or show skybox.  This can usually be fixed by moving a visportal slightly or turning one on a slight angle so they&#039;re no longer parallel.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;If all else fails, try:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* Clone the visportal and drag one edge to one side, that is, reduce its size to say half.  &lt;br /&gt;
* Select the original and drag its opposite edge the other way so you now have two visportals pressed together and which together fill the gap. Guess which side unless you suspect one side particularly (see later.)&lt;br /&gt;
* Change one of the visportals to any normal visible simple texture, stone, wood, whatever so that now the original gap is smaller and filled by just one smaller visportal. (with hindsight, I think this would probably work anyway and might even be better just leaving it as visportal so you can see which one works but I&#039;ll continue with what I did!)&lt;br /&gt;
* Check it in game.&lt;br /&gt;
* If it still does not work then reduce it further, perhaps by half as much again. In particular, go past edges of surrounding brushes (eg, if working downwards with two brushes on the left then maybe it&#039;s the top brush that is the problem so reduce the top of the visportal below its bottom edge.) Obviously as you reduce the visportal you increase the solid temporary brush you made equally to keep up so there is never a gap.&lt;br /&gt;
* If the visportal still does not work even when reduced to a slither then try the same for all four sides noting that the three sides against the slither of visportal are obviously first suspects.&lt;br /&gt;
* If eventually the visportal starts to work then you know the error is in the other section where you have the solid temporary brush. Use a process of elimination to track down exactly where the error is.&lt;br /&gt;
* You might even have to create a third temporary brush or even a fourth but you must eventually force the visportal to work even if you surround it with four new brushes! Once working, then reduce, remove, gradually until the error re-appears - that must be where the error lies. So by a process of elimination you should track down the source of the problem.&lt;br /&gt;
* The result might make not seem to make sense but at least if you locate the error you can try things to solve the problem. I had a visportal up to the sky and on its left against the top of a triangle of bricks on which rested a roof. The visportal seemed to be perfectly surrounded by worldspawn but I reduced it slightly with just a slim temporary solid test brush only one unit high above it pressing against the top of this triangle. The visportal was now working yet if I removed that slim test brush and raised the visportal to the top again then it would not work. Made no sense to me unless mathematically the very top pixel of the triangle might be regarded as infinitely thin and therefore a gap. So, I left the thin test brush and gave it sky texture so it&#039;s completely invisible and everything works.&lt;br /&gt;
&lt;br /&gt;
(Note: Some mappers at Doom3world reported that cloned visportal brushes can cause problems in a map. This was reported in an earlier Doom 3 build.)&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
There are other good visportal tutorials to be found under:&lt;br /&gt;
http://www.iddevnet.com/doom3/visportals.php and http://www.modwiki.net/wiki/Visportal&lt;br /&gt;
&lt;br /&gt;
== Visportals, Func_statics and Worldspawn Brushes  ==&lt;br /&gt;
Sometimes a visportal (VP) looks just fine in-game, but AI&#039;s behave erratically near them: cannot walk through the portal, walk into walls near the portal, can patrol through the portal but cannot chase the player through the portal. This may be due to worldspawn brushes penetrating the visportal.&lt;br /&gt;
&lt;br /&gt;
Image shows scenarios A-D of different VP placement.&lt;br /&gt;
[[image:visportal_scenarios.png]]&lt;br /&gt;
&lt;br /&gt;
*Scenario A, when VP is snugly placed in the worldspawn corridor, it always works.&lt;br /&gt;
*Scenario B, where a worldspawn brush penetrates the VP has often caused problems. It will fail with very high probability if the worldspawn brush is a monsterclip brush. Never do this scenario!  &#039;&#039;[Springheel -- I&#039;d like more confirmation on this...I&#039;m certain I&#039;ve done this on a regular basis in uneven city streets without causing any obvious problems]&#039;&#039;&lt;br /&gt;
*Scenario C is what could be used if the scene absolutely requires somethings going through the VP and scenario A or D cannot be used. Usually this must be done for big outdoors VP&#039;s as seen in Knightons Manor exterior behind the manor (it is the hedge, which goes through the VP there). Note how the worldspawn brush is cut just at the VP and it is only func_static which penetrates the VP. This has worked without issues. Note that no monsterclipping is required if the func_static segment of the VP penetrating brush is short enough. The blue worldspawn brushes could also be monsterclipped func_statics as well. If so, mapper must be certain monsterclip brushes do not penetrate the VP!&lt;br /&gt;
*Scenario D where the VP is penetrated by func_static detail work, has not been reported to break visportals. Usually this kind of case is used in vaulted corridors etc. Works just fine. If the FS detail work is in reach of AI, special care to monsterclipping should be paid and it must be absolutely sure the monsterclip does not penetrate the VP as this will always cause trouble. In this scenario it is recommended that each side of the visportal have their own func_statics and one func_static brush should never penetrate more than one visportal.&lt;br /&gt;
&lt;br /&gt;
===Conclusion===&lt;br /&gt;
Mappers should favour scenario A when possible. If detailwork requires, scenario D is okay, as well as scenario C. Never, ever use scenario B.&lt;br /&gt;
&lt;br /&gt;
If mapper has some issues with their AI pathfinding, they should check the portal isn&#039;t broken as in scenario B. It is really easy to forget wall trims etc which could pass through the VP. Also typical mistake is to automatically surround a model near the VP with monsterclip, which results monsterclip brush which penetrates the VP. It is recommended that the mapper tests every visportal (which an AI is likely to pass) in their map before the map is released. Firstly the mapper should check in DR and make sure visportals are correctly set. Ingame testing should be done both with non-alerted path_corner patrolling AI&#039;s and with an alerted AI chasing the player.&lt;br /&gt;
&lt;br /&gt;
[[Category:Skybox]]&lt;br /&gt;
[[Category:Visportal]]&lt;br /&gt;
{{tutorial-editing}}&lt;/div&gt;</summary>
		<author><name>Springheel</name></author>
	</entry>
	<entry>
		<id>https://wiki.thedarkmod.com/index.php?title=BindToJoint&amp;diff=19643</id>
		<title>BindToJoint</title>
		<link rel="alternate" type="text/html" href="https://wiki.thedarkmod.com/index.php?title=BindToJoint&amp;diff=19643"/>
		<updated>2017-08-26T17:46:49Z</updated>

		<summary type="html">&lt;p&gt;Springheel: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Description ==&lt;br /&gt;
&lt;br /&gt;
The [[spawnarg]] &#039;&#039;bindToJoint&#039;&#039; with a joint name as value sets the joint to be attached to if an entity is attached to an AI using [[bind]]&lt;br /&gt;
&lt;br /&gt;
See a list of common joint names below.&lt;br /&gt;
&lt;br /&gt;
Entities can also be attached using def_attach (see  [[How to Make Your AI Unique|here]])&lt;br /&gt;
&lt;br /&gt;
== Examples ==&lt;br /&gt;
&lt;br /&gt;
Create a purse&lt;br /&gt;
Create an AI and name it Guard_1&lt;br /&gt;
In the editor, position and orient the purse as if attached to the AI&#039;s belt on the left.&lt;br /&gt;
Give the purse these spawnargs/values:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
bind Guard_1&lt;br /&gt;
&lt;br /&gt;
bindToJoint LeftHips_Dummy&lt;br /&gt;
&lt;br /&gt;
The above would attach the purse to the left hip joint of the AI.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Joints Names ==&lt;br /&gt;
&lt;br /&gt;
The name of joints can vary with the AI. They are listed in the .md5mesh files for each AI. These are in the darkmod/models/md5/chars folder and can be viewed in a plain text editor. &lt;br /&gt;
&lt;br /&gt;
There is a cvar to enter in the console that shows the skeleton of the AI with joints names in-game. This is the cvar to show joint names is r_showskel 1 to show and 0 to hide. &lt;br /&gt;
&lt;br /&gt;
For most purposes, here is a list of commonly used humanoid joints names for use with bindToJoint and also def_attach: &lt;br /&gt;
&lt;br /&gt;
origin (default I think)&lt;br /&gt;
&lt;br /&gt;
Head&lt;br /&gt;
&lt;br /&gt;
Neck&lt;br /&gt;
&lt;br /&gt;
Spine, Spine1, Spine2 (chest), Spine_Dummy, joint8 (Spine2) joint9 (Spine2), leftpad (Spine2), rightpad (Spine2)&lt;br /&gt;
&lt;br /&gt;
LeftShoulder&lt;br /&gt;
&lt;br /&gt;
RightShoulder&lt;br /&gt;
&lt;br /&gt;
LeftArm, LeftArmRoll,LeftArm_Dummy, LeftForeArm&lt;br /&gt;
&lt;br /&gt;
RightArm, RightForeArm&lt;br /&gt;
&lt;br /&gt;
LeftHand, LeftHandIndex1, LeftHandIndex2, LeftHandIndex3, LeftHandRing1, LeftHandRing2, LeftHandRing3, LeftHandThumb1, LeftHandThumb2, LeftHandThumb3&lt;br /&gt;
&lt;br /&gt;
RightHand, RightHandIndex1, RightHandIndex2, RightHandIndex3, RightHandMiddle1, RightHandMiddle2, RightHandMiddle3, RightHandThumb1, RightHandThumb2, RightHandThumb3&lt;br /&gt;
&lt;br /&gt;
Hips, LeftHips_Dummy (belt), RightHips_Dummy (belt), sword (Hips)&lt;br /&gt;
&lt;br /&gt;
LeftLeg, LeftUpLeg, LeftUpLegRoll, LeftLegRoll, joint3 (LeftUpLegRoll), joint4 (LeftUpLegRoll)&lt;br /&gt;
&lt;br /&gt;
RightLeg, RightUpLeg, RightUpLegRoll, joint5(RightUpLegRoll), joint6(RightUpLegRoll)&lt;br /&gt;
&lt;br /&gt;
LeftFoot, LeftToeBase&lt;br /&gt;
&lt;br /&gt;
RightFoot, RightToeBase&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{spawnargs}}&lt;/div&gt;</summary>
		<author><name>Springheel</name></author>
	</entry>
	<entry>
		<id>https://wiki.thedarkmod.com/index.php?title=Attaching_Props_to_AI&amp;diff=19642</id>
		<title>Attaching Props to AI</title>
		<link rel="alternate" type="text/html" href="https://wiki.thedarkmod.com/index.php?title=Attaching_Props_to_AI&amp;diff=19642"/>
		<updated>2017-08-26T17:39:11Z</updated>

		<summary type="html">&lt;p&gt;Springheel: /* Binding */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Attaching things to AI is an important way to make your AI unique.  &lt;br /&gt;
&lt;br /&gt;
There are two ways to attach things (hereafter referred to as &#039;props&#039;) to AI.  Each has its strengths and weaknesses.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;To attach working weapons and heads see [[Adding Heads and Weapons to AI]]&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Using Def_Attach ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Benefits:&#039;&#039;&#039;  The mapper can easily attach pre-existing prop entities; no fiddling with positions or rotations.  More importantly, def_attached entities often adjusts AI animations appropriately (eg, def_attaching a torch automatically makes the AI use the &#039;torch&#039; animations).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Weaknesses:&#039;&#039;&#039; It is time-consuming to make prop entities that don&#039;t already exist.  Def_attached objects will not be visible in DR.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Each AI has a set of pre-determined coordinates (attachment points).  The mapper can attach things to these points by using the following spawnargs in an AI&#039;s entity window:&lt;br /&gt;
&lt;br /&gt;
 &amp;quot;def_attach5&amp;quot;  &amp;quot;[entity name]&amp;quot;&lt;br /&gt;
 &amp;quot;pos_attach5&amp;quot;  &amp;quot;[attachment point name]&amp;quot; &lt;br /&gt;
&lt;br /&gt;
The number is arbitrary.  As long as both lines have the same number, you could use 999.  Best to stay away from numbers 1-5, however, as some AI come with default props (pauldrons, weapons, etc), and you could overwrite them.  &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;[entity name]&#039;&#039;&#039; is the entity that you want to attach, like &amp;quot;atdm:prop_torch_gothic_on&amp;quot;.  You can find a list of preset attachable objects in prop_items.def and prop_wearable_items.def.  Or see the quick list below.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;[attachment point name]&#039;&#039;&#039; is the name of the predefined point you want to attach the object to, like &amp;quot;hand_l&amp;quot;.  See the list of preset attachment points below.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This image indicates some common attachment points.  You can cut and paste the names below:&lt;br /&gt;
&lt;br /&gt;
http://www.mindplaces.com/save/attachment_points.jpg&lt;br /&gt;
&lt;br /&gt;
1.  &#039;&#039;&#039;&amp;quot;hip_sheath_l&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This is designed for sheathed weapons on the hip.&lt;br /&gt;
&lt;br /&gt;
2.  &#039;&#039;&#039;&amp;quot;hand_l&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The left hand, used for torches, bottles, etc.  You can attach a weapon to this hand but AI will not attack with it.&lt;br /&gt;
&lt;br /&gt;
3.  &#039;&#039;&#039;&amp;quot;belt_back_right&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This is on the back of the belt on the right hand side, designed for purses, keys, or other things players may want to pickpocket.&lt;br /&gt;
&lt;br /&gt;
4.  &#039;&#039;&#039;&amp;quot;hand_r&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The right hand.  Generally reserved for weapon use.&lt;br /&gt;
&lt;br /&gt;
5.  &#039;&#039;&#039;&amp;quot;slung_across_back_rl&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This is primarily used for weapons worn on the back, like hammers or bows.&lt;br /&gt;
&lt;br /&gt;
=== List of Attachable Objects ===&lt;br /&gt;
The following are prop entities already created for def_attaching.  You can cut and paste these into the entity window in DR.  You may need to change the number to something unique.&lt;br /&gt;
&lt;br /&gt;
For information on making new attachment points, or positioning new entities, see [[Attachment Positions]].&lt;br /&gt;
&lt;br /&gt;
==== Lights ====&lt;br /&gt;
&lt;br /&gt;
 &amp;quot;def_attach5&amp;quot;  &amp;quot;atdm:prop_torch_on&amp;quot;        // a regular, lit torch&lt;br /&gt;
 &amp;quot;pos_attach5&amp;quot;  &amp;quot;hand_l&amp;quot;&lt;br /&gt;
&lt;br /&gt;
 &amp;quot;def_attach5&amp;quot;   &amp;quot;atdm:prop_torch_gothic_on&amp;quot;     // a lit torch with a cage&lt;br /&gt;
 &amp;quot;pos_attach5&amp;quot;  &amp;quot;hand_l&amp;quot;&lt;br /&gt;
&lt;br /&gt;
 &amp;quot;def_attach5&amp;quot;   &amp;quot;atdm:prop_lantern_on&amp;quot;       // a brass oil lantern&lt;br /&gt;
 &amp;quot;pos_attach5&amp;quot;  &amp;quot;hand_l&amp;quot;&lt;br /&gt;
&lt;br /&gt;
 &amp;quot;def_attach5&amp;quot;   &amp;quot;atdm:prop_lantern02_on&amp;quot;       // an alternate metal oil lantern&lt;br /&gt;
 &amp;quot;pos_attach5&amp;quot;  &amp;quot;hand_l&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==== Belt Objects ====&lt;br /&gt;
&lt;br /&gt;
 &amp;quot;def_attach6&amp;quot;  &amp;quot;atdm:prop_lootbag&amp;quot;  // used for loot&lt;br /&gt;
 &amp;quot;pos_attach6&amp;quot;  &amp;quot;belt_back_right&amp;quot;&lt;br /&gt;
&lt;br /&gt;
 &amp;quot;def_attach6&amp;quot;   &amp;quot;atdm:prop_belt_pouch&amp;quot;  // used for decoration&lt;br /&gt;
 &amp;quot;pos_attach6&amp;quot;   &amp;quot;belt_back_right&amp;quot;&lt;br /&gt;
&lt;br /&gt;
 &amp;quot;def_attach6&amp;quot;   &amp;quot;atdm:prop_key_gold&amp;quot;&lt;br /&gt;
 &amp;quot;pos_attach6&amp;quot;   &amp;quot;belt_back_right&amp;quot;&lt;br /&gt;
&lt;br /&gt;
 &amp;quot;def_attach6&amp;quot;   &amp;quot;atdm:prop_key_silver&amp;quot;&lt;br /&gt;
 &amp;quot;pos_attach6&amp;quot;  &amp;quot;belt_back_right&amp;quot;&lt;br /&gt;
&lt;br /&gt;
 &amp;quot;def_attach6&amp;quot;   &amp;quot;atdm:prop_key_padlock&amp;quot;&lt;br /&gt;
 &amp;quot;pos_attach6&amp;quot;  &amp;quot;belt_back_right&amp;quot;&lt;br /&gt;
&lt;br /&gt;
 &amp;quot;def_attach6&amp;quot;   &amp;quot;atdm:prop_key_simple&amp;quot;&lt;br /&gt;
 &amp;quot;pos_attach6&amp;quot;  &amp;quot;belt_back_right&amp;quot;&lt;br /&gt;
&lt;br /&gt;
 &amp;quot;def_attach6&amp;quot;   &amp;quot;atdm:prop_key_fancy01&amp;quot;&lt;br /&gt;
 &amp;quot;pos_attach6&amp;quot;  &amp;quot;belt_back_right&amp;quot;&lt;br /&gt;
&lt;br /&gt;
 &amp;quot;def_attach6&amp;quot;   &amp;quot;atdm:prop_potion_healing&amp;quot;      // for pick-pocketing; AI will not use it.&lt;br /&gt;
 &amp;quot;pos_attach6&amp;quot;  &amp;quot;belt_back_right&amp;quot;&lt;br /&gt;
&lt;br /&gt;
 &amp;quot;def_attach6&amp;quot;   &amp;quot;atdm:prop_smithyhammer&amp;quot;  // a simple work hammer, decorative only atm&lt;br /&gt;
 &amp;quot;pos_attach6&amp;quot;  &amp;quot;hip_sheath_l&amp;quot;&lt;br /&gt;
&lt;br /&gt;
== Example, attaching a key to an AI == (bikerdude)&lt;br /&gt;
&lt;br /&gt;
 &amp;quot;def_attach6&amp;quot; &amp;quot;atdm:prop_silverkey&amp;quot;&lt;br /&gt;
 &amp;quot;pos_attach6&amp;quot; &amp;quot;belt_back_right&amp;quot;&lt;br /&gt;
 &amp;quot;name_attach6&amp;quot; &amp;quot;gate_key&amp;quot;&lt;br /&gt;
 &amp;quot;set inv_name on gate_key&amp;quot; &amp;quot;gate key&amp;quot;&lt;br /&gt;
 &amp;quot;set name on gate_key&amp;quot; &amp;quot;gate_key&amp;quot;&lt;br /&gt;
&lt;br /&gt;
More info can be found on the following thread - http://forums.thedarkmod.com/topic/13084-ai-attach-keys/&lt;br /&gt;
&lt;br /&gt;
==== Other ====&lt;br /&gt;
&lt;br /&gt;
 &amp;quot;def_attach5&amp;quot;   &amp;quot;atdm:prop_halberd&amp;quot;  // a long halberd; decorative only--dropped when AI alerted&lt;br /&gt;
 &amp;quot;pos_attach5&amp;quot;   &amp;quot;hand_l&amp;quot;&lt;br /&gt;
&lt;br /&gt;
 &amp;quot;def_attach5&amp;quot;   &amp;quot;atdm:prop_winebottle&amp;quot;  // AI holds bottle and occasionally drinks from it&lt;br /&gt;
 &amp;quot;pos_attach5&amp;quot;   &amp;quot;hand_l&amp;quot;&lt;br /&gt;
&lt;br /&gt;
 &amp;quot;def_attach5&amp;quot;   &amp;quot;atdm:prop_cards&amp;quot;  // AI holds hand of cards and occasionally draws another one.  For use when sitting.&lt;br /&gt;
 &amp;quot;pos_attach5&amp;quot;   &amp;quot;hand_l&amp;quot;&lt;br /&gt;
&lt;br /&gt;
== Binding ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Benefits:&#039;&#039;&#039; You can bind any object to an AI, so it is a great deal more flexible.  You can also see and position the object in DR.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Weaknesses:&#039;&#039;&#039; Bound objects cannot affect AI animations.  You must adjust each object individually.&lt;br /&gt;
&lt;br /&gt;
See [[BindToJoint]] for more info.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
See [[Attaching Items]] for more info on using bind.&lt;br /&gt;
&lt;br /&gt;
{{tutorial-ai}}&lt;/div&gt;</summary>
		<author><name>Springheel</name></author>
	</entry>
	<entry>
		<id>https://wiki.thedarkmod.com/index.php?title=Attaching_Props_to_AI&amp;diff=19641</id>
		<title>Attaching Props to AI</title>
		<link rel="alternate" type="text/html" href="https://wiki.thedarkmod.com/index.php?title=Attaching_Props_to_AI&amp;diff=19641"/>
		<updated>2017-08-26T17:38:44Z</updated>

		<summary type="html">&lt;p&gt;Springheel: /* Binding */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Attaching things to AI is an important way to make your AI unique.  &lt;br /&gt;
&lt;br /&gt;
There are two ways to attach things (hereafter referred to as &#039;props&#039;) to AI.  Each has its strengths and weaknesses.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;To attach working weapons and heads see [[Adding Heads and Weapons to AI]]&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Using Def_Attach ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Benefits:&#039;&#039;&#039;  The mapper can easily attach pre-existing prop entities; no fiddling with positions or rotations.  More importantly, def_attached entities often adjusts AI animations appropriately (eg, def_attaching a torch automatically makes the AI use the &#039;torch&#039; animations).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Weaknesses:&#039;&#039;&#039; It is time-consuming to make prop entities that don&#039;t already exist.  Def_attached objects will not be visible in DR.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Each AI has a set of pre-determined coordinates (attachment points).  The mapper can attach things to these points by using the following spawnargs in an AI&#039;s entity window:&lt;br /&gt;
&lt;br /&gt;
 &amp;quot;def_attach5&amp;quot;  &amp;quot;[entity name]&amp;quot;&lt;br /&gt;
 &amp;quot;pos_attach5&amp;quot;  &amp;quot;[attachment point name]&amp;quot; &lt;br /&gt;
&lt;br /&gt;
The number is arbitrary.  As long as both lines have the same number, you could use 999.  Best to stay away from numbers 1-5, however, as some AI come with default props (pauldrons, weapons, etc), and you could overwrite them.  &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;[entity name]&#039;&#039;&#039; is the entity that you want to attach, like &amp;quot;atdm:prop_torch_gothic_on&amp;quot;.  You can find a list of preset attachable objects in prop_items.def and prop_wearable_items.def.  Or see the quick list below.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;[attachment point name]&#039;&#039;&#039; is the name of the predefined point you want to attach the object to, like &amp;quot;hand_l&amp;quot;.  See the list of preset attachment points below.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This image indicates some common attachment points.  You can cut and paste the names below:&lt;br /&gt;
&lt;br /&gt;
http://www.mindplaces.com/save/attachment_points.jpg&lt;br /&gt;
&lt;br /&gt;
1.  &#039;&#039;&#039;&amp;quot;hip_sheath_l&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This is designed for sheathed weapons on the hip.&lt;br /&gt;
&lt;br /&gt;
2.  &#039;&#039;&#039;&amp;quot;hand_l&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The left hand, used for torches, bottles, etc.  You can attach a weapon to this hand but AI will not attack with it.&lt;br /&gt;
&lt;br /&gt;
3.  &#039;&#039;&#039;&amp;quot;belt_back_right&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This is on the back of the belt on the right hand side, designed for purses, keys, or other things players may want to pickpocket.&lt;br /&gt;
&lt;br /&gt;
4.  &#039;&#039;&#039;&amp;quot;hand_r&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The right hand.  Generally reserved for weapon use.&lt;br /&gt;
&lt;br /&gt;
5.  &#039;&#039;&#039;&amp;quot;slung_across_back_rl&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This is primarily used for weapons worn on the back, like hammers or bows.&lt;br /&gt;
&lt;br /&gt;
=== List of Attachable Objects ===&lt;br /&gt;
The following are prop entities already created for def_attaching.  You can cut and paste these into the entity window in DR.  You may need to change the number to something unique.&lt;br /&gt;
&lt;br /&gt;
For information on making new attachment points, or positioning new entities, see [[Attachment Positions]].&lt;br /&gt;
&lt;br /&gt;
==== Lights ====&lt;br /&gt;
&lt;br /&gt;
 &amp;quot;def_attach5&amp;quot;  &amp;quot;atdm:prop_torch_on&amp;quot;        // a regular, lit torch&lt;br /&gt;
 &amp;quot;pos_attach5&amp;quot;  &amp;quot;hand_l&amp;quot;&lt;br /&gt;
&lt;br /&gt;
 &amp;quot;def_attach5&amp;quot;   &amp;quot;atdm:prop_torch_gothic_on&amp;quot;     // a lit torch with a cage&lt;br /&gt;
 &amp;quot;pos_attach5&amp;quot;  &amp;quot;hand_l&amp;quot;&lt;br /&gt;
&lt;br /&gt;
 &amp;quot;def_attach5&amp;quot;   &amp;quot;atdm:prop_lantern_on&amp;quot;       // a brass oil lantern&lt;br /&gt;
 &amp;quot;pos_attach5&amp;quot;  &amp;quot;hand_l&amp;quot;&lt;br /&gt;
&lt;br /&gt;
 &amp;quot;def_attach5&amp;quot;   &amp;quot;atdm:prop_lantern02_on&amp;quot;       // an alternate metal oil lantern&lt;br /&gt;
 &amp;quot;pos_attach5&amp;quot;  &amp;quot;hand_l&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==== Belt Objects ====&lt;br /&gt;
&lt;br /&gt;
 &amp;quot;def_attach6&amp;quot;  &amp;quot;atdm:prop_lootbag&amp;quot;  // used for loot&lt;br /&gt;
 &amp;quot;pos_attach6&amp;quot;  &amp;quot;belt_back_right&amp;quot;&lt;br /&gt;
&lt;br /&gt;
 &amp;quot;def_attach6&amp;quot;   &amp;quot;atdm:prop_belt_pouch&amp;quot;  // used for decoration&lt;br /&gt;
 &amp;quot;pos_attach6&amp;quot;   &amp;quot;belt_back_right&amp;quot;&lt;br /&gt;
&lt;br /&gt;
 &amp;quot;def_attach6&amp;quot;   &amp;quot;atdm:prop_key_gold&amp;quot;&lt;br /&gt;
 &amp;quot;pos_attach6&amp;quot;   &amp;quot;belt_back_right&amp;quot;&lt;br /&gt;
&lt;br /&gt;
 &amp;quot;def_attach6&amp;quot;   &amp;quot;atdm:prop_key_silver&amp;quot;&lt;br /&gt;
 &amp;quot;pos_attach6&amp;quot;  &amp;quot;belt_back_right&amp;quot;&lt;br /&gt;
&lt;br /&gt;
 &amp;quot;def_attach6&amp;quot;   &amp;quot;atdm:prop_key_padlock&amp;quot;&lt;br /&gt;
 &amp;quot;pos_attach6&amp;quot;  &amp;quot;belt_back_right&amp;quot;&lt;br /&gt;
&lt;br /&gt;
 &amp;quot;def_attach6&amp;quot;   &amp;quot;atdm:prop_key_simple&amp;quot;&lt;br /&gt;
 &amp;quot;pos_attach6&amp;quot;  &amp;quot;belt_back_right&amp;quot;&lt;br /&gt;
&lt;br /&gt;
 &amp;quot;def_attach6&amp;quot;   &amp;quot;atdm:prop_key_fancy01&amp;quot;&lt;br /&gt;
 &amp;quot;pos_attach6&amp;quot;  &amp;quot;belt_back_right&amp;quot;&lt;br /&gt;
&lt;br /&gt;
 &amp;quot;def_attach6&amp;quot;   &amp;quot;atdm:prop_potion_healing&amp;quot;      // for pick-pocketing; AI will not use it.&lt;br /&gt;
 &amp;quot;pos_attach6&amp;quot;  &amp;quot;belt_back_right&amp;quot;&lt;br /&gt;
&lt;br /&gt;
 &amp;quot;def_attach6&amp;quot;   &amp;quot;atdm:prop_smithyhammer&amp;quot;  // a simple work hammer, decorative only atm&lt;br /&gt;
 &amp;quot;pos_attach6&amp;quot;  &amp;quot;hip_sheath_l&amp;quot;&lt;br /&gt;
&lt;br /&gt;
== Example, attaching a key to an AI == (bikerdude)&lt;br /&gt;
&lt;br /&gt;
 &amp;quot;def_attach6&amp;quot; &amp;quot;atdm:prop_silverkey&amp;quot;&lt;br /&gt;
 &amp;quot;pos_attach6&amp;quot; &amp;quot;belt_back_right&amp;quot;&lt;br /&gt;
 &amp;quot;name_attach6&amp;quot; &amp;quot;gate_key&amp;quot;&lt;br /&gt;
 &amp;quot;set inv_name on gate_key&amp;quot; &amp;quot;gate key&amp;quot;&lt;br /&gt;
 &amp;quot;set name on gate_key&amp;quot; &amp;quot;gate_key&amp;quot;&lt;br /&gt;
&lt;br /&gt;
More info can be found on the following thread - http://forums.thedarkmod.com/topic/13084-ai-attach-keys/&lt;br /&gt;
&lt;br /&gt;
==== Other ====&lt;br /&gt;
&lt;br /&gt;
 &amp;quot;def_attach5&amp;quot;   &amp;quot;atdm:prop_halberd&amp;quot;  // a long halberd; decorative only--dropped when AI alerted&lt;br /&gt;
 &amp;quot;pos_attach5&amp;quot;   &amp;quot;hand_l&amp;quot;&lt;br /&gt;
&lt;br /&gt;
 &amp;quot;def_attach5&amp;quot;   &amp;quot;atdm:prop_winebottle&amp;quot;  // AI holds bottle and occasionally drinks from it&lt;br /&gt;
 &amp;quot;pos_attach5&amp;quot;   &amp;quot;hand_l&amp;quot;&lt;br /&gt;
&lt;br /&gt;
 &amp;quot;def_attach5&amp;quot;   &amp;quot;atdm:prop_cards&amp;quot;  // AI holds hand of cards and occasionally draws another one.  For use when sitting.&lt;br /&gt;
 &amp;quot;pos_attach5&amp;quot;   &amp;quot;hand_l&amp;quot;&lt;br /&gt;
&lt;br /&gt;
== Binding ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Benefits:&#039;&#039;&#039; You can bind any object to an AI, so it is a great deal more flexible.  You can also see and position the object in DR.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Weaknesses:&#039;&#039;&#039; Bound objects cannot affect AI animations.  You must adjust each object individually.&lt;br /&gt;
&lt;br /&gt;
See [[BindtoJoint]] for more info.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
See [[Attaching Items]] for more info on using bind.&lt;br /&gt;
&lt;br /&gt;
{{tutorial-ai}}&lt;/div&gt;</summary>
		<author><name>Springheel</name></author>
	</entry>
	<entry>
		<id>https://wiki.thedarkmod.com/index.php?title=Limits,_Max,_Min,_Stats,_etc&amp;diff=19640</id>
		<title>Limits, Max, Min, Stats, etc</title>
		<link rel="alternate" type="text/html" href="https://wiki.thedarkmod.com/index.php?title=Limits,_Max,_Min,_Stats,_etc&amp;diff=19640"/>
		<updated>2017-08-24T16:12:23Z</updated>

		<summary type="html">&lt;p&gt;Springheel: /* AI limits */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;Written by Fidcal&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This is a collection of game and map limits, maximums and minimums, etc. for the mapper to reference.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note that some values might change as many features are still work in progress.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
All units used here are Dark Radiant grid units (same as Doom 3 units.)&lt;br /&gt;
&lt;br /&gt;
==Conversion of game units==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Main article: [[Conversion of Game Units]]&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* 1.1 DarkRadiant grid units = 1 inch = 2.54 cm&lt;br /&gt;
* 1 DarkRadiant unit = 0.909 inches = 2.309 cm&lt;br /&gt;
&lt;br /&gt;
==Grid Size==&lt;br /&gt;
&lt;br /&gt;
Grid size is 131,072 x 131,072 units x 131,072 (inches) or about 2 x 2 x 2 miles&lt;br /&gt;
&lt;br /&gt;
Theoretically a map might be made with about 50 stacks of 2 x 2 miles each about 200 foot high that&#039;s 100 x 100 miles or 10,000 square miles. Problem is handling the file size but it illustrates that the only limit is labour, imagination, RAM size, etc.&lt;br /&gt;
&lt;br /&gt;
==Entities==&lt;br /&gt;
&lt;br /&gt;
The limit is 8192 entities per map. However, maps should not get too close to this limit, as headroom for entities spawned at runtime has to be left. &lt;br /&gt;
&lt;br /&gt;
Runtime entities are f.i. the player character, weapons, projectiles you shoot. The biggest source of &amp;quot;hidden entities spawned at runtime&amp;quot; are the combo entities. F.i. each candle or torch spawns at least a flame, fireplaces spawn the flame and possible extra wood piles, candle holders spawn a candle and the flame, a chandelier might spawn 3 candles and 3 flames etc. Note that the flames are spawned even if the entity is not lit, to allow for the player relighting it.&lt;br /&gt;
&lt;br /&gt;
Another source of dynamically spawned entities are vine patches spawned by the vine arrow.&lt;br /&gt;
&lt;br /&gt;
So keep your entities well below 7000 or even 6000.&lt;br /&gt;
&lt;br /&gt;
It&#039;s possible to raise the entity limit in the SDK further, but usually we won&#039;t do that until it&#039;s absolutely necessary. Some of the biggest maps have currently in the range of 4000..5000 entities, and this is already pushing the boundaries in terms of memory and CPU - spawning entities costs, time, too.&lt;br /&gt;
&lt;br /&gt;
To combine multiple entities into one you can use the [[SEED]] system.&lt;br /&gt;
&lt;br /&gt;
==Collision Models==&lt;br /&gt;
&lt;br /&gt;
There is an additional limit of &#039;&#039;&#039;8192&#039;&#039;&#039; [[Clip Model|collision models]] (4096 before v2.04 and 2048 before v1.08).&lt;br /&gt;
&lt;br /&gt;
==Rendering (Models, Polygons, Shadows)==&lt;br /&gt;
&lt;br /&gt;
There really isn&#039;t a limit on how many polygons (tris) are visible at once. Scenes with 4 million triangles might not achieve great performance, especially on older hardware, but they do run.&lt;br /&gt;
&lt;br /&gt;
The renderer had a limit of 10,000 &amp;quot;model handles&amp;quot; (which roughly translates into &amp;quot;10,000 models visible at the same time&amp;quot;), but this has been increased with v1.08 to 65,537, so this should no longer be such an issue. (Defined in the source as LUDICROUS_INDEX.)&lt;br /&gt;
&lt;br /&gt;
The things that affect performance most are collision models (the more there are, the harder the game has to work to test things colliding with each other, which f.i. is done for every AI that moves, for the player etc), and shadows. The more things that cast shadows, and the more detailed these shadows are, the more time it takes. However, it is not known whether there really is a limit to how many shadow tris can be cast, as it gets way too slow long before any limit is reached.&lt;br /&gt;
&lt;br /&gt;
==Player Limits==&lt;br /&gt;
&lt;br /&gt;
===Doorways, gaps===&lt;br /&gt;
&lt;br /&gt;
* Minimum width a player can squeeze through = 33&lt;br /&gt;
* Minimum width a player can lean into = 20&lt;br /&gt;
* Minimum height a player can walk under = 75&lt;br /&gt;
* Minimum height a player can crouch through is 39&lt;br /&gt;
* Minimum square hole to drop into/mantle out of is 39 (length) x 33 (width.) Note that this is difficult (impossible?) to mantle up through if no sides in hole to align to (ie if just a hole in a ceiling rather than a 39 x 33 shaft, see below)&lt;br /&gt;
* Minimum oval hole to drop into/mantle out of is 39 (length) x 33 (width.) Note that this is extremely difficult for the player to align to even to drop down, see below.&lt;br /&gt;
* Minimum circular hole to drop into/mantle out of is 39 x 39 Note that this is presumed and not tested and likely to be extremely difficult for the player to align to even to drop down, see below&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;ADDITIONAL NOTES:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
# Ladders need significant extra space so allow for that and test. Sometimes a ladder does not need to go through an opening but only up to it. See also the following note.&lt;br /&gt;
# Smaller gaps can be simulated by lining the opening with entity brush(es)/patch(es) and giving it/them the property/value:  solid 0. But you need to consider the player&#039;s vision clipping into that &#039;simulated solid&#039; and test this. This same technique can also be used to simulate even legitimate small/minimum sizes (ie, make the actual solid gap larger) in order to make them easier (and probably less frustrating) for the player.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Mantling, Jumping===&lt;br /&gt;
&lt;br /&gt;
* Maximum normal mantle, standing, walking, or running = 134&lt;br /&gt;
* Maximum jump mantle, standing, walking, or running = 182&lt;br /&gt;
* Minimum height to mantle onto = 1&lt;br /&gt;
* Minimum width to mantle onto = 1&lt;br /&gt;
* Minimum open wall depth to mantle onto = 1&lt;br /&gt;
* Minimum shelf depth to jump mantle onto from front = 16&lt;br /&gt;
* Minimum shelf depth to jump mantle onto from side = 16&lt;br /&gt;
* Minimum ledge depth to mantle or jump mantle onto from front = 16&lt;br /&gt;
* Minimum ledge depth to mantle or jump mantle onto from side = 16&lt;br /&gt;
* Minimum height of bottom of shelf to normal mantle onto = 74&lt;br /&gt;
* Minimum height of bottom of shelf to jump mantle onto = 122&lt;br /&gt;
* Maximum gap to run jump mantle over = 176&lt;br /&gt;
* Maximum fall without damage = 186&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==AI limits==&lt;br /&gt;
&lt;br /&gt;
This varies with the different types of AI.&lt;br /&gt;
&lt;br /&gt;
Humanoid AI have a cylinder size of 32, so technically they should be able to get through gaps that are larger than this.  &#039;&#039;edit:  I&#039;ve tested gaps of 32 and AI would not attempt to path through them.  Changing the gap to 36 caused the AI to path through it properly.  -- Springheel&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Path points closer than 16 units to worldspawn or monsterclip can cause AI problems.&lt;br /&gt;
&lt;br /&gt;
Minimum doorway width a normal humanoid AI can go through = 48  (seems to contradict 32 value above?)&lt;br /&gt;
Minimum doorway height a normal humanoid AI can go under = 88?&lt;br /&gt;
&lt;br /&gt;
==Slopes and Steps==&lt;br /&gt;
&lt;br /&gt;
The maximum slope for an AI is approximately 40 degrees from the horizontal but varies upon the situation and the AI.&lt;br /&gt;
&lt;br /&gt;
The player can walk without slipping off on slopes no steeper than 45 degrees from the horizontal. If the terrain is rough this could be frustratingly difficult, however. By default, the player cannot mantle on slopes steeper than 45 degrees either (this is intended to avoid continuous-mantling exploits).&lt;br /&gt;
&lt;br /&gt;
The maximum step height for AI and player is 16 though some AI cannot step up over 14 and perhaps less. But the minimum depth from front to back of a step is only 1 and this can be used to get extreme slopes and very steep steps - even near vertical walls (see [[Pathfinding]])&lt;br /&gt;
&lt;br /&gt;
==Weapons and Items==&lt;br /&gt;
* Maximum length of rope attached to the rope arrow = ~400&lt;br /&gt;
&lt;br /&gt;
{{editing}}&lt;/div&gt;</summary>
		<author><name>Springheel</name></author>
	</entry>
	<entry>
		<id>https://wiki.thedarkmod.com/index.php?title=Visportals&amp;diff=19639</id>
		<title>Visportals</title>
		<link rel="alternate" type="text/html" href="https://wiki.thedarkmod.com/index.php?title=Visportals&amp;diff=19639"/>
		<updated>2017-08-23T19:53:58Z</updated>

		<summary type="html">&lt;p&gt;Springheel: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;written by Fidcal. Visportals, Func_statics and Worldspawn Brushes added by Sotha.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== What are visportals? ==&lt;br /&gt;
Visportals are a very important part of mapping.  They are a kind of brush that helps separate your map into individual areas (called visleafs), which is important for both rendering and sound propagation.&lt;br /&gt;
&lt;br /&gt;
Without visportals, the Doom engine would render the entire map even if the player can only see one small area. This would reduce performance and slow the game down.  &lt;br /&gt;
&lt;br /&gt;
Visportals are also very important for sound propagation. Without them, sounds can travel through brushwork and reach areas of the map that they shouldn&#039;t (see &#039;&#039;Sound Propagation&#039;&#039; at the bottom of the page).&lt;br /&gt;
&lt;br /&gt;
[https://youtu.be/RmKjmt7IJr8 Video Introduction to Visportals.]&lt;br /&gt;
&lt;br /&gt;
Visportals determine how far the engine should render from the player&#039;s position. When a visportal is in the player&#039;s view, the engine tests to see if there is a second visportal viewable from the position of the first. If yes then it tests to see if a third one can be seen from the second one. If the third is not viewable from the first then the engine won&#039;t waste time rendering the map beyond it. If it is, then the engine tests for a fourth one and so on. So for example, with a long corridor with lots of 90 degree turns in it and visportals at every bend then the engine will only render the section you are in plus any parts of the next section you can see. But as you get near to it and can see further down it to the next bend&#039;s visportal then it will render the next one too.&lt;br /&gt;
&lt;br /&gt;
Anything in the visleaf that the player is currently in is rendered (if it is your field of view) regardless of whether it is behind worldspawn.  But things in an adjacent visleaf will not be rendered if they are behind worldspawn.  The engine still has to calculate what the player can see and what he can&#039;t, and this still uses resources, but far less than if it were in the same visleaf as the player.  Any visleaf that is behind a closed portal is automatically beyond what the player can see, to the engine can skip testing it completely.  This is why closed visportals are so valuable for performance.&lt;br /&gt;
&lt;br /&gt;
The console command &#039;&#039;&#039;r_showPortals 1&#039;&#039;&#039; shows processed visportals as wireframe in-game for testing - even right through walls they are visible. A green wireframe is an &#039;open&#039; visportal and renders everything beyond it up to the next visportal.  A red wireframe is a &#039;closed&#039; visportal with nothing rendered beyond it and no further visportals beyond that are even processed so are not visible at all. If a visportal does not show then it is either beyond range of processing or it is not working so check it is set up correctly.&lt;br /&gt;
&lt;br /&gt;
== What is rendering? ==&lt;br /&gt;
Rendering might be regarded as the calculating of surface lighting, colour, texture, etc. Not all rendered surfaces are visible in-game but still have to be calculated. Others do not need rendering at all. Processing only takes place in the current portal area, that is, up to the nearest closed visportals. Surfaces are treated as divided into triangles for rendering purposes. The &#039;&#039;&#039;r_showTris&#039;&#039;&#039; console command shows those triangles as wireframes. In the console use &#039;&#039;&#039;r_showTris N&#039;&#039;&#039; where N is...&lt;br /&gt;
&lt;br /&gt;
*0 - Off - normal gameplay with no wireframes shown.&lt;br /&gt;
*1 - Shows only triangles that are visible in-game (not hidden behind other surfaces.) These visible surfaces are only part of what is rendered.&lt;br /&gt;
*2 - Shows as wireframes, all triangle surfaces that would be rendered in-game. This includes those hidden behind other surfaces BUT ONLY IF they face the player, even slightly. Surfaces facing away from the player are never rendered.&lt;br /&gt;
*3 - Shows as wireframes, all triangle surfaces even if not rendered.&lt;br /&gt;
&lt;br /&gt;
You can see that for the purpose of testing performance use 2 above which shows all that would be rendered (whether visible to the player or not.) You can use 3 to see &#039;&#039;all&#039;&#039; triangles up to the next closed visportal but remember not all of it will be rendered so will not affect performance.&lt;br /&gt;
&lt;br /&gt;
You might also use &#039;&#039;&#039;r_useScissor 0&#039;&#039;&#039; to show geometry outside the visportal wireframe that Doom still sends to the video card but tells it not to render. &#039;&#039;&#039;r_useScissor 1&#039;&#039;&#039; helps performance but even sending the geometry uses processor time so if you can reduce it by adjusting visportal placement so much the better.&lt;br /&gt;
&lt;br /&gt;
(Remember to return to &#039;&#039;&#039;r_useScissor 1&#039;&#039;&#039; when you are done with visportal testing.)&lt;br /&gt;
&lt;br /&gt;
Here is a short video with a decent visual breakdown:&lt;br /&gt;
&lt;br /&gt;
[http://www.gdcvault.com/play/1014234/Excerpt-Quake-Postmortem-Optimizing-Level Video]&lt;br /&gt;
&lt;br /&gt;
Another video:&lt;br /&gt;
&lt;br /&gt;
[http://youtu.be/cy4FIE7BhCQ http://img.youtube.com/vi/cy4FIE7BhCQ/1.jpg]&lt;br /&gt;
&lt;br /&gt;
== How and where to create visportals ==&lt;br /&gt;
&lt;br /&gt;
Visportals are just brushes with one face covered in visportal texture. That is the operative face. Only be concerned with that one surface as the rest of the brush merely carries it. So to create one you just....&lt;br /&gt;
&lt;br /&gt;
* Make a thin brush like a wall. Ideally make it rectangular for best sound propagation (see &#039;&#039;Sound Propagation&#039;&#039; later.) It can extend beyond the gap so does not necessarily need to be the same shape - see &#039;&#039;Where to place your Visportal&#039;&#039; later.&lt;br /&gt;
* Give it &#039;&#039;&#039;textures &amp;gt; editor &amp;gt; visportal&#039;&#039;&#039; to either of the main surfaces facing towards or away from you. It does not matter which except you need to be aware which it is because the visportal will be effective at that one face. (Use {{Ctrl}} + {{Shift}} + {{LMB}} on the face in the Dark Radiant camera view to select one face.)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Thickness ===&lt;br /&gt;
The exact thickness is not important to its effectiveness as it will only be effective from its one visportal-textured face anyway but it makes sense to keep it reasonably thin so you can see it clearly in the editor. Always think of visportals as one flat face and the rest of the brush can be ignored for functional purposes.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Where to place your Visportal ===&lt;br /&gt;
It will eventually be wedged tight like a plug into gaps, doorways, etc. between areas. The edges of the visportal-textured face of visportals should be completely sealed by or in solid &#039;&#039;worldspawn&#039;&#039; brush that has no gaps. The brush &#039;&#039;&#039;must&#039;&#039;&#039; be a child of worldspawn and &#039;&#039;&#039;not&#039;&#039;&#039; an entity. This is true even if the visportal is within a door (see next section.) For the visportal to be effective it does not matter if the rest of the visportal brush sticks out into space so long as the edges of the visportal-textured face are surrounded by worldspawn brush and/or another visportal brush (see later) In practice you will probably put most fully within a corridor or doorway, a city street (yes, the sky above is solid worldspawn brush), etc. Irregular shaped gaps must still be plugged with a rectangular visportal which should then overlap into the solid worldspawn and leave no gaps. This will also make sound propagation work correctly (see &#039;&#039;Sound Propagation&#039;&#039; later.)&lt;br /&gt;
&lt;br /&gt;
Each area you thus created must be totally enclosed with worldspawn brushes with no gaps of either space else an entity. So a closed building with visportals at the doors but a tiny gap under the eaves of the roof won&#039;t work! Also avoid only blocking gaps with entities whether brushes or models. For example, a two-sided window entity that completely fills the opening will not seal the area for portalling purposes. Do not put in a visportal unless the window is either transparent or can be opened (like a door.) Instead put in a worldspawn brush with nodraw texture on it so it will not be visible or collidable just in front of the window. Or if you are using two windows back to back (say a lit one outside and an unlit one inside then a thin caulk brush between them.&lt;br /&gt;
&lt;br /&gt;
Generally you will place visportals on bends in the terrain around which the player cannot see from the current viewpoint. Avoid placing visportals in a line along a corridor or street for example. Since the player can see straight down through them all then they serve no purpose as they will all be open and visportals themselves create extra triangles and complexity (see downside section below.)&lt;br /&gt;
&lt;br /&gt;
With a large building surrounded by a walled open area then try visportals at each corner. If it is a very large building then also add visportals midway along each side. The player standing at one corner might be able to see up two sides, part of a far side, and even a small part of the fourth side so all sides would be rendered. By having extra visportals middway along each side then at least half of each side of the furthest corner need not be rendered (consider also preventing the player reaching such a viewpoint with an obstruction!)&lt;br /&gt;
&lt;br /&gt;
Subject to the above, try to find the smallest gaps where possible to place visportals. The smaller the visportal then the smaller the view aperture and so the less chance of lining up those apertures. Remember, visportals beyond the first one do not open unless they intersect all open visportals in that line of view. Even without a door, an open doorway is a better place for a visportal than a wider corridor or room beyond. Imagine trying to get a straight pole through as many of these visportal apertures as possible; the narrower and less aligned they are then the harder to get the pole very far.&lt;br /&gt;
&lt;br /&gt;
Don&#039;t get too hung up on perfect placement of every last visportal. Generally if you follow this guide and use your judgement you achieve a satisfactory game performance. Examine some large maps that you know work well to get some ideas where visportals are placed using the &#039;&#039;&#039;r_showPortals 1&#039;&#039;&#039; command.&lt;br /&gt;
&lt;br /&gt;
What if you put visportal texture on both main faces of the visportal brush? Only one will be effective. If the visportal brush juts out into space then visportal texture at that end will not work but the one at the other end will be the operative one. If you rotated the brush then it still works and uses whichever one is surrounded by solid. If both are in space it does not work at all. If both are surrounded by solid then only one works. Which one? Hard to tell. It seems to be determined by the local geometry. It is interesting to note that when you use r_showTris 3 to see what is rendered then the triangles are confined to either side of the visportal face. In other words, a long corridor wall rendered as two large triangles would now be split into four triangles. So a visportal might be considered to help with multiple lighting performance as you do not need to visually change the terrain with trim etc.&lt;br /&gt;
&lt;br /&gt;
What if you put visportal texture on all the surfaces of the brush? Only one is effective (must be surrounded by solid brush.) To be certain of optimum performance use nodraw on all surfaces except the one face with visportal texture.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Multiple Joined Visportals===&lt;br /&gt;
Because visportals are a single face, by their very nature they can only be placed on a single brush. But visportal brushes can be placed or merged together to fill more complex shaped gaps. For example, a wide rectangle might have one side clipped to slope over a roof while the rectangular part of its shape sits on top of another rectangle across the street below. But complexity affects performance so only do this if one rectangular visportal intruding into interior walls might do the same job. Remember, it does not matter if the visportal overlaps into solid so if there is an interior wall on the same plane (or indeed if the building is totally solid) then the visportal can penetrate it and still function. Do not use multiple visportals just to shape nicely around solid building trim and structure but intrude into it so long as the edge does not exit into space at any point it will be fine.&lt;br /&gt;
&lt;br /&gt;
== Visportals and doors ==&lt;br /&gt;
A visportal in contact with a door that has an openable property is automatically closed when the door is closed and automatically becomes conventionally operative when the door opens. By &#039;operative&#039; I mean it is then like a normal visportal and will be open or closed depending on the player&#039;s view. So when you first go through a door and leave it open then its visportal will be open as you look immediately back at it. But as you then proceed further through other visportals, the door visportal will eventually close (prevent rendering through it) even if the door itself is left open.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Doors standing in front of but not within a doorway ===&lt;br /&gt;
Note that the visportal only needs to be in contact with the door to be affected by it. Normally you would place the visportal within the door but it actually only needs its visportal-textured surface to touch it. This means that if you have a door that is stood in front of an opening in a wall then you cannot put the visportal inside the door because it will not be surrounded by solid brush. But you can put a visportal just inside the opening and flush with the mouth of the opening and the door immediately in front of that and in contact with the visportal. You can test this by placing the door offset well to one side but part of it still in contact with the visportal. In game you can see the opening as the door is only partially covering it. When the door is closed the visportal closes and stops rendering through the doorway. You will see this as a black panel in the doorway. As the door opens the black panel disappears and you can see through the doorway again. You might think that from the other side the black panel would obscure the door when closed but it doesn&#039;t. With the door centred in its normal position, typically you might have an entity frame around the door. If you had a solid brush frame without gaps then the visportal could be inside the door if you wanted as it would then have solid all round its edges. In many cases of course, the door frame, whether entity or brush, would be within the solid brush doorway anyway.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Windows, Doors with windows, bars, etc. ===&lt;br /&gt;
Openable doors that let you see through them such as windows, doors with windows, barred gates, etc. should not be in contact with a visportal. When the door is closed it will automatically close any visportal whose effective surface is in touch with it. The visportal will not then permit any rendering through it and will show as a black panel in the window or between the bars of a gate. Instead, move the visportal away from the door. It will still function effectively as a normal visportal just as if the door were not there. This does not of course apply to simulated windows such as a glazed textured panel on a door texture where you cannot actually see through.&lt;br /&gt;
&lt;br /&gt;
All doors and windows that do not have an openable property can have a visportal in touch with them as it will not be affected by them and it will just function as a normal visportal.&lt;br /&gt;
&lt;br /&gt;
{{red|Rev. 2.00:}}&lt;br /&gt;
&lt;br /&gt;
Starting with Rev. 2.00, you can touch a see-through door or window with a visportal, and the portal will not close when the door/window is closed, as long as you use the following spawnarg &#039;&#039;&#039;on the door/window&#039;&#039;&#039; (not the info_portalsettings entity):&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;transparent&#039;&#039;&#039; &amp;quot;If set to 1 (0 by default), a see-through door can touch a visportal and the visportal won&#039;t close when the door is closed.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
This is useful when you want the opening or closing of the door to affect the sound loss across the portal, but not affect visibility through the door/window. Imagine a closed window that muffles a sound beyond it, and as the window opens, the sound gets louder.&lt;br /&gt;
&lt;br /&gt;
==Visportal switches: func_portals==&lt;br /&gt;
&lt;br /&gt;
The preceding section &#039;&#039;Visportals and doors&#039;&#039; makes clear that doors can function like switches to enable and close visportals in contact with them. &#039;&#039;func_portals&#039;&#039; can be used to enact further control over portals. You can place a &#039;&#039;func_portal&#039;&#039; entity so that it intersects with a visportal, and then trigger the func_portal to close or open the visportal.  A second control method is had by using the &#039;&#039;portal_dist&#039;&#039; and &#039;&#039;distcheck_period&#039;&#039; properties on the &#039;&#039;func_portal&#039;&#039;.  They control the distance to the player and how frequently (in seconds) this distance should be checked, respectively, and make explicit triggering of the &#039;&#039;func_portal&#039;&#039; unnecessary.  As with doors, even if enabled, the visportal will not be open even if it is in the player&#039;s view.  Note, if you have a mover (door/window) in contact with the visportal, it will affect it as well, so typically a visportal controlled by func_portal is placed away from the mover, or use spawnarg &amp;quot;transparent&amp;quot; set to 1.&lt;br /&gt;
&lt;br /&gt;
Another clever trick exists with regard to &#039;&#039;func_portal&#039;&#039;s:  you can also build a func_static over the visportal, and target it with the &#039;&#039;func_portal&#039;&#039; as normal.  Now, in addition to opening and closing the portal, this will also toggle the drawing of the &#039;&#039;func_static&#039;&#039;.  This means you could place an appropriate texture (perhaps a low resolution image of a room&#039;s interior, drawn over a window) and have it turn on or off based on the player&#039;s distance away.  From a distance, the player wouldn&#039;t be able to tell that the the entire room wasn&#039;t being rendered.  This can be an effective way to create the illusion of long view distances.&lt;br /&gt;
&lt;br /&gt;
Note that the func_static must touch the visportal in order to work.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;One way to make this work is to create a patch, make it a func_static.  Texture the patch, and then target the func_portal at that func_static.  You must then add &amp;quot;hide&amp;quot; &amp;quot;1&amp;quot; to the func_static patch.  There may be other ways to make this work, but I had a lot of trouble until I took these steps.  -- Springheel&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
An interesting, recent discovery that needs some testing is that apparently:  you can take one visportal and cut it in half, and then put different func_portals on each half in order to close them at different ranges.  That has interesting implications for wide city streets.  They require big visportals, but if you can split them up and independently control each part, there may be some benefits there.  http://forums.thedarkmod.com/topic/9082-newbie-darkradiant-questions/?p=370473&lt;br /&gt;
&lt;br /&gt;
== Need I design, even compromise my map to make best use of visportals? ==&lt;br /&gt;
You need to design your map from the start as a series of connected boxes (brushes) with the player&#039;s view, sound propogation, and visportals in mind. And yes, sometimes you might need to add a bend you don&#039;t want or obstruct a view in some way so you can put in another visportal if you are having or expecting slow down in a large and/or complex area. This is a matter of experience. If you have large complex areas and are experiencing frame lag but can see no obvious place to put a visportal then you might need to compromise your terrain and add some solid brush barriers to block certain views with visportals in the access round or through them.&lt;br /&gt;
&lt;br /&gt;
Note that it is not essential that visportals be only at the actual joins between brushes; they still work even if they are half way down a corridor so long as they are wedged in tight without gaps. But you will mostly place them at joins.&lt;br /&gt;
&lt;br /&gt;
For rendering considerations, the player&#039;s view is everything and every room and street in front of you even if there are walls, etc. in the way. Imagine what you would see with X-Ray vision. What is behind you or just out of range of the screen does not matter. But visportals restrict the view to what can be seen through the aperture of the visportal.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
It is not necessary to put visportals at every tiny bend in the map; in fact that should be avoided in smaller areas because visportals themselves create extra triangles and complexity (see downside section below.) Try to keep in mind what will be rendered through the visportals and judge what would &#039;&#039;not&#039;&#039; cause frame lag slowdown if the player could actually see that view. Three or four bends without visportals in a restricted air duct is not going to cause any problem if the duct is correctly visportalled at the ends for example.&lt;br /&gt;
&lt;br /&gt;
== Is there a downside? ==&lt;br /&gt;
One downside to visportals is that is extra work for the mapper! Another is that they split the geometry and create extra triangles and batches. This will not normally cause a problem unless your map has a very large number of areas. The advantages in performance of using visportals far outweigh the downsides!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Sound Propagation==&lt;br /&gt;
&lt;br /&gt;
Correct propagation of sound (both to AI and to the player) relies on visportals.&lt;br /&gt;
&lt;br /&gt;
Think of vis-portals as sealing off separate &amp;quot;areas&amp;quot; in a map.  A sound that occurs inside a sealed &amp;quot;area&amp;quot; will travel in a straight line to anyone inside the same area, even through walls.  If you are not in the same area, however, the sound will travel in a straight line to the first visportal between you and the sound source, then to the next one, etc, until it reaches the area you are in.&lt;br /&gt;
&lt;br /&gt;
If the sound happens in an area that is not sealed, it essentially considers the whole map its &amp;quot;area&amp;quot;, and will go straight to the player, through walls, floors, or other brushwork.  This can result in confusion for players, as they will hear AI on the other side of a massive wall as if they were standing beside each other.&lt;br /&gt;
&lt;br /&gt;
In the following examples, &amp;quot;P&amp;quot; is the player and &amp;quot;S&amp;quot; is the sound source.  The Visportals are red lines. The green lines show how the sound would travel.&lt;br /&gt;
&lt;br /&gt;
[[image:vis.jpg]]&lt;br /&gt;
&lt;br /&gt;
Without any visportals, the sound goes in a straight line to the player, even through solid walls.  It will sound like the player is in the same room as the sound.&lt;br /&gt;
&lt;br /&gt;
One visportal is an improvement--it will sound further away, but the sound travels straight to the visportal and then straight to the player, so it will still sound like it is coming through the wall.  &lt;br /&gt;
&lt;br /&gt;
Two visportals are best in this case, however.  The sound will seem like it is coming from the opening to the room, which is where you would expect it to come from.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Sound &#039;&#039;going to the AI&#039;&#039; travels the shortest distance through a visportal, passing at any point on the visportal surface.  Mappers should always use rectangular visportals unless you have no choice with an awkwardly shaped gap or if the gap is out of range of AI, for example along a sloping roof where AI never go. &#039;&#039;&#039;It also still assumes that when you do have four sides, they are perpendicular.&#039;&#039;&#039; If you have some non-90 degree angles between the sides, some wierdness may ensue. For example, an AI that is alerted in the dark (or facing away) by hearing a sound from the player that passes through an irregular visportal might run to the center of the visportal rather than directly to where the player made the noise. Irregular visportals large enough to make this effect noticeable are likely to be uncommon.&lt;br /&gt;
&lt;br /&gt;
This will be okay for smaller irregular visportals, but the error (path difference from the minimal path) will get more noticeable the larger the visportal.&lt;br /&gt;
&lt;br /&gt;
Visportals function individually even if joined together into complex shapes. So a rectangle at ground level topped by an angled visportal above it tilting out over a roof will be treated separately, not as one aperture. &lt;br /&gt;
&lt;br /&gt;
The bottom line is, with any non-rectangular visportals keep the above in mind and if in doubt then consider early testing of AI&#039;s alert to player sound.&lt;br /&gt;
&lt;br /&gt;
Visportals do NOT need to be closed to correctly channel sound to the player.  Sometimes it is worth adding visportals even if they will not help with rendering (because they will always be open) in order to make sound travel the way it should.  &lt;br /&gt;
&lt;br /&gt;
To make less sound go through a visportal (through a small hole, for example):&lt;br /&gt;
Soundprop can use info_locationSeparator or info_portalSettings to make sound incur a certain loss when going through the portal it&#039;s touching. The key/value pair is the following:&lt;br /&gt;
&lt;br /&gt;
    sound_loss &amp;quot;Soundprop: Loss in dB incurred when a sound travels through this portal. Cumulative with door loss if a door is present.&amp;quot; &lt;br /&gt;
&lt;br /&gt;
The loss must be a positive number, and negative numbers will automatically be converted to positive.&lt;br /&gt;
&lt;br /&gt;
{{red|Rev 2.00:}}&lt;br /&gt;
&lt;br /&gt;
Prior to Rev 2.00, &#039;&#039;&#039;sound_loss&#039;&#039;&#039; affected the sound propagation to AI &#039;&#039;&#039;only&#039;&#039;&#039;.  Sound propagation to the player was not affected.&lt;br /&gt;
&lt;br /&gt;
Starting with Rev 2.00, &#039;&#039;&#039;sound_loss&#039;&#039;&#039; is also used in determining sound volume to the player. This aligns what AI hear with what the player hears. It also allows sound coming through the door to increase as the door opens, or decrease as the door closes, making for a more realistic experience.&lt;br /&gt;
&lt;br /&gt;
For details study: &lt;br /&gt;
[[Sound Propagation: Part 1]] and&lt;br /&gt;
[[Sound Propagation: Part 2]]&lt;br /&gt;
&lt;br /&gt;
== Trouble-shooting ==&lt;br /&gt;
&lt;br /&gt;
There are two possible problems I can think of: the visportal doesn&#039;t work at all or it works yet there is too much being rendered giving poor performance and frame lag. The latter problem is a matter of experience and experimentation. Often much ingenuity is needed to place visportals to reduce the size of areas being rendered at any one time. There is probably a different solution for every situation. Ultimately you might be forced to change the terrain to help visportalling.&lt;br /&gt;
&lt;br /&gt;
If a visportal doesn&#039;t work at all (eg, does not show as either red or green while you are directly in its area and looking at it and you have &#039;&#039;&#039;r_showPortals&#039;&#039;&#039; enabled) then that means there is a &amp;quot;leak&amp;quot; in that &#039;&#039;area&#039;&#039;.  It does not necessarily mean the visportal itself is the problem.&lt;br /&gt;
&lt;br /&gt;
Try the following to track down the problem.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Check the visportal itself:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* Check which face of the visportal is facing which way. It sometimes happen one clones a visportal and rotates it the wrong way without realizing. So the wrong face is in the right place but the visportal face is not in contact with worldspawn.&lt;br /&gt;
&lt;br /&gt;
* Make sure the visportal hasn&#039;t been assigned to an entity but is worldspawn.&lt;br /&gt;
&lt;br /&gt;
* Search for gaps anywhere around the edges of the visportal face. Check for grid snapping not only of the visportal but the surrounding brushes. A tiny difference might not be visible in the Dark Radiant grid if you are not zoomed in sufficiently.&lt;br /&gt;
&lt;br /&gt;
* Check all surrounding items to see if any are entities. Remember, the visportal &#039;&#039;&#039;face&#039;&#039;&#039; must only be surrounded by worldspawn brushes. It seems to be mostly OK if the visportal &#039;&#039;cuts through&#039;&#039; an entity so long as it meets worldspawn at its edges.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Check the area for internal leaks:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
There is a way to test an individual area for leaks.  It sounds more complicated than it is.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
1.  Filter off all entities.  Make sure visportals are NOT filtered.&lt;br /&gt;
&lt;br /&gt;
2.  Select your entire visible map (which will now be only brushwork).&lt;br /&gt;
&lt;br /&gt;
3.  Copy and paste into a new blank map.&lt;br /&gt;
&lt;br /&gt;
4.  Put the player start into the area where you think you have an internal leak. &lt;br /&gt;
 &lt;br /&gt;
5.  Take the visportals sealing that area and texture them with a solid texture.&lt;br /&gt;
&lt;br /&gt;
6.  Make sure there is only void around the map (if you have your entire map encased in a skybox brush, open a hole in a distant corner of the map).&lt;br /&gt;
&lt;br /&gt;
7.  Save the map as a new filename and run dmap.  If you do not get a leak, then the area with the player start is properly sealed.  Move the player start to a new area and repeat as needed.&lt;br /&gt;
&lt;br /&gt;
8.  If you do get a leak, open the pointfile in DR.  Because the player entity is the only entity in the map, the red line will always start there and will show you where the gap is.&lt;br /&gt;
&lt;br /&gt;
9.  Go back to your original map and fix the gap.  Repeat as needed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Having visportals that line up in parallel with each other can cause problems, usually appearing as pieces of wall that appear black or show skybox.  This can usually be fixed by moving a visportal slightly or turning one on a slight angle so they&#039;re no longer parallel.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;If all else fails, try:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* Clone the visportal and drag one edge to one side, that is, reduce its size to say half.  &lt;br /&gt;
* Select the original and drag its opposite edge the other way so you now have two visportals pressed together and which together fill the gap. Guess which side unless you suspect one side particularly (see later.)&lt;br /&gt;
* Change one of the visportals to any normal visible simple texture, stone, wood, whatever so that now the original gap is smaller and filled by just one smaller visportal. (with hindsight, I think this would probably work anyway and might even be better just leaving it as visportal so you can see which one works but I&#039;ll continue with what I did!)&lt;br /&gt;
* Check it in game.&lt;br /&gt;
* If it still does not work then reduce it further, perhaps by half as much again. In particular, go past edges of surrounding brushes (eg, if working downwards with two brushes on the left then maybe it&#039;s the top brush that is the problem so reduce the top of the visportal below its bottom edge.) Obviously as you reduce the visportal you increase the solid temporary brush you made equally to keep up so there is never a gap.&lt;br /&gt;
* If the visportal still does not work even when reduced to a slither then try the same for all four sides noting that the three sides against the slither of visportal are obviously first suspects.&lt;br /&gt;
* If eventually the visportal starts to work then you know the error is in the other section where you have the solid temporary brush. Use a process of elimination to track down exactly where the error is.&lt;br /&gt;
* You might even have to create a third temporary brush or even a fourth but you must eventually force the visportal to work even if you surround it with four new brushes! Once working, then reduce, remove, gradually until the error re-appears - that must be where the error lies. So by a process of elimination you should track down the source of the problem.&lt;br /&gt;
* The result might make not seem to make sense but at least if you locate the error you can try things to solve the problem. I had a visportal up to the sky and on its left against the top of a triangle of bricks on which rested a roof. The visportal seemed to be perfectly surrounded by worldspawn but I reduced it slightly with just a slim temporary solid test brush only one unit high above it pressing against the top of this triangle. The visportal was now working yet if I removed that slim test brush and raised the visportal to the top again then it would not work. Made no sense to me unless mathematically the very top pixel of the triangle might be regarded as infinitely thin and therefore a gap. So, I left the thin test brush and gave it sky texture so it&#039;s completely invisible and everything works.&lt;br /&gt;
&lt;br /&gt;
(Note: Some mappers at Doom3world reported that cloned visportal brushes can cause problems in a map. This was reported in an earlier Doom 3 build.)&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
There are other good visportal tutorials to be found under:&lt;br /&gt;
http://www.iddevnet.com/doom3/visportals.php and http://www.modwiki.net/wiki/Visportal&lt;br /&gt;
&lt;br /&gt;
== Visportals, Func_statics and Worldspawn Brushes  ==&lt;br /&gt;
Sometimes a visportal (VP) looks just fine in-game, but AI&#039;s behave erratically near them: cannot walk through the portal, walk into walls near the portal, can patrol through the portal but cannot chase the player through the portal. This may be due to worldspawn brushes penetrating the visportal.&lt;br /&gt;
&lt;br /&gt;
Image shows scenarios A-D of different VP placement.&lt;br /&gt;
[[image:visportal_scenarios.png]]&lt;br /&gt;
&lt;br /&gt;
*Scenario A, when VP is snugly placed in the worldspawn corridor, it always works.&lt;br /&gt;
*Scenario B, where a worldspawn brush penetrates the VP has often caused problems. It will fail with very high probability if the worldspawn brush is a monsterclip brush. Never do this scenario!  &#039;&#039;[Springheel -- I&#039;d like more confirmation on this...I&#039;m certain I&#039;ve done this on a regular basis in uneven city streets without causing any obvious problems]&#039;&#039;&lt;br /&gt;
*Scenario C is what could be used if the scene absolutely requires somethings going through the VP and scenario A or D cannot be used. Usually this must be done for big outdoors VP&#039;s as seen in Knightons Manor exterior behind the manor (it is the hedge, which goes through the VP there). Note how the worldspawn brush is cut just at the VP and it is only func_static which penetrates the VP. This has worked without issues. Note that no monsterclipping is required if the func_static segment of the VP penetrating brush is short enough. The blue worldspawn brushes could also be monsterclipped func_statics as well. If so, mapper must be certain monsterclip brushes do not penetrate the VP!&lt;br /&gt;
*Scenario D where the VP is penetrated by func_static detail work, has not been reported to break visportals. Usually this kind of case is used in vaulted corridors etc. Works just fine. If the FS detail work is in reach of AI, special care to monsterclipping should be paid and it must be absolutely sure the monsterclip does not penetrate the VP as this will always cause trouble. In this scenario it is recommended that each side of the visportal have their own func_statics and one func_static brush should never penetrate more than one visportal.&lt;br /&gt;
&lt;br /&gt;
===Conclusion===&lt;br /&gt;
Mappers should favour scenario A when possible. If detailwork requires, scenario D is okay, as well as scenario C. Never, ever use scenario B.&lt;br /&gt;
&lt;br /&gt;
If mapper has some issues with their AI pathfinding, they should check the portal isn&#039;t broken as in scenario B. It is really easy to forget wall trims etc which could pass through the VP. Also typical mistake is to automatically surround a model near the VP with monsterclip, which results monsterclip brush which penetrates the VP. It is recommended that the mapper tests every visportal (which an AI is likely to pass) in their map before the map is released. Firstly the mapper should check in DR and make sure visportals are correctly set. Ingame testing should be done both with non-alerted path_corner patrolling AI&#039;s and with an alerted AI chasing the player.&lt;br /&gt;
&lt;br /&gt;
[[Category:Skybox]]&lt;br /&gt;
[[Category:Visportal]]&lt;br /&gt;
{{tutorial-editing}}&lt;/div&gt;</summary>
		<author><name>Springheel</name></author>
	</entry>
	<entry>
		<id>https://wiki.thedarkmod.com/index.php?title=Visportals&amp;diff=19638</id>
		<title>Visportals</title>
		<link rel="alternate" type="text/html" href="https://wiki.thedarkmod.com/index.php?title=Visportals&amp;diff=19638"/>
		<updated>2017-08-23T19:52:40Z</updated>

		<summary type="html">&lt;p&gt;Springheel: /* What are visportals? */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;written by Fidcal. Visportals, Func_statics and Worldspawn Brushes added by Sotha.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== What are visportals? ==&lt;br /&gt;
Visportals are a very important part of mapping.  They are a kind of brush that helps separate your map into individual areas (called visleafs), which is important for both rendering and sound propagation.&lt;br /&gt;
&lt;br /&gt;
Without visportals, the Doom engine would render the entire map even if the player can only see one small area. This would reduce performance and slow the game down.  &lt;br /&gt;
&lt;br /&gt;
Visportals are also very important for sound propagation. Without them, sounds can travel through brushwork and reach areas of the map that they shouldn&#039;t (see &#039;&#039;Sound Propagation&#039;&#039; at the bottom of the page).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;iframe width=&amp;quot;560&amp;quot; height=&amp;quot;315&amp;quot; src=&amp;quot;https://www.youtube.com/embed/RmKjmt7IJr8&amp;quot; frameborder=&amp;quot;0&amp;quot; allowfullscreen&amp;gt;&amp;lt;/iframe&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Visportals determine how far the engine should render from the player&#039;s position. When a visportal is in the player&#039;s view, the engine tests to see if there is a second visportal viewable from the position of the first. If yes then it tests to see if a third one can be seen from the second one. If the third is not viewable from the first then the engine won&#039;t waste time rendering the map beyond it. If it is, then the engine tests for a fourth one and so on. So for example, with a long corridor with lots of 90 degree turns in it and visportals at every bend then the engine will only render the section you are in plus any parts of the next section you can see. But as you get near to it and can see further down it to the next bend&#039;s visportal then it will render the next one too.&lt;br /&gt;
&lt;br /&gt;
Anything in the visleaf that the player is currently in is rendered (if it is your field of view) regardless of whether it is behind worldspawn.  But things in an adjacent visleaf will not be rendered if they are behind worldspawn.  The engine still has to calculate what the player can see and what he can&#039;t, and this still uses resources, but far less than if it were in the same visleaf as the player.  Any visleaf that is behind a closed portal is automatically beyond what the player can see, to the engine can skip testing it completely.  This is why closed visportals are so valuable for performance.&lt;br /&gt;
&lt;br /&gt;
The console command &#039;&#039;&#039;r_showPortals 1&#039;&#039;&#039; shows processed visportals as wireframe in-game for testing - even right through walls they are visible. A green wireframe is an &#039;open&#039; visportal and renders everything beyond it up to the next visportal.  A red wireframe is a &#039;closed&#039; visportal with nothing rendered beyond it and no further visportals beyond that are even processed so are not visible at all. If a visportal does not show then it is either beyond range of processing or it is not working so check it is set up correctly.&lt;br /&gt;
&lt;br /&gt;
== What is rendering? ==&lt;br /&gt;
Rendering might be regarded as the calculating of surface lighting, colour, texture, etc. Not all rendered surfaces are visible in-game but still have to be calculated. Others do not need rendering at all. Processing only takes place in the current portal area, that is, up to the nearest closed visportals. Surfaces are treated as divided into triangles for rendering purposes. The &#039;&#039;&#039;r_showTris&#039;&#039;&#039; console command shows those triangles as wireframes. In the console use &#039;&#039;&#039;r_showTris N&#039;&#039;&#039; where N is...&lt;br /&gt;
&lt;br /&gt;
*0 - Off - normal gameplay with no wireframes shown.&lt;br /&gt;
*1 - Shows only triangles that are visible in-game (not hidden behind other surfaces.) These visible surfaces are only part of what is rendered.&lt;br /&gt;
*2 - Shows as wireframes, all triangle surfaces that would be rendered in-game. This includes those hidden behind other surfaces BUT ONLY IF they face the player, even slightly. Surfaces facing away from the player are never rendered.&lt;br /&gt;
*3 - Shows as wireframes, all triangle surfaces even if not rendered.&lt;br /&gt;
&lt;br /&gt;
You can see that for the purpose of testing performance use 2 above which shows all that would be rendered (whether visible to the player or not.) You can use 3 to see &#039;&#039;all&#039;&#039; triangles up to the next closed visportal but remember not all of it will be rendered so will not affect performance.&lt;br /&gt;
&lt;br /&gt;
You might also use &#039;&#039;&#039;r_useScissor 0&#039;&#039;&#039; to show geometry outside the visportal wireframe that Doom still sends to the video card but tells it not to render. &#039;&#039;&#039;r_useScissor 1&#039;&#039;&#039; helps performance but even sending the geometry uses processor time so if you can reduce it by adjusting visportal placement so much the better.&lt;br /&gt;
&lt;br /&gt;
(Remember to return to &#039;&#039;&#039;r_useScissor 1&#039;&#039;&#039; when you are done with visportal testing.)&lt;br /&gt;
&lt;br /&gt;
Here is a short video with a decent visual breakdown:&lt;br /&gt;
&lt;br /&gt;
[http://www.gdcvault.com/play/1014234/Excerpt-Quake-Postmortem-Optimizing-Level Video]&lt;br /&gt;
&lt;br /&gt;
Another video:&lt;br /&gt;
&lt;br /&gt;
[http://youtu.be/cy4FIE7BhCQ http://img.youtube.com/vi/cy4FIE7BhCQ/1.jpg]&lt;br /&gt;
&lt;br /&gt;
== How and where to create visportals ==&lt;br /&gt;
&lt;br /&gt;
Visportals are just brushes with one face covered in visportal texture. That is the operative face. Only be concerned with that one surface as the rest of the brush merely carries it. So to create one you just....&lt;br /&gt;
&lt;br /&gt;
* Make a thin brush like a wall. Ideally make it rectangular for best sound propagation (see &#039;&#039;Sound Propagation&#039;&#039; later.) It can extend beyond the gap so does not necessarily need to be the same shape - see &#039;&#039;Where to place your Visportal&#039;&#039; later.&lt;br /&gt;
* Give it &#039;&#039;&#039;textures &amp;gt; editor &amp;gt; visportal&#039;&#039;&#039; to either of the main surfaces facing towards or away from you. It does not matter which except you need to be aware which it is because the visportal will be effective at that one face. (Use {{Ctrl}} + {{Shift}} + {{LMB}} on the face in the Dark Radiant camera view to select one face.)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Thickness ===&lt;br /&gt;
The exact thickness is not important to its effectiveness as it will only be effective from its one visportal-textured face anyway but it makes sense to keep it reasonably thin so you can see it clearly in the editor. Always think of visportals as one flat face and the rest of the brush can be ignored for functional purposes.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Where to place your Visportal ===&lt;br /&gt;
It will eventually be wedged tight like a plug into gaps, doorways, etc. between areas. The edges of the visportal-textured face of visportals should be completely sealed by or in solid &#039;&#039;worldspawn&#039;&#039; brush that has no gaps. The brush &#039;&#039;&#039;must&#039;&#039;&#039; be a child of worldspawn and &#039;&#039;&#039;not&#039;&#039;&#039; an entity. This is true even if the visportal is within a door (see next section.) For the visportal to be effective it does not matter if the rest of the visportal brush sticks out into space so long as the edges of the visportal-textured face are surrounded by worldspawn brush and/or another visportal brush (see later) In practice you will probably put most fully within a corridor or doorway, a city street (yes, the sky above is solid worldspawn brush), etc. Irregular shaped gaps must still be plugged with a rectangular visportal which should then overlap into the solid worldspawn and leave no gaps. This will also make sound propagation work correctly (see &#039;&#039;Sound Propagation&#039;&#039; later.)&lt;br /&gt;
&lt;br /&gt;
Each area you thus created must be totally enclosed with worldspawn brushes with no gaps of either space else an entity. So a closed building with visportals at the doors but a tiny gap under the eaves of the roof won&#039;t work! Also avoid only blocking gaps with entities whether brushes or models. For example, a two-sided window entity that completely fills the opening will not seal the area for portalling purposes. Do not put in a visportal unless the window is either transparent or can be opened (like a door.) Instead put in a worldspawn brush with nodraw texture on it so it will not be visible or collidable just in front of the window. Or if you are using two windows back to back (say a lit one outside and an unlit one inside then a thin caulk brush between them.&lt;br /&gt;
&lt;br /&gt;
Generally you will place visportals on bends in the terrain around which the player cannot see from the current viewpoint. Avoid placing visportals in a line along a corridor or street for example. Since the player can see straight down through them all then they serve no purpose as they will all be open and visportals themselves create extra triangles and complexity (see downside section below.)&lt;br /&gt;
&lt;br /&gt;
With a large building surrounded by a walled open area then try visportals at each corner. If it is a very large building then also add visportals midway along each side. The player standing at one corner might be able to see up two sides, part of a far side, and even a small part of the fourth side so all sides would be rendered. By having extra visportals middway along each side then at least half of each side of the furthest corner need not be rendered (consider also preventing the player reaching such a viewpoint with an obstruction!)&lt;br /&gt;
&lt;br /&gt;
Subject to the above, try to find the smallest gaps where possible to place visportals. The smaller the visportal then the smaller the view aperture and so the less chance of lining up those apertures. Remember, visportals beyond the first one do not open unless they intersect all open visportals in that line of view. Even without a door, an open doorway is a better place for a visportal than a wider corridor or room beyond. Imagine trying to get a straight pole through as many of these visportal apertures as possible; the narrower and less aligned they are then the harder to get the pole very far.&lt;br /&gt;
&lt;br /&gt;
Don&#039;t get too hung up on perfect placement of every last visportal. Generally if you follow this guide and use your judgement you achieve a satisfactory game performance. Examine some large maps that you know work well to get some ideas where visportals are placed using the &#039;&#039;&#039;r_showPortals 1&#039;&#039;&#039; command.&lt;br /&gt;
&lt;br /&gt;
What if you put visportal texture on both main faces of the visportal brush? Only one will be effective. If the visportal brush juts out into space then visportal texture at that end will not work but the one at the other end will be the operative one. If you rotated the brush then it still works and uses whichever one is surrounded by solid. If both are in space it does not work at all. If both are surrounded by solid then only one works. Which one? Hard to tell. It seems to be determined by the local geometry. It is interesting to note that when you use r_showTris 3 to see what is rendered then the triangles are confined to either side of the visportal face. In other words, a long corridor wall rendered as two large triangles would now be split into four triangles. So a visportal might be considered to help with multiple lighting performance as you do not need to visually change the terrain with trim etc.&lt;br /&gt;
&lt;br /&gt;
What if you put visportal texture on all the surfaces of the brush? Only one is effective (must be surrounded by solid brush.) To be certain of optimum performance use nodraw on all surfaces except the one face with visportal texture.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Multiple Joined Visportals===&lt;br /&gt;
Because visportals are a single face, by their very nature they can only be placed on a single brush. But visportal brushes can be placed or merged together to fill more complex shaped gaps. For example, a wide rectangle might have one side clipped to slope over a roof while the rectangular part of its shape sits on top of another rectangle across the street below. But complexity affects performance so only do this if one rectangular visportal intruding into interior walls might do the same job. Remember, it does not matter if the visportal overlaps into solid so if there is an interior wall on the same plane (or indeed if the building is totally solid) then the visportal can penetrate it and still function. Do not use multiple visportals just to shape nicely around solid building trim and structure but intrude into it so long as the edge does not exit into space at any point it will be fine.&lt;br /&gt;
&lt;br /&gt;
== Visportals and doors ==&lt;br /&gt;
A visportal in contact with a door that has an openable property is automatically closed when the door is closed and automatically becomes conventionally operative when the door opens. By &#039;operative&#039; I mean it is then like a normal visportal and will be open or closed depending on the player&#039;s view. So when you first go through a door and leave it open then its visportal will be open as you look immediately back at it. But as you then proceed further through other visportals, the door visportal will eventually close (prevent rendering through it) even if the door itself is left open.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Doors standing in front of but not within a doorway ===&lt;br /&gt;
Note that the visportal only needs to be in contact with the door to be affected by it. Normally you would place the visportal within the door but it actually only needs its visportal-textured surface to touch it. This means that if you have a door that is stood in front of an opening in a wall then you cannot put the visportal inside the door because it will not be surrounded by solid brush. But you can put a visportal just inside the opening and flush with the mouth of the opening and the door immediately in front of that and in contact with the visportal. You can test this by placing the door offset well to one side but part of it still in contact with the visportal. In game you can see the opening as the door is only partially covering it. When the door is closed the visportal closes and stops rendering through the doorway. You will see this as a black panel in the doorway. As the door opens the black panel disappears and you can see through the doorway again. You might think that from the other side the black panel would obscure the door when closed but it doesn&#039;t. With the door centred in its normal position, typically you might have an entity frame around the door. If you had a solid brush frame without gaps then the visportal could be inside the door if you wanted as it would then have solid all round its edges. In many cases of course, the door frame, whether entity or brush, would be within the solid brush doorway anyway.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Windows, Doors with windows, bars, etc. ===&lt;br /&gt;
Openable doors that let you see through them such as windows, doors with windows, barred gates, etc. should not be in contact with a visportal. When the door is closed it will automatically close any visportal whose effective surface is in touch with it. The visportal will not then permit any rendering through it and will show as a black panel in the window or between the bars of a gate. Instead, move the visportal away from the door. It will still function effectively as a normal visportal just as if the door were not there. This does not of course apply to simulated windows such as a glazed textured panel on a door texture where you cannot actually see through.&lt;br /&gt;
&lt;br /&gt;
All doors and windows that do not have an openable property can have a visportal in touch with them as it will not be affected by them and it will just function as a normal visportal.&lt;br /&gt;
&lt;br /&gt;
{{red|Rev. 2.00:}}&lt;br /&gt;
&lt;br /&gt;
Starting with Rev. 2.00, you can touch a see-through door or window with a visportal, and the portal will not close when the door/window is closed, as long as you use the following spawnarg &#039;&#039;&#039;on the door/window&#039;&#039;&#039; (not the info_portalsettings entity):&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;transparent&#039;&#039;&#039; &amp;quot;If set to 1 (0 by default), a see-through door can touch a visportal and the visportal won&#039;t close when the door is closed.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
This is useful when you want the opening or closing of the door to affect the sound loss across the portal, but not affect visibility through the door/window. Imagine a closed window that muffles a sound beyond it, and as the window opens, the sound gets louder.&lt;br /&gt;
&lt;br /&gt;
==Visportal switches: func_portals==&lt;br /&gt;
&lt;br /&gt;
The preceding section &#039;&#039;Visportals and doors&#039;&#039; makes clear that doors can function like switches to enable and close visportals in contact with them. &#039;&#039;func_portals&#039;&#039; can be used to enact further control over portals. You can place a &#039;&#039;func_portal&#039;&#039; entity so that it intersects with a visportal, and then trigger the func_portal to close or open the visportal.  A second control method is had by using the &#039;&#039;portal_dist&#039;&#039; and &#039;&#039;distcheck_period&#039;&#039; properties on the &#039;&#039;func_portal&#039;&#039;.  They control the distance to the player and how frequently (in seconds) this distance should be checked, respectively, and make explicit triggering of the &#039;&#039;func_portal&#039;&#039; unnecessary.  As with doors, even if enabled, the visportal will not be open even if it is in the player&#039;s view.  Note, if you have a mover (door/window) in contact with the visportal, it will affect it as well, so typically a visportal controlled by func_portal is placed away from the mover, or use spawnarg &amp;quot;transparent&amp;quot; set to 1.&lt;br /&gt;
&lt;br /&gt;
Another clever trick exists with regard to &#039;&#039;func_portal&#039;&#039;s:  you can also build a func_static over the visportal, and target it with the &#039;&#039;func_portal&#039;&#039; as normal.  Now, in addition to opening and closing the portal, this will also toggle the drawing of the &#039;&#039;func_static&#039;&#039;.  This means you could place an appropriate texture (perhaps a low resolution image of a room&#039;s interior, drawn over a window) and have it turn on or off based on the player&#039;s distance away.  From a distance, the player wouldn&#039;t be able to tell that the the entire room wasn&#039;t being rendered.  This can be an effective way to create the illusion of long view distances.&lt;br /&gt;
&lt;br /&gt;
Note that the func_static must touch the visportal in order to work.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;One way to make this work is to create a patch, make it a func_static.  Texture the patch, and then target the func_portal at that func_static.  You must then add &amp;quot;hide&amp;quot; &amp;quot;1&amp;quot; to the func_static patch.  There may be other ways to make this work, but I had a lot of trouble until I took these steps.  -- Springheel&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
An interesting, recent discovery that needs some testing is that apparently:  you can take one visportal and cut it in half, and then put different func_portals on each half in order to close them at different ranges.  That has interesting implications for wide city streets.  They require big visportals, but if you can split them up and independently control each part, there may be some benefits there.  http://forums.thedarkmod.com/topic/9082-newbie-darkradiant-questions/?p=370473&lt;br /&gt;
&lt;br /&gt;
== Need I design, even compromise my map to make best use of visportals? ==&lt;br /&gt;
You need to design your map from the start as a series of connected boxes (brushes) with the player&#039;s view, sound propogation, and visportals in mind. And yes, sometimes you might need to add a bend you don&#039;t want or obstruct a view in some way so you can put in another visportal if you are having or expecting slow down in a large and/or complex area. This is a matter of experience. If you have large complex areas and are experiencing frame lag but can see no obvious place to put a visportal then you might need to compromise your terrain and add some solid brush barriers to block certain views with visportals in the access round or through them.&lt;br /&gt;
&lt;br /&gt;
Note that it is not essential that visportals be only at the actual joins between brushes; they still work even if they are half way down a corridor so long as they are wedged in tight without gaps. But you will mostly place them at joins.&lt;br /&gt;
&lt;br /&gt;
For rendering considerations, the player&#039;s view is everything and every room and street in front of you even if there are walls, etc. in the way. Imagine what you would see with X-Ray vision. What is behind you or just out of range of the screen does not matter. But visportals restrict the view to what can be seen through the aperture of the visportal.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
It is not necessary to put visportals at every tiny bend in the map; in fact that should be avoided in smaller areas because visportals themselves create extra triangles and complexity (see downside section below.) Try to keep in mind what will be rendered through the visportals and judge what would &#039;&#039;not&#039;&#039; cause frame lag slowdown if the player could actually see that view. Three or four bends without visportals in a restricted air duct is not going to cause any problem if the duct is correctly visportalled at the ends for example.&lt;br /&gt;
&lt;br /&gt;
== Is there a downside? ==&lt;br /&gt;
One downside to visportals is that is extra work for the mapper! Another is that they split the geometry and create extra triangles and batches. This will not normally cause a problem unless your map has a very large number of areas. The advantages in performance of using visportals far outweigh the downsides!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Sound Propagation==&lt;br /&gt;
&lt;br /&gt;
Correct propagation of sound (both to AI and to the player) relies on visportals.&lt;br /&gt;
&lt;br /&gt;
Think of vis-portals as sealing off separate &amp;quot;areas&amp;quot; in a map.  A sound that occurs inside a sealed &amp;quot;area&amp;quot; will travel in a straight line to anyone inside the same area, even through walls.  If you are not in the same area, however, the sound will travel in a straight line to the first visportal between you and the sound source, then to the next one, etc, until it reaches the area you are in.&lt;br /&gt;
&lt;br /&gt;
If the sound happens in an area that is not sealed, it essentially considers the whole map its &amp;quot;area&amp;quot;, and will go straight to the player, through walls, floors, or other brushwork.  This can result in confusion for players, as they will hear AI on the other side of a massive wall as if they were standing beside each other.&lt;br /&gt;
&lt;br /&gt;
In the following examples, &amp;quot;P&amp;quot; is the player and &amp;quot;S&amp;quot; is the sound source.  The Visportals are red lines. The green lines show how the sound would travel.&lt;br /&gt;
&lt;br /&gt;
[[image:vis.jpg]]&lt;br /&gt;
&lt;br /&gt;
Without any visportals, the sound goes in a straight line to the player, even through solid walls.  It will sound like the player is in the same room as the sound.&lt;br /&gt;
&lt;br /&gt;
One visportal is an improvement--it will sound further away, but the sound travels straight to the visportal and then straight to the player, so it will still sound like it is coming through the wall.  &lt;br /&gt;
&lt;br /&gt;
Two visportals are best in this case, however.  The sound will seem like it is coming from the opening to the room, which is where you would expect it to come from.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Sound &#039;&#039;going to the AI&#039;&#039; travels the shortest distance through a visportal, passing at any point on the visportal surface.  Mappers should always use rectangular visportals unless you have no choice with an awkwardly shaped gap or if the gap is out of range of AI, for example along a sloping roof where AI never go. &#039;&#039;&#039;It also still assumes that when you do have four sides, they are perpendicular.&#039;&#039;&#039; If you have some non-90 degree angles between the sides, some wierdness may ensue. For example, an AI that is alerted in the dark (or facing away) by hearing a sound from the player that passes through an irregular visportal might run to the center of the visportal rather than directly to where the player made the noise. Irregular visportals large enough to make this effect noticeable are likely to be uncommon.&lt;br /&gt;
&lt;br /&gt;
This will be okay for smaller irregular visportals, but the error (path difference from the minimal path) will get more noticeable the larger the visportal.&lt;br /&gt;
&lt;br /&gt;
Visportals function individually even if joined together into complex shapes. So a rectangle at ground level topped by an angled visportal above it tilting out over a roof will be treated separately, not as one aperture. &lt;br /&gt;
&lt;br /&gt;
The bottom line is, with any non-rectangular visportals keep the above in mind and if in doubt then consider early testing of AI&#039;s alert to player sound.&lt;br /&gt;
&lt;br /&gt;
Visportals do NOT need to be closed to correctly channel sound to the player.  Sometimes it is worth adding visportals even if they will not help with rendering (because they will always be open) in order to make sound travel the way it should.  &lt;br /&gt;
&lt;br /&gt;
To make less sound go through a visportal (through a small hole, for example):&lt;br /&gt;
Soundprop can use info_locationSeparator or info_portalSettings to make sound incur a certain loss when going through the portal it&#039;s touching. The key/value pair is the following:&lt;br /&gt;
&lt;br /&gt;
    sound_loss &amp;quot;Soundprop: Loss in dB incurred when a sound travels through this portal. Cumulative with door loss if a door is present.&amp;quot; &lt;br /&gt;
&lt;br /&gt;
The loss must be a positive number, and negative numbers will automatically be converted to positive.&lt;br /&gt;
&lt;br /&gt;
{{red|Rev 2.00:}}&lt;br /&gt;
&lt;br /&gt;
Prior to Rev 2.00, &#039;&#039;&#039;sound_loss&#039;&#039;&#039; affected the sound propagation to AI &#039;&#039;&#039;only&#039;&#039;&#039;.  Sound propagation to the player was not affected.&lt;br /&gt;
&lt;br /&gt;
Starting with Rev 2.00, &#039;&#039;&#039;sound_loss&#039;&#039;&#039; is also used in determining sound volume to the player. This aligns what AI hear with what the player hears. It also allows sound coming through the door to increase as the door opens, or decrease as the door closes, making for a more realistic experience.&lt;br /&gt;
&lt;br /&gt;
For details study: &lt;br /&gt;
[[Sound Propagation: Part 1]] and&lt;br /&gt;
[[Sound Propagation: Part 2]]&lt;br /&gt;
&lt;br /&gt;
== Trouble-shooting ==&lt;br /&gt;
&lt;br /&gt;
There are two possible problems I can think of: the visportal doesn&#039;t work at all or it works yet there is too much being rendered giving poor performance and frame lag. The latter problem is a matter of experience and experimentation. Often much ingenuity is needed to place visportals to reduce the size of areas being rendered at any one time. There is probably a different solution for every situation. Ultimately you might be forced to change the terrain to help visportalling.&lt;br /&gt;
&lt;br /&gt;
If a visportal doesn&#039;t work at all (eg, does not show as either red or green while you are directly in its area and looking at it and you have &#039;&#039;&#039;r_showPortals&#039;&#039;&#039; enabled) then that means there is a &amp;quot;leak&amp;quot; in that &#039;&#039;area&#039;&#039;.  It does not necessarily mean the visportal itself is the problem.&lt;br /&gt;
&lt;br /&gt;
Try the following to track down the problem.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Check the visportal itself:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* Check which face of the visportal is facing which way. It sometimes happen one clones a visportal and rotates it the wrong way without realizing. So the wrong face is in the right place but the visportal face is not in contact with worldspawn.&lt;br /&gt;
&lt;br /&gt;
* Make sure the visportal hasn&#039;t been assigned to an entity but is worldspawn.&lt;br /&gt;
&lt;br /&gt;
* Search for gaps anywhere around the edges of the visportal face. Check for grid snapping not only of the visportal but the surrounding brushes. A tiny difference might not be visible in the Dark Radiant grid if you are not zoomed in sufficiently.&lt;br /&gt;
&lt;br /&gt;
* Check all surrounding items to see if any are entities. Remember, the visportal &#039;&#039;&#039;face&#039;&#039;&#039; must only be surrounded by worldspawn brushes. It seems to be mostly OK if the visportal &#039;&#039;cuts through&#039;&#039; an entity so long as it meets worldspawn at its edges.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Check the area for internal leaks:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
There is a way to test an individual area for leaks.  It sounds more complicated than it is.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
1.  Filter off all entities.  Make sure visportals are NOT filtered.&lt;br /&gt;
&lt;br /&gt;
2.  Select your entire visible map (which will now be only brushwork).&lt;br /&gt;
&lt;br /&gt;
3.  Copy and paste into a new blank map.&lt;br /&gt;
&lt;br /&gt;
4.  Put the player start into the area where you think you have an internal leak. &lt;br /&gt;
 &lt;br /&gt;
5.  Take the visportals sealing that area and texture them with a solid texture.&lt;br /&gt;
&lt;br /&gt;
6.  Make sure there is only void around the map (if you have your entire map encased in a skybox brush, open a hole in a distant corner of the map).&lt;br /&gt;
&lt;br /&gt;
7.  Save the map as a new filename and run dmap.  If you do not get a leak, then the area with the player start is properly sealed.  Move the player start to a new area and repeat as needed.&lt;br /&gt;
&lt;br /&gt;
8.  If you do get a leak, open the pointfile in DR.  Because the player entity is the only entity in the map, the red line will always start there and will show you where the gap is.&lt;br /&gt;
&lt;br /&gt;
9.  Go back to your original map and fix the gap.  Repeat as needed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Having visportals that line up in parallel with each other can cause problems, usually appearing as pieces of wall that appear black or show skybox.  This can usually be fixed by moving a visportal slightly or turning one on a slight angle so they&#039;re no longer parallel.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;If all else fails, try:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* Clone the visportal and drag one edge to one side, that is, reduce its size to say half.  &lt;br /&gt;
* Select the original and drag its opposite edge the other way so you now have two visportals pressed together and which together fill the gap. Guess which side unless you suspect one side particularly (see later.)&lt;br /&gt;
* Change one of the visportals to any normal visible simple texture, stone, wood, whatever so that now the original gap is smaller and filled by just one smaller visportal. (with hindsight, I think this would probably work anyway and might even be better just leaving it as visportal so you can see which one works but I&#039;ll continue with what I did!)&lt;br /&gt;
* Check it in game.&lt;br /&gt;
* If it still does not work then reduce it further, perhaps by half as much again. In particular, go past edges of surrounding brushes (eg, if working downwards with two brushes on the left then maybe it&#039;s the top brush that is the problem so reduce the top of the visportal below its bottom edge.) Obviously as you reduce the visportal you increase the solid temporary brush you made equally to keep up so there is never a gap.&lt;br /&gt;
* If the visportal still does not work even when reduced to a slither then try the same for all four sides noting that the three sides against the slither of visportal are obviously first suspects.&lt;br /&gt;
* If eventually the visportal starts to work then you know the error is in the other section where you have the solid temporary brush. Use a process of elimination to track down exactly where the error is.&lt;br /&gt;
* You might even have to create a third temporary brush or even a fourth but you must eventually force the visportal to work even if you surround it with four new brushes! Once working, then reduce, remove, gradually until the error re-appears - that must be where the error lies. So by a process of elimination you should track down the source of the problem.&lt;br /&gt;
* The result might make not seem to make sense but at least if you locate the error you can try things to solve the problem. I had a visportal up to the sky and on its left against the top of a triangle of bricks on which rested a roof. The visportal seemed to be perfectly surrounded by worldspawn but I reduced it slightly with just a slim temporary solid test brush only one unit high above it pressing against the top of this triangle. The visportal was now working yet if I removed that slim test brush and raised the visportal to the top again then it would not work. Made no sense to me unless mathematically the very top pixel of the triangle might be regarded as infinitely thin and therefore a gap. So, I left the thin test brush and gave it sky texture so it&#039;s completely invisible and everything works.&lt;br /&gt;
&lt;br /&gt;
(Note: Some mappers at Doom3world reported that cloned visportal brushes can cause problems in a map. This was reported in an earlier Doom 3 build.)&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
There are other good visportal tutorials to be found under:&lt;br /&gt;
http://www.iddevnet.com/doom3/visportals.php and http://www.modwiki.net/wiki/Visportal&lt;br /&gt;
&lt;br /&gt;
== Visportals, Func_statics and Worldspawn Brushes  ==&lt;br /&gt;
Sometimes a visportal (VP) looks just fine in-game, but AI&#039;s behave erratically near them: cannot walk through the portal, walk into walls near the portal, can patrol through the portal but cannot chase the player through the portal. This may be due to worldspawn brushes penetrating the visportal.&lt;br /&gt;
&lt;br /&gt;
Image shows scenarios A-D of different VP placement.&lt;br /&gt;
[[image:visportal_scenarios.png]]&lt;br /&gt;
&lt;br /&gt;
*Scenario A, when VP is snugly placed in the worldspawn corridor, it always works.&lt;br /&gt;
*Scenario B, where a worldspawn brush penetrates the VP has often caused problems. It will fail with very high probability if the worldspawn brush is a monsterclip brush. Never do this scenario!  &#039;&#039;[Springheel -- I&#039;d like more confirmation on this...I&#039;m certain I&#039;ve done this on a regular basis in uneven city streets without causing any obvious problems]&#039;&#039;&lt;br /&gt;
*Scenario C is what could be used if the scene absolutely requires somethings going through the VP and scenario A or D cannot be used. Usually this must be done for big outdoors VP&#039;s as seen in Knightons Manor exterior behind the manor (it is the hedge, which goes through the VP there). Note how the worldspawn brush is cut just at the VP and it is only func_static which penetrates the VP. This has worked without issues. Note that no monsterclipping is required if the func_static segment of the VP penetrating brush is short enough. The blue worldspawn brushes could also be monsterclipped func_statics as well. If so, mapper must be certain monsterclip brushes do not penetrate the VP!&lt;br /&gt;
*Scenario D where the VP is penetrated by func_static detail work, has not been reported to break visportals. Usually this kind of case is used in vaulted corridors etc. Works just fine. If the FS detail work is in reach of AI, special care to monsterclipping should be paid and it must be absolutely sure the monsterclip does not penetrate the VP as this will always cause trouble. In this scenario it is recommended that each side of the visportal have their own func_statics and one func_static brush should never penetrate more than one visportal.&lt;br /&gt;
&lt;br /&gt;
===Conclusion===&lt;br /&gt;
Mappers should favour scenario A when possible. If detailwork requires, scenario D is okay, as well as scenario C. Never, ever use scenario B.&lt;br /&gt;
&lt;br /&gt;
If mapper has some issues with their AI pathfinding, they should check the portal isn&#039;t broken as in scenario B. It is really easy to forget wall trims etc which could pass through the VP. Also typical mistake is to automatically surround a model near the VP with monsterclip, which results monsterclip brush which penetrates the VP. It is recommended that the mapper tests every visportal (which an AI is likely to pass) in their map before the map is released. Firstly the mapper should check in DR and make sure visportals are correctly set. Ingame testing should be done both with non-alerted path_corner patrolling AI&#039;s and with an alerted AI chasing the player.&lt;br /&gt;
&lt;br /&gt;
[[Category:Skybox]]&lt;br /&gt;
[[Category:Visportal]]&lt;br /&gt;
{{tutorial-editing}}&lt;/div&gt;</summary>
		<author><name>Springheel</name></author>
	</entry>
	<entry>
		<id>https://wiki.thedarkmod.com/index.php?title=Path_Nodes&amp;diff=19637</id>
		<title>Path Nodes</title>
		<link rel="alternate" type="text/html" href="https://wiki.thedarkmod.com/index.php?title=Path_Nodes&amp;diff=19637"/>
		<updated>2017-08-22T14:56:56Z</updated>

		<summary type="html">&lt;p&gt;Springheel: /* path_turn */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;originally written by Springheel&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
For more information on pathfinding, see [[Pathfinding]].  For more general info on getting your AI to patrol, see [[AI Patrol]].&lt;br /&gt;
&lt;br /&gt;
= What are Path Nodes? =&lt;br /&gt;
&lt;br /&gt;
Path entities (or path nodes) are the things that you use to make your AI move (patrol) around the map. Placing path nodes can take a little getting used to; hopefully this article will help (I&#039;m far from an expert, but here&#039;s what I&#039;ve discovered so far).&lt;br /&gt;
&lt;br /&gt;
There are lots of different kinds of path nodes.  It can sometimes help to think of them as &amp;quot;travel nodes&amp;quot; (nodes that AI will travel to) and &amp;quot;behaviour nodes&amp;quot; (nodes that tell AI how to behave at a certain point).  &lt;br /&gt;
&lt;br /&gt;
Although path nodes have a directional arrow in the editor, it has no impact on most nodes.  Rotating the node does add a corresponding &amp;quot;angle&amp;quot; property to the entity (matching the direction of the arrow).  Certain nodes (path_anim, path_wait, and path_turn, for example) are affected by the &amp;quot;angle&amp;quot; property, but most will ignore it.&lt;br /&gt;
&lt;br /&gt;
= How to use Path Nodes =&lt;br /&gt;
&lt;br /&gt;
Path nodes are placed like any other entity (RMB and select &amp;quot;add entity&amp;quot;, then scroll to &amp;quot;paths&amp;quot;).  They show up as a coloured box with an arrow in the editor (colour varies depending on config.)&lt;br /&gt;
&lt;br /&gt;
Path nodes are useless if they are not linked to another entity (either an AI or another node).  In order to link them, you use the &amp;quot;target&amp;quot; property.  This tells the AI what path node they should go to (or act on) next.  If you type &amp;quot;target&amp;quot; &amp;quot;path_corner_1&amp;quot; in your AI property list, then your AI will walk to &amp;quot;path_corner_1&amp;quot; when the map starts.  Without a &amp;quot;target&amp;quot; property, your AI will not go anywhere.  Once you add a &amp;quot;target&amp;quot; property to either your AI or another node, you should see a colored line connecting the two entities.&lt;br /&gt;
&lt;br /&gt;
Behaviour nodes activate behaviour in order.  In other words, if you want an AI to reach a path_corner, then turn to face a direction, then wait for a time, then play an animation, you need to link the nodes in that order.  &lt;br /&gt;
&lt;br /&gt;
 path_corner ---&amp;gt; path_turn ----&amp;gt; path_wait ----&amp;gt; path_cycleanim -----&amp;gt; next path_corner&lt;br /&gt;
&lt;br /&gt;
== Variation and Randomness ==&lt;br /&gt;
&lt;br /&gt;
It is also possible to target multiple nodes (using &amp;quot;target1&amp;quot;, &amp;quot;target2&amp;quot; etc. spawn args). In this case, the AI will choose one of these nodes with equal probability. &lt;br /&gt;
If the &#039;&#039;&#039;&amp;quot;chance&amp;quot;&#039;&#039;&#039; spawn arg (between 0 and 1) is set on a node, it defines the probability for the AI to choose this path node next when multiple path nodes are targetted.  The chances at any point must not add to greater than 1, or it won&#039;t work properly.  For example, if a path_corner targets two different nodes, you could set &amp;quot;chance&amp;quot; &amp;quot;.75&amp;quot; on one and &amp;quot;chance&amp;quot; &amp;quot;.25&amp;quot; on the other.  This will result in AI choosing the first path 3/4 of the time.&lt;br /&gt;
&lt;br /&gt;
There are now two new spawnargs, &#039;&#039;&#039;&amp;quot;alert_idle_only&amp;quot;&#039;&#039;&#039; and &#039;&#039;&#039;&amp;quot;idle_only&amp;quot;&#039;&#039;&#039; that can be set on path nodes. The nodes are then only chosen when the AI is in that state.  For example, if you set a path_corner as &amp;quot;idle_only&amp;quot;, then the AI will no longer go to that path node when it has been alerted.  This allows the mapper to set a complete set of alternate patrols and actions for AI who have been alerted (like sending them to guard important areas).  (for info on how to use Objectives to alter paths, see [[Objectives#Using_Objectives_Creatively]])&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Note that if an AI reaches a node that targets pathnodes that are unavailable (because they are idle_only, and the AI is alert, for example), the AI will stop and no longer proceed.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Nodes that make the AI walk to a specified location (currently the only one that does this is the path_corner) can have an &#039;&#039;&#039;&amp;quot;move_to_position_tolerance&amp;quot;&#039;&#039;&#039; spawn arg, which defines how close the AI has to be to the destination point to determine the position as reached. Normally, the AI considers the position reached as soon as it is inside its bounding box (most of our humanoid AI are using aas32, so the point would need to be within 16 units from the AI&#039;s origin). This is not always accurate enough, for example when a path_corner is placed in front of a chair where the AI is supposed to sit down, making the AI place half of their back next to the chair.  Smaller numbers mean the AI must get closer, larger numbers are more forgiving.&lt;br /&gt;
&lt;br /&gt;
[Fidcal: I believe the accuracy spawnarg is replaced by the move_to_position_tolerance above. The following likely applies to the new spawnarg anyway.]&lt;br /&gt;
Setting the accuracy spawn arg will change the horizontal size of the bounding box used for checking. If the accuracy is set to negative values (default is -1), the standard bounding box will be used as before.&lt;br /&gt;
&lt;br /&gt;
This spawnarg is available for all entities and can also affect AIs moving towards levers or buttons.&lt;br /&gt;
&lt;br /&gt;
== Triggering ==&lt;br /&gt;
These path nodes will trigger their targets when AI &#039;use&#039; them (as of TDM v2.02):&lt;br /&gt;
&lt;br /&gt;
* path_corner - triggers targets when node is reached&lt;br /&gt;
* path_turn - triggers targets when turn is done&lt;br /&gt;
* path_wait - triggers targets when wait is over&lt;br /&gt;
* path_sit - triggers targets when sitting anim is done, including any final turn&lt;br /&gt;
* path_sleep - triggers targets when lying down anim is done&lt;br /&gt;
* path_anim - triggers targets when anim is done&lt;br /&gt;
&lt;br /&gt;
= Kinds of Path Nodes =&lt;br /&gt;
&lt;br /&gt;
== path_corner ==&lt;br /&gt;
Probably the most common path node, this is a &amp;quot;travel node&amp;quot;.  AI will walk from their current position to this node in as straight a line as possible.  This node must be on the ground and in an area AI can reach.  See [[Pathfinding]] for more information on how to help AI go from one node to another.&lt;br /&gt;
&lt;br /&gt;
To make AI patrol an area, each path_corner node can target the next one in sequence.  If AI reach a node that does not target anything, they will stop there and no longer move without player interaction.  It is possible for two path_corners to target each other, which means the AI will walk from one to the other and back again endlessly.&lt;br /&gt;
&lt;br /&gt;
A single entity (path node or AI) can target more than one path_corner; TDM will randomly choose between the targeted nodes.  Use the following syntax:  &lt;br /&gt;
&lt;br /&gt;
 target path_corner_1&lt;br /&gt;
 target2 path_corner_2&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the example below, both A and B are path_corner nodes.  On map start, the AI will walk to A, then turn and walk to B, then stop.&lt;br /&gt;
&lt;br /&gt;
[[image:pathfinding2.jpg]]&lt;br /&gt;
&lt;br /&gt;
Extra note: To make an AI run on patrol add the property/value : &amp;quot;run&amp;quot; &amp;quot;1&amp;quot; to a path_corner on the AI&#039;s patrol and the AI will run to it (then resume walking after it if the next path_corner does not have that property set.) &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note that an AI will continue on to their next path_corner after a failed search.  If you do not have at least one path_corner, the AI will return to its original position when their search is complete.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Also note that if the AI is going to stop at a path_corner--perhaps to wait a spell--the path_corner origin should be kept at least 16 horizontal units away from monsterclip and worldspawn brushes.  Otherwise, the stopping animation might not look right.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== path_wait ==&lt;br /&gt;
&lt;br /&gt;
This is a behaviour node. It does not tell an AI to move anywhere.  This node tells an AI to wait in an idle state for a given amount of time.  Once that time is up, the AI will proceed to whatever the next target is (a path_wait with no target is pretty pointless).  &lt;br /&gt;
&lt;br /&gt;
A path_wait node appears as a small orange box.  It has a directional arrow, but that has no affect on which direction the AI faces in the first place. However, you can set the angle key on the path either by rotating the entity or by setting the key directly to make the AI turn and face this direction before starting to wait. &#039;&#039;&#039;Important:&#039;&#039;&#039; If the angle is 0 make sure it is actually on the entity and not just default.&lt;br /&gt;
&lt;br /&gt;
A path_wait node should have a &amp;quot;wait&amp;quot; property, with the number of seconds the AI should wait there before proceeding.  It can also have a &amp;quot;wait_max&amp;quot; property  which will vary the repeat time. So for example...&lt;br /&gt;
&lt;br /&gt;
    * wait 30&lt;br /&gt;
    * wait_max 40 &lt;br /&gt;
&lt;br /&gt;
...will cause the AI to wait between 30 to 40 seconds before proceeding. If wait_max is set to 0, the AI will always wait exactly the time specified in wait before proceeding. If you set wait to 0, the AI will wait between 0 seconds and the time specified in wait_max. Default values are 2 seconds for wait, and 0 seconds for wait_max, so the AI will always wait exactly 2 seconds.&lt;br /&gt;
&lt;br /&gt;
In the following example, A and B are path_corners, and the small orange box is a path_wait entity.  On map start, the AI will walk to A and wait there for the required amount of time, then turn and proceeds to B.&lt;br /&gt;
&lt;br /&gt;
[[image:pathfinding3.jpg]]&lt;br /&gt;
&lt;br /&gt;
Note that it does not matter &#039;&#039;&#039;where&#039;&#039;&#039; the path_wait node is placed.  The AI does not actually follow the orange lines (this is not really intuitive, I know).  The example below would cause the exact same behaviour as the example above--in both cases the AI will walk directly from A to B.&lt;br /&gt;
&lt;br /&gt;
[[image:pathfinding4.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Another useful example for path_wait is that of the stationary guard who turns to look in different directions periodically.  This can be schematically represented (arrows indicate target links) as:&lt;br /&gt;
&lt;br /&gt;
AI -&amp;gt; path_corner1 -&amp;gt; path_wait1 -&amp;gt; path_wait2 -&amp;gt; path_corner1&lt;br /&gt;
&lt;br /&gt;
Example properties for the path_wait are:&lt;br /&gt;
 wait: 5  (minimum time to wait on action)&lt;br /&gt;
 wait_max: 10  (maximum time to wait on action)&lt;br /&gt;
 angle: 0  (&#039;&#039;&#039;Important&#039;&#039;&#039;:  this property is essential for proper function even if the angle is 0)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The AI walks to or stands at the path_corner.  The next action is to do what is indicated by the first path_wait.  In this example, it tells the AI to face a particular direction for a certain period of time.  This then targets a second path_wait which has the AI face a different direction for a certain period of time.  To complete the cycle, the second path_wait then targets the original path_corner.  The path_corners are necessary because again, the path_wait doesn&#039;t contain pathing or location information.  Without the path_corner, if the AI is caused to wander (e.g. becomes alerted), it might not return to the original standing spot, and instead will do the look angles right where it stands.  The path_corner assures the AI returns to its original position.&lt;br /&gt;
&lt;br /&gt;
== path_turn == &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;(edit:  I&#039;m not sure why this node is useful, since path_wait can do the same thing).&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This behaviour node tells an AI to turn in place to face a chosen direction.  It does not make the AI walk anywhere.  This is the one node where the directional arrow does seem to matter--the AI turns to face the same direction as the arrow.  Alternately, you can use  the property &amp;quot;angle&amp;quot; and the values below:&lt;br /&gt;
&lt;br /&gt;
* 0 = East (X)&lt;br /&gt;
* 90 = North (Y)&lt;br /&gt;
* 180 = West (-X)&lt;br /&gt;
* 270 = South (-Y)&lt;br /&gt;
* 360 = East(X)&lt;br /&gt;
&lt;br /&gt;
(Actually, to be more accurate, rotating the entity automatically adds the &amp;quot;angle&amp;quot; property to the entity. If you just leave the arrow facing the way it is when you create the entity, there will be no &amp;quot;angle&amp;quot; property, and therefore the AI will not turn.)&lt;br /&gt;
&lt;br /&gt;
Adding a &amp;quot;wait&amp;quot; spawnarg to this node doesn&#039;t seem to do anything.&lt;br /&gt;
&lt;br /&gt;
== path_anim ==&lt;br /&gt;
&lt;br /&gt;
This is a behaviour node that makes the AI play an animation, once.  When that animation is done, it proceeds to the next target (if any).  This could be used to make an AI walk over to a bookshelf and play a &#039;reaching out&#039; animation, for example.  Other possibilities include peering through a window, picking a carrot off a table and eating it, or running to a spot and cowering.  &lt;br /&gt;
&lt;br /&gt;
The syntax proper syntax is:&lt;br /&gt;
&lt;br /&gt;
 anim  [animation name]&lt;br /&gt;
&lt;br /&gt;
You can see the list of animations names here: [[Animation List]].  Do not use the name of the actual animation file.  &lt;br /&gt;
&lt;br /&gt;
A path_anim can have only one animation, but it is possible for a single entity to target more than one path_anim.  The AI will pick one of the path_anim nodes at random and play that animation.&lt;br /&gt;
&lt;br /&gt;
When you first create the path_anim entity, the directional arrow is meaningless.  However, if you rotate the entity, the &amp;quot;angle&amp;quot; property is added to the entity and is updated based on which direction the arrow is pointing.  That property indicates the direction the AI will face while playing the animation.  &#039;&#039;&#039;This value appears to be necessary to make the animation work.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Tip:  Animation blending doesn&#039;t seem to do very much, so AI often &amp;quot;snap&amp;quot; into position from walking to playing the animation.  For a more natural look, add a path_wait of a few seconds first, so AI transition to their idle pose before playing the animation.&lt;br /&gt;
&lt;br /&gt;
== path_lookat ==&lt;br /&gt;
&lt;br /&gt;
This does not stop the AI, but they will turn their head and look somewhere specific as they walk to their next target.  For the next &#039;&#039;wait&#039;&#039; seconds, turn head to look at the entity given by the &#039;&#039;focus&#039;&#039; spawnarg (defaults to looking at the path_lookat entity itself). This is useful if you want to make sure an AI is looking at a specific spot (or away from a certain spot) during their patrol.  Note the focus entity must not be obscured by monsterclip.&lt;br /&gt;
&lt;br /&gt;
== path_sit ==&lt;br /&gt;
&lt;br /&gt;
This is a behaviour node that makes the AI sit down at its current location.  See [[Sitting Behaviour for AI]] for more information.&lt;br /&gt;
&lt;br /&gt;
== path_waitfortrigger ==&lt;br /&gt;
&lt;br /&gt;
Waits at a given place until triggered, then proceeds to the next target.  This is useful if you want some control over exactly where the AI is when the players first see it.&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;path_waitfortrigger&amp;quot; basically operates like a wall, blocking the AI from proceeding until triggered.&lt;br /&gt;
&lt;br /&gt;
Here are the steps for future reference. Let&#039;s say you want an AI to stand somewhere until a player triggers him, then you want him to walk to path_corner 1.&lt;br /&gt;
&lt;br /&gt;
1. Make a &amp;quot;path_waitfortrigger&amp;quot; pathnode, and have it target &amp;quot;path_corner_1&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
2. Have the AI target the &amp;quot;path_waitfortrigger&amp;quot; pathnode.&lt;br /&gt;
&lt;br /&gt;
3. Create a trigger_once entity, and target the AI.&lt;br /&gt;
&lt;br /&gt;
The AI will stand where they are at map start and behave as if there are no pathnodes set (ie, he plays idle animations and can be alerted). When the player goes through the trigger, the &amp;quot;path_waitfortrigger&amp;quot; is cleared and the AI will proceed to path_corner_1.&lt;br /&gt;
&lt;br /&gt;
== path_interact ==&lt;br /&gt;
&lt;br /&gt;
This lets the AI interact with an entity (for example a button) in a similar way to frobbing. This will only work for buttons etc, not for inventory items and moveables. The AI will stop and look at the entiy while interacting, but not walk to it, so a path_corner next to the entity is required.  AI will use normal doors and elevators without needing a path_interact.  However, this could be used to make AI turn on lightswitches, open mechanical doors, etc.&lt;br /&gt;
&lt;br /&gt;
You need to add these spawnargs to the path_interact entity:&lt;br /&gt;
&lt;br /&gt;
ent &amp;lt;name of entity to be frobbed by AI&amp;gt;&lt;br /&gt;
&lt;br /&gt;
target &amp;lt;next path entity (if any)&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= How to Make AI do Random Interesting Things (RIT) =&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;by Sotha&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
You can use the above to make individual AI seem to do Random Interesting Things (RIT) when entering a room. Note that it will work with basic dendritic AI, so you could have multiple AI&#039;s running in several rooms doing things.&lt;br /&gt;
&lt;br /&gt;
1) Build a room with RITs. A statue. A few chairs. Maybe a lit fireplace.&lt;br /&gt;
&lt;br /&gt;
2) On each RIT place the necessary interaction path_nodes to make an AI interact with them:  path_corner to walk over to them; path_sit on each of the chairs, path_anims for warming hands at the fireplace and standing in front of the statue and pondering, etc (A, B &amp;amp; C in image).&lt;br /&gt;
&lt;br /&gt;
3) Place two path_waits (1 &amp;amp; 2 in image) on the ceiling of the room. (They could be anywhere in the room, but it is easiest to manage if they are in the ceiling.)&lt;br /&gt;
&lt;br /&gt;
4) Name one of the path_waits &amp;quot;enter_room_decide_what_to_do.&amp;quot; (1) From that path_wait target each of the RIT path_corners. Set the path_wait &amp;quot;wait 0&amp;quot;. so AI won&#039;t stop there. The idea is to use the path_wait as a simple decision making node. Be sure that the path_wait has no angle-spawnarg. If it does, the AI will turn towards the angle each time he targets the node.&lt;br /&gt;
&lt;br /&gt;
5) Name the other path_wait &amp;quot;exit_room_decide_what_to_do.&amp;quot; (2) Make each RIT final path_node  target this path_wait. Make the path_wait target other rooms with similar decision making path_waits.&lt;br /&gt;
&lt;br /&gt;
6) Done.&lt;br /&gt;
&lt;br /&gt;
[[Image:Rits.jpg]] &lt;br /&gt;
&lt;br /&gt;
AI will come into the room, select A, B or C at random, and then leave.  Next time they enter, they&#039;ll again pick at random.&lt;br /&gt;
&lt;br /&gt;
This could be used to make servants to run around a mansion, cleaning, making food, taking sitting breaks, visit the toilet, etc. You could build room decision making network separately for different AI. Servants clean, cook and take breaks. Guards patrol, make random deviations once in a while, and of course take breaks. Controlling the RIT path_corner chance-spawnarg gives you control what RITs the AI do more likely.&lt;br /&gt;
&lt;br /&gt;
Please see the dedicated RIT network article for more details. [[RIT Networks]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Switching from one Path network to another =&lt;br /&gt;
&lt;br /&gt;
Suppose you want to have an AI patrol outside a mansion for the first part of a mission, and then change his route to patrol in another location later?&lt;br /&gt;
&lt;br /&gt;
It is possible to change the &amp;quot;target&amp;quot; property on a path_corner by using &#039;&#039;atdm:target_changetarget.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Target the atdm:target_changetarget entity at the pathnode you wish to alter.  Use the following spawnargs:&lt;br /&gt;
&lt;br /&gt;
&amp;quot;add&amp;quot;  &amp;quot;[new path_corner]&amp;quot;&lt;br /&gt;
and/or&lt;br /&gt;
&amp;quot;remove&amp;quot; &amp;quot;[old path_corner]&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Then add a trigger that targets the atdm:target_changetarget.&lt;br /&gt;
&lt;br /&gt;
When triggered, the new path_corner will be added and the old removed, sending the AI to a new path network.  This no doubt has vast potential for variation and creativity that has yet to be explored.  One simple example would be a &amp;quot;changing of the guard&amp;quot; moment, where some guards leave their posts and go to their barracks to sleep, while others take over for them.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Other ideas:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Doormen&#039;&#039;&#039;-- An AI (or the player) walks up to the door and knocks on it. AI inside is triggered to walk over to the door and open it, then go back to his regular duties.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Abandon ship!&#039;&#039;&#039; -- When triggered, all AI drop what they&#039;re doing and start running for the exits.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Lights out!&#039;&#039;&#039; -- At a specific time, all AI stop what they&#039;re doing and walk to their beds to go to sleep.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Re-use, recycle&#039;&#039;&#039; -- AI that are stuck back in a portion of the map the player won&#039;t be coming back to could be told to walk to a new portion of the map and assume some job there.&lt;br /&gt;
&lt;br /&gt;
It&#039;&#039;&#039;&#039;s a trap!&#039;&#039;&#039; -- Player walks down a hall and hits a trigger that causes AI to quickly position themselves at the only exits.&lt;br /&gt;
&lt;br /&gt;
= Flee Points =&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Do NOT target the AI to a flee point; AI will automatically go to a flee point if in danger. Just make available path_flee_point entities at suitable places where you would like your AI to flee to.&lt;br /&gt;
&lt;br /&gt;
On the path_flee_point entity:&lt;br /&gt;
&lt;br /&gt;
&amp;quot;is_guarded&amp;quot;, a fleeing AI, eg, a civilian, would give this preference (but it is up to the mapper to actually provide a guard there.)&lt;br /&gt;
&lt;br /&gt;
&amp;quot;team&amp;quot;, only AI on this team would use this flee point, also required for &amp;quot;friendly&amp;quot; flee points per below.&lt;br /&gt;
&lt;br /&gt;
This is how the code works:&lt;br /&gt;
* The AI tries to determine the nearest friendly (their team specified) guarded flee point and flee to it.&lt;br /&gt;
* If there is no friendly guarded flee point, the AI tries to find the nearest friendly flee point (on friendly team) and run to it.&lt;br /&gt;
* If this also fails, the AI tries to find an AAS area far from the enemy and run there.&lt;br /&gt;
* If the enemy is still visible when the AI reaches his destination, he chooses the farthest friendly guarded flee point to run to, &lt;br /&gt;
* if this fails, the farthest friendly flee point, &lt;br /&gt;
* and if this also fails falls back to choosing an AAS area far from the enemy to run to.&lt;br /&gt;
* So neither the priority nor the target spawn arg have any function here, it is not possible to weight the flee points. The AI will choose one automatically.&lt;br /&gt;
&lt;br /&gt;
A problem occurs when the AI doesn&#039;t find any appropriate flee points but also no AAS area that is far away enough from the enemy. In this case, he will just stand there. Maybe he should either cower and be afraid in this case or just run around like a mad chicken?&lt;br /&gt;
&lt;br /&gt;
Whether a fleeing AI passes on info to other AI as to the source of their alert (ie so armed guard would go to investigate to the right place whereas another civilian might also flee to the farthest point.)&lt;br /&gt;
Yes, they do. The cry for help bark is propagated to other AI and carries information about the last alert position.&lt;br /&gt;
&lt;br /&gt;
Armed AI will also flee if their health points drop to a certain level? Where is that determined?&lt;br /&gt;
This is determined by the health_critical spawn arg.&lt;br /&gt;
&lt;br /&gt;
= Untested Nodes =&lt;br /&gt;
&lt;br /&gt;
I have not personally tested the following, so I&#039;m just going by their editor descriptions.  They may or may not work as described.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== path_cycleanim ==&lt;br /&gt;
&lt;br /&gt;
The AI stays in place and loops the selected animation, either for a specified amount of time (using the &#039;wait&#039; property) or until triggered.  Syntax needed.&lt;br /&gt;
&lt;br /&gt;
== path_hide ==&lt;br /&gt;
&lt;br /&gt;
Supposedly deactivates and stops rendering the AI.  &lt;br /&gt;
&lt;br /&gt;
Turns out this doesn&#039;t work well with TDM...makes AI invisible but they still talk and occupy space.  To remove an AI from the map, try grayman&#039;s approach:&lt;br /&gt;
&lt;br /&gt;
 Create a [b]func_remove[/b] with this spawnarg:&lt;br /&gt;
&lt;br /&gt;
 &amp;quot;target&amp;quot; &amp;quot;&amp;lt;AI&#039;s name&amp;gt;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
 At the point in his path where you want him to disappear, place a [b]trigger_once_entityname[/b] with these spawnargs:&lt;br /&gt;
&lt;br /&gt;
 &amp;quot;entityname&amp;quot; &amp;quot;&amp;lt;AI&#039;s name&amp;gt;&amp;quot;&lt;br /&gt;
 &amp;quot;target&amp;quot; &amp;quot;&amp;lt;func_remove&#039;s name&amp;gt;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
When the AI walks through the [b]trigger_once_entityname[/b], it recognizes him, triggers the [b]func_remove[/b], and that takes the AI out of the game.&lt;br /&gt;
&lt;br /&gt;
I wrapped the AI&#039;s final path corner in a trigger_once_entityname and gave the trigger the keyword pair &amp;quot;entityname &amp;lt;AI_name&amp;gt;&amp;quot;. (The docs don&#039;t tell you about this key, but the game will error out if it&#039;s not there, and tell you it&#039;s missing. A classic &amp;quot;trial by error&amp;quot;.)&lt;br /&gt;
&lt;br /&gt;
== path_show ==&lt;br /&gt;
&lt;br /&gt;
Starts rendering the AI.  I would assume this one would be linked to a path_waitfortrigger, to create AI that spawn when triggered.  This could be used to create the effect that an AI just came through a doorway or around a corner.&lt;br /&gt;
&lt;br /&gt;
== path_attack ==&lt;br /&gt;
&lt;br /&gt;
Used to script AI attacking a particular enemy, for scripted sequences I guess. AI will continue on to the next path entity if it kills the enemy.&lt;br /&gt;
&lt;br /&gt;
Questions:  How do you define who the AI attacks?&lt;br /&gt;
&lt;br /&gt;
[Fidcal]: Just found this - &amp;quot;Character will attack the character specified by &#039;enemy&#039; key. Character will go to next path when enemy dies or when activated.&amp;quot; Not tested.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{tutorial-editing}}&lt;/div&gt;</summary>
		<author><name>Springheel</name></author>
	</entry>
</feed>