QuakeEx

From ZDoom Wiki
Jump to navigation Jump to search

bool QuakeEx (int tid, fixed intensityX, fixed intensityY, fixed intensityZ, int duration, int damrad, int tremrad, sound sfx [, int flags [, fixed mulwavex [, fixed mulwavey [, fixed mulwavez [, int falloff [, int highpoint [, fixed rollintensity [, fixed rollwave[, fixed damageMultiplier[, fixed thrustMultiplier[, int damage]]]]]]]]]);

Note: as of 4.11.0, the intensity parameters are decimal values instead of integers.

Usage

This is an extended version of Radius_Quake2 with the ability to create an earthquake effect to manipulate the player's view along a specific axis, either in direct map axis or along the camera based upon the flags. It also allows adjusting the Z axis (quaking up and down). It also follows the same functionality, and creates an earthquake around the calling actor. In addition, it can also manipulate the ins and outs of an earthquake.

Parameters

  • tid: Thing ID of map thing(s) for quake foci (if 0, the activator is used as the sole focus)
  • intensityX/Y/Z: Strength of earthquake, ranging from 0 to 9, along a particular axis.
  • duration: Duration in tics
  • damrad: Radius of damage in map units, things that are not on the ground are unaffected.
  • tremrad: Radius of tremor in map units
  • sound: Accompanying sound effect for the tremor.
  • flags: Can be combined with the pipe "|" character. All flags are compatible with each other:
  • QF_RELATIVE — Adjust the X and Y intensities to quake along the camera view's front and side respectively.
  • QF_SCALEDOWN — Scales the intensity over the duration, going from full at the start of the quake to 0 upon finishing. Can be combined with QF_SCALEUP.
  • QF_SCALEUP — Scales the intensity over the duration, going from 0 at the start of the quake to full upon finishing. Can be combined with QF_SCALEDOWN.
  • QF_WAVE — Changes the quake from a randomly generated one to a sine wave, and are further controlled by mulwavex/y/z. Intensity is known as 'amplitude' in this form.
  • QF_MAX — Requires QF_SCALEDOWN and QF_SCALEUP. Fully scaled quakes will gradually scale from 0 to half intensity, and back to 0. This changes 0 to start from the defined intensity instead.
  • QF_FULLINTENSITY — Requires QF_SCALEDOWN and QF_SCALEUP. Fully scaled quakes will only scale in to the half intensity from their origins. This changes half to full intensity instead.
  • QF_3D — Makes the screen shake of the earthquake also fall off based on how far away the player is on the Z axis from the source of the earthquake.
  • QF_GROUNDONLY: The screen shake of the earthquake will stop when the player or their camera is off the ground, similar to real world earthquakes.
  • QF_AFFECTACTORS: The damrad property will also be able to harm and throw around non-player actors, instead of only affecting players. Non-players can be made immune to the thrusting with DONTTHRUST.
  • QF_SHAKEONLY: The earthquakes' damrad property will only be used to throw the player and other actors around, without actually harming them.
  • QF_DAMAGEFALLOFF: Causes the thrusting and/or damage created by the earthquake to fall off based on distance, just like the screenshake effect itself, unlike the screenshake however, the damage and thrust falloff uses the damrad instead of the tremrad. If the damage of the quake falls off to 0 or less while within the damrad, the value will be clamped to 1. (New from 4.11.0)
  • mulwavex/y/z: Only used with QF_WAVE. Specifies the number of waves per second the wave quake goes through while active. Default is 1. These are float values, so precision can be achieved.
  • falloff: Determines how far away the quake will start to reduce its amplitude based on distance. Takes the same arguments at tremrad in map units. Anything inside this will experience the full effect of the quake. Default is 0, which is no falloff.
  • highpoint: Only used with QF_SCALE<DOWN/UP>. Determines how far into the quake in tics for the quake to reach the peak of its shaking (or lack thereof if QF_MAX is included). Default is 0, or directly half way.
  • rollintensity: The camera roll is affected in a similar way to intensityX/Y/Z if specified. Unlike normal intensity, this is not capped. If QF_WAVE is used, can also be negative to allow randomization. This feature does not rely upon the standard intensities and can be used separately (placing 0 in intensity and mulwave properties), but the flags affect it exactly the same.
  • rollwave: Similar to mulwavex/y/z, but for rolling.
  • damageMultiplier: Multiplies the damage the earthquake induces on actors by the amount specified. Default is 1. (New from 4.11.0)
  • thrustMultiplier: Multiplies the amount of force the earthquake shoves around with by the amount specified. Default is 0.5. (New from 4.11.0)
  • damage: The exact amount of damage the earthquake should perform, allowing for fine tuning of damage. By default, earthquakes do a random amount of damage from 1 to 7, unless this property is 0. (New from 4.11.0)

Regular random quakes can stack with wave quakes, but to achieve this effect, one call to QuakeEx with QF_WAVE specified must happen with another call to the same function without QF_WAVE. This allows for cameras to shake along the wave, as the wave takes priority over where the jittering regular quakes positions. Wave quakes also will pause when the game is paused in any manner. Normally, regular quakes persist through an opened console for example, but wave quakes will always halt when a menu or console pause occurs. Similarly, rolling quakes follow the same behavior.

Contrarily to the Radius_Quake action special, the radii for damage and tremor are given directly in map units, not in "tiles" of 64x64 map units. This must be kept in mind when updating a script from Radius_Quake to QuakeEx.

Return value

Returns false if either the activator is null or there are no actors with the specified tid. Otherwise, it returns true.

Examples

Nuvolachalk.png Note: This article lists no examples. If you make use of this feature in your own project(s) or know of any basic examples that could be shared, please add them. This will make it easier to understand for future authors seeking assistance. Your contributions are greatly appreciated.


See also