Garry's Mod Wiki

Revision Difference

util.Effect#527219

<function name="Effect" parent="util" type="libraryfunc"> <description> Creates an effect with the specified data. You can find a list of built-in engine effects <page text="here">Effects</page>. You can create your own. Example effects can be found [here](https://github.com/garrynewman/garrysmod/tree/master/garrysmod/gamemodes/sandbox/entities/effects) and [here](https://github.com/garrynewman/garrysmod/tree/master/garrysmod/gamemodes/base/entities/effects). <note>When dispatching an effect from the server, some values may be clamped for networking optimizations. Visit the Set accessors on <page>CEffectData</page> to see which ones are affected.</note> <note>You will need to couple this function with <page>Global.IsFirstTimePredicted</page> should you use this in a <page text="predicted hook">Prediction</page>.</note> <note>You will need to couple this function with <page>Global.IsFirstTimePredicted</page> if you want to use it in <page text="predicted hook">Prediction</page>.</note> </description> <realm>Shared</realm> <args> <arg name="effectName" type="string">The name of the effect to create.</arg> <arg name="effectData" type="CEffectData">The effect data describing the effect.</arg> <arg name="allowOverride" type="boolean" default="true">Whether Lua-defined effects should override engine-defined effects with the same name for this/single function call.</arg> <arg name="ignorePredictionOrRecipientFilter" type="any" default="nil">Can either be a boolean to ignore the prediction filter or a <page>CRecipientFilter</page>. Set this to true if you wish to call this function in multiplayer from server.</arg> </args> </function> <example> <description>Creates a HelicopterMegaBomb effect at the origin of the map. ( 0, 0, 0 )</description> <code> local vPoint = Vector( 0, 0, 0 ) local effectdata = EffectData() effectdata:SetOrigin( vPoint ) util.Effect( "HelicopterMegaBomb", effectdata ) </code> </example>