Difference between revisions of "Map based hacks"

From Quake Wiki

(added an example and the hope that other, more pro people like Preach might drop by and tidy it up etc :))
m (removed some quoted stuff and added suggested topics (feel free to change of course!))
Line 1: Line 1:
 
This page is intended to be an explanation of the tricks written about on this page: http://www.celephais.net/board/view_thread.php?id=37116
 
This page is intended to be an explanation of the tricks written about on this page: http://www.celephais.net/board/view_thread.php?id=37116
 +
and Preach's excellent blog posts on the subject:
 +
http://tomeofpreach.wordpress.com/category/map-hacks/
  
 
If the people who have used the tricks in here, or know a lot about them (i.e. Preach, Negke) could add stuff, that would be fantastic.
 
If the people who have used the tricks in here, or know a lot about them (i.e. Preach, Negke) could add stuff, that would be fantastic.
Line 8: Line 10:
  
 
==Theory behind the hacks==
 
==Theory behind the hacks==
 +
 +
===info_notnull===
  
 
===The 'use' field===
 
===The 'use' field===
''When an entity is targetted by a trigger, the QC calls whatever function is in the use field of an entity. Most entities like doors and triggers set this field when they are spawned, overwriting what you might want to add. But an info_notnull has no code in it's spawn function, so you can add any function to use, and it will be called.''
 
  
''If you root around the quake source, you can find other functions that do things besides explosion effects, and many of them can be performed from the use field of an info_notnull. In addition, any other entity that doesn't have anything in it's use field by default(eg ammo) can do this same trick and explode on a trigger. Exploding ammo probably isn't the best example, but I'm sure there's some useful example of the idea. '' - [[Preacher]] [http://www.celephais.net/board/view_thread.php?id=37116&start=7&end=7]
 
  
 
==Specific hacks==
 
==Specific hacks==

Revision as of 16:12, 28 March 2013

This page is intended to be an explanation of the tricks written about on this page: http://www.celephais.net/board/view_thread.php?id=37116 and Preach's excellent blog posts on the subject: http://tomeofpreach.wordpress.com/category/map-hacks/

If the people who have used the tricks in here, or know a lot about them (i.e. Preach, Negke) could add stuff, that would be fantastic.



Map based hacks are keys added to entities that add functionality to the entity that it was not originally intended to have. They are possible because of the way Quake C works and allow the level designer to effectively replace functions in entities with other functions from the Quake C code.

Theory behind the hacks

info_notnull

The 'use' field

Specific hacks

Many of these hacks are taken directly from this thread over at Func_MsgBoard.

info_notnull 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:

  • Create an info_notnull entity.
  • Add the key (use : barrel_explode).
  • Give it a targetname and create some kind of trigger that targets it.

When the trigger is fired, an explosion will occur where the info_notnull is. Be careful, since the explosion is more than just an effect and will injure the player if they are near enough. This is especially true of barrel_explode, as it is one of the most powerful explosions in the game. Fortunately, there are two other explosions that can be used instead by setting the value of the 'use' key to one of the following:

  • OgreGrenadeExplode - Ogre grenade explosion (low damage and fairly safe)
  • tbaby_die2 - Spawn death explosion

Note that these explosion functions remove the info_notnull entity from the level when the explosion animation has played, so it is not possible to use them multiple times unless the trigger is fired repeatedly at intervals of less than 0.5 seconds. For larger explosion effects, it is possible to set up multiple small explosions in the same way and trigger them in a sequence using trigger_relays.