field_animations.lua¶
This script contains some animations to reveal and hide fields seen by a player. This functions are currently used in the campaigns and scenarios to tell the prologue to a story.
include "scripting/field_animations.lua"
- reveal_randomly(player, region, time)¶
Reveal a given region field by field, where the fields are chosen randomly. The region will be hidden before being revealed. The animation runs the specified time.
- Parameters
player (
wl.game.Player
) – The player who gets sight to the regionregion (
array
offields
) – The region that has to be revealed. E.g. by usingwl.map.Field.region()
time (
integer
) – Optional. The time the whole animation will run. Defaults to 1000 (1 sec)hide (
boolean
) – Optional, iffalse
automatic hiding is disabled
- hide_randomly(player, region, time[, permanent=false])¶
Hide a given region field by field, where the fields are chosen randomly. The animation runs the specified time regardless how big the given region is. So region(6) and region(13) will take the same time.
- Parameters
player (
wl.game.Player
) – The player whose sight gets hiddenregion (
array
offields
) – The region that will be hidden. E.g. by usingwl.map.Field.region()
time (
integer
) – Optional. The time the whole animation will run. Defaults to 1000 (1 sec)permanent (
boolean
) – Optional. Set totrue
to hide the fields permanently (they can’t be seen by any unit until revealed again by using :meth: ~wl.game.Player.reveal_fields). Set tofalse
to make the fields unexplored (they can be rediscovered by buildings and bobs again). Defaults tofalse
.
- reveal_concentric(player, center, max_radius, hide, delay)¶
Reveal a part of the map in a concentric way beginning from center onto max_radius. The region get hidden prior revealing as default.
- Parameters
player (
wl.game.Player
) – The player who gets sight to the regioncenter (
wl.map.Field
) – The field from where the animation should start revealingmax_radius (
integer
) – The last ring to revealhide (
boolean
) – Optional, iffalse
automatic hiding is disableddelay (
integer
) – Optional, defaults to 100. The delay between revealing each ring. If you want to set the delay, you must also set hide
- hide_concentric(player, center, max_radius, delay[, permanent=false])¶
Hide a part of the map in a concentric way beginning from max_radius onto center.
- Parameters
player (
wl.game.Player
) – The player whose sight gets hiddencenter (
wl.map.Field
) – The field where the animation should end hidingmax_radius (
integer
) – The first ring to hidedelay – Optional, defaults to 100. The delay between revealing each ring
permanent (
boolean
) – Optional. Set totrue
to hide the fields permanently (they can’t be seen by any unit until revealed again by using :meth: ~wl.game.Player.reveal_fields). Set tofalse
to make the fields unexplored (they can be rediscovered by buildings and bobs again). Defaults tofalse
.
- get_sees_fields(player)¶
Gather all fields a player can see in the current view. The current view is the whole area of the map in the current game window. You can use this function to get an unregular (non hexagonal) region and feed e.g.
reveal_randomly()
with it.- Parameters
player (
wl.game.Player
) – The player for whom the fields get gathered- Returns
A table containing all visible fields in the current view