Garry's Mod Wiki

util.Effect

util.Effect( string effectName, CEffectData effectData, boolean allowOverride = true, any ignorePredictionOrRecipientFilter = nil )

Description

Creates an effect with the specified data.

You can find a list of built-in engine effects here. You can create your own. Example effects can be found here and here.

For Orange Box .pcf particles, see ParticleEffect, ParticleEffectAttach and CreateParticleSystem.

When dispatching an effect from the server, some values may be clamped for networking optimizations. Visit the Set accessors on CEffectData to see which ones are affected.
You will need to couple this function with IsFirstTimePredicted if you want to use it in predicted hook.

Arguments

1 string effectName
The name of the effect to create.
2 CEffectData effectData
The effect data describing the effect.
3 boolean allowOverride = true
Whether Lua-defined effects should override engine-defined effects with the same name for this/single function call.
4 any ignorePredictionOrRecipientFilter = nil
Can either be a boolean to ignore the prediction filter or a CRecipientFilter.

Set this to true if you wish to call this function in multiplayer from server.

Example

Creates a HelicopterMegaBomb effect at the origin of the map. ( 0, 0, 0 )

local vPoint = Vector( 0, 0, 0 ) local effectdata = EffectData() effectdata:SetOrigin( vPoint ) util.Effect( "HelicopterMegaBomb", effectdata )

Page Links


Special Pages


Wikis

?

Render Time: 71ms

DB GetPage 11
Generate Html 20
SaveChanges (1) 19
Render Body 0
Render Sidebar 18