This
tutorial will show you how to use the UTIL_ScreenFade and
UTIL_ScreenShake functions in your weapons to create effects like
night vision and vibrations.
First off, include the shake.h:
#include "shake.h"
Now you will be able to use the UTIL_ScreenFade and UTIL_ScreenShake
functions.
Example:
UTIL_ScreenFade( m_pPlayer,
Vector(0,255,0), 1, 0.5, 128, FFADE_OUT | FFADE_STAYOUT);
This will fade the screen to green and hold it
there.
The m_pPlayer is the player that screen is fading.
The Vector(0,255,0) is the color in RGB.
The next three numbers are the Duration(), HoldTime(),
pev->renderamt.
The last are special flags:
FFADE_IN //this is here so we dont pass 0
FFADE_OUT //fade out
FFADE_MODULATE //modulate (dont blend)
FFADE_STAYOUT //ignores duration
Example2:
UTIL_ScreenShake(
pev->origin, Amplitude(), Frequency(), Duration(), Radius() );
This should be fairly self explanatory.
The first param is the center of the shake.
The second is the amplitude of the shake.
The third is the frequency of the shake--noise frequency (low
frequency is a jerk,high frequency is a rumble).
The fourth is the duration of the shake.
The last is the radius of the shake.(Not sure what this does, I ve
seen it set to 0).
NOTE: UTIL_ScreenShake() will only shake players who are on the
ground.
Any questions or suggestions should be sent to me:
venturis52@hotmail.com |