setGrainLevel
Client-side
Server-side
Shared
Manual Review Required
Please finish this page using the corresponding Old Wiki article. Go to Contribution guidelines for more information.
This function sets a level of the overlay grain effect. The game will draw it on top of other grain effects. It can be used to imitate an effect of radiation or electromagnetic disturbances, for example.
Syntax
bool setGrainLevel ( int level )Required Arguments
- level: The amount of grain (0-255).
Returns
- bool: value
Returns true if the grain level was set, false otherwise.
Code Examples
shared
This example creates a radioactive zone at Missionary Hills:
setTimer( function() local zx, zy, zz = -2405.49268, -599.97339, 132.64844 -- Zone position local radius = 20 -- Zone radius
local x, y, z = getElementPosition( localPlayer ) local dist = getDistanceBetweenPoints3D( x, y, z, zx, zy, zz ) local intensity = math.max( radius - dist, 0 ) / radius
setGrainLevel( intensity * 255 )end, 100, 0 )See Also
World Functions
- areTrafficLightsLocked
- createSWATRope
- getAircraftMaxHeight
- getAircraftMaxVelocity
- getBirdsEnabled
- getCloudsEnabled
- getColorFilter
- getCoronaReflectionsEnabled
- getFarClipDistance
- getFogDistance
- getGameSpeed
- getGarageBoundingBox
- getGaragePosition
- getGarageSize
- getGravity
- getGroundPosition
- getHeatHaze
- getInteriorFurnitureEnabled
- getInteriorSoundsEnabled
- getJetpackMaxHeight
- getJetpackWeaponEnabled
- getMinuteDuration
- getMoonSize
- getNearClipDistance
- getOcclusionsEnabled
- getPedsLODDistance
- getRainLevel
- getRoofPosition
- getScreenFromWorldPosition
- getSkyGradient
- getSunColor
- getSunSize
- getTime
- getTrafficLightState
- getVehiclesLODDistance
- getWeather
- getWindVelocity
- getWorldFromScreenPosition
- getWorldProperty
- getZoneName
- isAmbientSoundEnabled
- isGarageOpen
- isLineOfSightClear
- isTimeFrozen
- isVolumetricShadowsEnabled
- isWorldSoundEnabled
- isWorldSpecialPropertyEnabled
- processLineAgainstMesh
- processLineOfSight
- removeGameWorld
- removeWorldModel
- resetAmbientSounds
- resetBlurLevel
- resetColorFilter
- resetCoronaReflectionsEnabled
- resetFarClipDistance
- resetFogDistance
- resetHeatHaze
- resetMoonSize
- resetNearClipDistance
- resetPedsLODDistance
- resetRainLevel
- resetSkyGradient
- resetSunColor
- resetSunSize
- resetTimeFrozen
- resetVehiclesLODDistance
- resetVolumetricShadows
- resetWindVelocity
- resetWorldProperties
- resetWorldProperty
- resetWorldSounds
- restoreAllWorldModels
- restoreGameWorld
- restoreWorldModel
- setAircraftMaxHeight
- setAircraftMaxVelocity
- setAmbientSoundEnabled
- setBirdsEnabled
- setCloudsEnabled
- setColorFilter
- setCoronaReflectionsEnabled
- setFarClipDistance
- setFogDistance
- setGameSpeed
- setGarageOpen
- setGrainLevel
- setGrainMultiplier
- setGravity
- setHeatHaze
- setInteriorFurnitureEnabled
- setInteriorSoundsEnabled
- setJetpackMaxHeight
- setJetpackWeaponEnabled
- setMinuteDuration
- setMoonSize
- setNearClipDistance
- setOcclusionsEnabled
- setPedsLODDistance
- setRainLevel
- setSkyGradient
- setSunColor
- setSunSize
- setTime
- setTimeFrozen
- setTrafficLightsLocked
- setTrafficLightState
- setVehiclesLODDistance
- setVolumetricShadowsEnabled
- setWeather
- setWeatherBlended
- setWindVelocity
- setWorldProperty
- setWorldSoundEnabled
- setWorldSpecialPropertyEnabled
- testLineAgainstWater
- testSphereAgainstWorld