diff --git a/changelog.md b/changelog.md index 4c16bc9cda32..1d402c91a41b 100644 --- a/changelog.md +++ b/changelog.md @@ -23,6 +23,7 @@ ### WML engine * Support formula= key in [variable] ConditionalWML * Support to_location in [move_unit], taking a location ID + * Support location_id in [teleport] for the target location * Support [filter_weapon] in leadership and resistance abilities, which activates the ability only when the affected unit is using a matching weapon. diff --git a/data/lua/wml-tags.lua b/data/lua/wml-tags.lua index 4916699f27cd..aa2455649fc7 100644 --- a/data/lua/wml-tags.lua +++ b/data/lua/wml-tags.lua @@ -866,6 +866,10 @@ wml_actions.teleport = function(cfg) -- No error if no unit matches. return end + local x,y = cfg.x, cfg.y + if not x or not y then + x,y = wesnoth.special_locations[cfg.location_id] + end wesnoth.teleport(unit, cfg.x, cfg.y, cfg.check_passability == false, cfg.clear_shroud ~= false, cfg.animate) end