Hosting and domain costs until October 2024 have been generously sponsored by dumptruck_ds. Thank you!

Editing Map based hacks

From Quake Wiki

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision Your text
Line 5: Line 5:
  
  
'''Map-based hacks''' are non-standard techniques in [[Mapping | mapping]] that allow the customization of [[Entity | entities]] in a map without resorting to [[Modding | modding]]. They are made possible due to the fairly open nature of [[Quake-C]]. The so-called hacks involve the modification, replacment or addition of keys in existing entities to enhance their functionality as well as the creation of completely new ones. While they generally work reliably in [[Vanilla Quake]] ("ID1"), they can cause compatibility problems if the map is run with a [[Mod | mod]], ranging from incorrect appearance to engine crashes, which means they have to be used with caution.
+
'''Map-based hacks''' are non-standard techniques in [[Mapping | mapping]] that allow the customization of [[Entity | entities]] in a map without resorting to [[Modding | modding]]. They are made possible due to the fairly open nature of [[Quake-C]]. The so-called hacks involve the modification, replacment or addition of keys in existing entities to enhance their functionality as well as the creation of completely new ones. While they generally work reliably in [[Vanilla Quake]] ("[[ID1]]"), they can cause compatibility problems if the map is run with a [[Mod | mod]], ranging from incorrect appearance to engine crashes, which means they have to be used with caution.
  
 
==Theory behind the hacks==
 
==Theory behind the hacks==
Line 19: Line 19:
  
 
In addition to the spawn function, there are several other possibilities or requirements to further determine the behavior of the new entity and its appearance in the game, such as its [[Model | model]] and [[Sounds | sound effects]]. For many hacks to work, it is important that all of such resources are precached, which require the corresponding standard [[Entity_guide | entities]] to be present in the map alongside the new ones.
 
In addition to the spawn function, there are several other possibilities or requirements to further determine the behavior of the new entity and its appearance in the game, such as its [[Model | model]] and [[Sounds | sound effects]]. For many hacks to work, it is important that all of such resources are precached, which require the corresponding standard [[Entity_guide | entities]] to be present in the map alongside the new ones.
 +
 +
==Specific hacks==
  
 
==Triggers==
 
==Triggers==
 
===Point-based triggers with custom bounding box===
 
===Point-based triggers with custom bounding box===
While most of the standard [[Entity_guide | triggers]] are by default defined as [[Entity#Overview | brush entities]], it is possible to for them to be used as [[Entity#Overview | point entities]] as well. The difference is that they only work at a single point instead of a larger volume that would otherwise be determined by the [[Brush | brush]]. They also do not count towards the [[Engine_Limits | model limit]]. Among other fields of use, this makes them a good alternative for monster teleporters (the ''silent'' spawnflag must be set), for example.
+
While most of the standard [[Entity_guide | triggers]] are by default defined as [[Entity#Overview | brush entities]], it is possible to for them to be used as [[Entity#Overview | point entities]] as well. The difference is that they only work at a single [[Origin | point]] instead of a larger volume that would otherwise be defined by the [[Brush | brush]]. They also do not count against the [[Engine_Limits | model limit]]. Among other fields of use, this makes them a good alternative for monster [[Teleport | teleporters]] (the ''silent'' spawnflag must be set), for example.
There are two downsides, however. If set to be shootable, point triggers can only be activated by splash damage. Furthermore, in a normal map environment, touchable point triggers are easy to miss for the player. The latter can be worked around as it is possible to assign any precached model to serve as the bounding box of the point trigger. This is achieved by adding a '''model''' field to the trigger which points the corresponding entity, such as an item, a monster, or a brush entity.
+
There are two downsides, however. If set to be shootable, point triggers can only be activated by splash damage. Furthermore, in a normal map environment, touchable point triggers are easily missable by the player. The latter can be worked around as it is possible to assign any precached model to serve as the bounding box of the point trigger. This is achieved by adding a '''model''' field to the trigger which points the corresponding entity, such as an item, a monster, or a brush entity.
  
For instance, ''"model" "maps/b_bh100.bsp"'' will make the bounding box the size of a [[Megahealth]] (32*32*32 units), ''"model" "progs/shambler.mdl"'' will make it the size of a [[Shambler]] (64*64*96 units). Using any kind of .bsp and .mdl model is the easiest way, but it bears the risk of producing incompatibility to mods that lack the referenced objects or treat them differently, and will likely result in a crash. A safe, but also more complicated way is to reference existing brush models from within the map, e.g. ''"model" "*10"''. This makes placing the such a trigger very tricky, however, because its location has to be determined by the location of the original brush entity in its relation to the world [[Origin|origin]] (0 0 0).
+
For instance, ''"model" "maps/b_bh100.bsp"'' will make the bounding box the size of a [[Megahealth]] (32*32*32 units), ''"model" "progs/shambler.mdl"'' will make it the size of a [[Shambler]] (64*64*96 units). Using any kind of .bsp and .mdl model is the easiest way, but it bears the risk of incompatibility to mods that lack the referenced objects or treat them differently, and will likely result in a crash. A safe, but also more complicated way is to reference existing brush models from within the map, e.g. ''"model" "*10"''. This makes placing the such a trigger very tricky, however, because its location has to be determined by the location of the original brush entity in its relation to the map origin (0 0 0).
  
 
Example:
 
Example:
Line 32: Line 34:
 
"target" "t1"
 
"target" "t1"
 
"model" "progs/player.mdl"</pre>
 
"model" "progs/player.mdl"</pre>
 
===Dormant triggers===
 
Like any other entities, triggers spawn immediately upon map start. In some occasions, however, it is desirable for triggers to remain initially dormant and only be activated after a certain event or if the player passes through an area for the second time. The trick to create such a trigger is to use a brush-based [[info_notnull]] entity that has its '''use''' field set to ''InitTrigger'', so it will spawn a trigger entity when being triggered itself, and a '''touch''' field that calls the appropriate [[triggers.qc|function]] for interaction. Additional keys required for proper functionality are the same as for the standard entity. This works with all standard trigger varieties and can also be used in conjunction with the [[Map_based_hacks#Point-based triggers with custom bounding box|point trigger]] hack.
 
 
Example: <pre>"classname" "info_notnull"
 
"targetname" "t1"
 
"use" "InitTrigger"
 
"touch" "changelevel_touch"
 
"map" "start"
 
// brush</pre>
 
 
It can also be done by simply inserting the classname of the desired trigger into the '''use''' field of the [[info_notnull]]. This does not require setting the corresponding '''touch''' function as it is called automatically.
 
 
Example:
 
<pre>"classname" "info_notnull"
 
"targetname" "t1"
 
"use" "trigger_changelevel"
 
"map" "start"
 
// brush</pre>
 
  
  
==Miscellaneous hacks==
 
 
===Triggerable explosion===
 
===Triggerable explosion===
 
One of the most well known tricks allows the creation of a triggerable explosion using the '''info_notnull''' entity. It is created as follows:
 
One of the most well known tricks allows the creation of a triggerable explosion using the '''info_notnull''' entity. It is created as follows:

Please note that all contributions to Quake Wiki are considered to be released under the GNU Free Documentation License 1.3 or later (see Quake Wiki:Copyrights for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource. Do not submit copyrighted work without permission!

To edit this page, please answer the question that appears below (more info):

Cancel | Editing help (opens in new window)