Quantcast
Channel: The Battle for Wesnoth Forums
Viewing all articles
Browse latest Browse all 2132

Lua Labs • Teleport Function

$
0
0
About the [teleport] function.

Code:

wml_actions.teleport = function(cfg)local context = wesnoth.current.event_contextlocal filter = wml.get_child(cfg, "filter") or { x = context.x1, y = context.y1 }local unit = wesnoth.units.find_on_map(filter)[1]if not unit then-- No error if no unit matches.returnendlocal x,y = cfg.x, cfg.yif cfg.location_id thenx,y = table.unpack(wesnoth.current.map.special_locations[cfg.location_id])endunit:teleport(x, y, cfg.check_passability == false, cfg.clear_shroud ~= false, cfg.animate)end
I believe this is the code of the teleport tag.

Would anyone here be able to create a teleport code that could teleport more than one unit at the same time? Similar to the [animate_unit] tag, where we can animate multiple units at once using [animate].

Is it possible? :hmm:

Statistics: Posted by Saizo-Luz — Yesterday, 11:05 pm



Viewing all articles
Browse latest Browse all 2132

Trending Articles