Adding Muzzle Flashes that lights up the world

From Valve Developer Community
Revision as of 05:55, 18 October 2024 by Rixzzy (talk | contribs) (Made this page.)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

In this tutorial, I will show you how to add dlights to a Half Life 1 Mod (GoldSrc mod). dlights are better than elights but they take away your PC’s performance.

Let’s start. Well navigate to // make a dlight first dlight_t *dl = gEngfuncs.pEfxAPI->CL_AllocDlight(0);

// Original color values int originalR = 231; int originalG = 219; int originalB = 14;

// Randomize color components within the range of +/- 20 dl->color.r = originalR + gEngfuncs.pfnRandomLong(-20, 20); dl->color.g = originalG + gEngfuncs.pfnRandomLong(-20, 20); dl->color.b = originalB + gEngfuncs.pfnRandomLong(0, 0);

// Randomize the die value by +/- 0.01 dl->die = gEngfuncs.GetClientTime() + 0.05 + gEngfuncs.pfnRandomFloat(-0.01, 0.01);

// Randomize the radius based on amount dl->radius = gEngfuncs.pfnRandomFloat(245.0f, 256.0f);

// Randomize the decay value dl->decay = gEngfuncs.pfnRandomFloat(400.0f, 600.0f);