Page tree
Skip to end of metadata
Go to start of metadata

Introduced in




Controls the frequency and location of lightning strikes.

Normal lightning happens if the Overcast scenario setting (see Define Scenario Settings in the VBS3 Editor Manual) is higher than 0.9, at random locations and intervals. When using the command, the Overcast setting is irrelevant, and lightning strikes can occur in any weather. The specified strike position is not where the lighting strikes, but where it originates in the sky. The actual strike position is offset by a certain distance, depending on the specified elevation, and also depending on the position of the player. For the closest strike position, an elevation of 0 should be specified. An elevation of more than 300m causes the strike to become invisible from the ground. Strikes are only visible, if the player looks upwards. While looking downwards, the strike effect becomes invisible.


Syntax:setLightning [interval, position, strength]
  • interval: Number - Delay (in seconds) between strikes. If set to -1, then normal, random lightning is re-enabled.
  • position: Position3D - Origin of strike (see description for details).
  • strength: Boolean - If true, then a larger, more branched strike occurs.
Return Value:Nothing


setLightning [10, getPos player, true];

Additional Information

See also: setRain, setOvercast