Difference between revisions of "Map based hacks"

From Quake Wiki

(Specific hacks)
(Triggered sounds)
Line 41: Line 41:
 
* Add the key "noise" "<sound you wish to play>". (example:"weapon/lhit.wav" lightning gun zap)
 
* Add the key "noise" "<sound you wish to play>". (example:"weapon/lhit.wav" lightning gun zap)
 
* Give it a targetname and create some kind of trigger that targets it.
 
* Give it a targetname and create some kind of trigger that targets it.
 +
 +
How does this work? train_wait is a function used by [[func_train]] entities, which plays it's "noise" property. A variation on this hack is to do "use" "plat_hit_bottom" and "noise1" "<sound>", which works much the same way.
  
 
===Shoot Monster Projectiles===
 
===Shoot Monster Projectiles===

Revision as of 19:01, 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:

  • barrel_explode - Barrel explosion
  • 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.

Triggered sounds

You can play most any sound you wish by triggering it! This requires the sound to be precached, so an entity which uses it must be present in the map beforehand (for example, place an Ogre if you want to use it's chainsaw sounds). It's a pretty simple setup too:

  • Create an info_notnull entity.
  • Add the key "use" "train_wait".
  • Add the key "noise" "<sound you wish to play>". (example:"weapon/lhit.wav" lightning gun zap)
  • Give it a targetname and create some kind of trigger that targets it.

How does this work? train_wait is a function used by func_train entities, which plays it's "noise" property. A variation on this hack is to do "use" "plat_hit_bottom" and "noise1" "<sound>", which works much the same way.

Shoot Monster Projectiles

This can be a fun one to fool around with. Many of the monsters in Quake have projectile attacks, and we can make an entity that can shoot them on command! Note that these do also play the sounds of the monster shooting them.

There are also a few caveats: First, in general, you need the monster already present in the map so that the precaching of sounds and sprites and such will work. Second, you need to target them at an entity that will be the 'enemy', which means knowing it's index in the edict list. If you want to shoot at Player1, this is simple, as Player1 is always index 1. Some of these also require the targeted enemy to be alive, which means they need "health" "1".

  • Create an info_notnull entity.
  • Add the key "use" "OgreFireGrenade". (Or any other function listed below)
  • Add the key "health" "1". (Being 'alive' is required by some enemy attacks)
  • Add the key "enemy" "<index of enemy to target>".
  • Give it a targetname and create some kind of trigger that targets it.

When triggered, the info_notnull above will fire a grenade toward it's enemy (remember, Ogres are not Z-Aware, so will not angle the shot up or down). You can find the index of entities via the console command edictlist in most modern engines. Note that the index of an entity is not always guaranteed to be the same on all difficulties or after adding or removing entities from a map. Here are some other projectiles you can use:

  • "OgreFireGrenade" - Ogre's Grenade.
  • "CastLightning" - Shambler Lightning (you may want to trigger this multiple times)
  • "hknight_shot" - Hell Knight magic attack. This is just 1 missile.
  • "Wiz_StartFast" - Scrag slime bolt. 2 are fired.
  • "enforcer_fire" - Enforcer laser.
  • "ZombieFireGrenade" - Zombie gib toss.
  • "boss_missile" - Chthon's homing lava balls.
  • "ShalMissile" - Vore's homing voreball.

Increment the Monsters Killed

This is a useful one if you have placed monsters in a map that the player will not ever be able to kill, such as in combination with another hack which requires a precache. It is also quite simple!

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

How does this work? boss_death10 is a function used by Chthon that is triggered at the end of his death animation which increments the counter that tracks the monsters you have killed. This also removes the entity that calls it, so you must have one of these info_notnull entities set up for each increment you want to do. Misuse of this hack also lead to situations where you have 'killed' more monsters than exist in the map, such as a counter showing the player has killed 11/10 monsters.