Unit movement animation problem
Moderator: Forum Moderators
- ZombieKnight
- Posts: 371
- Joined: June 27th, 2022, 2:26 pm
- Location: Czech Republic
Unit movement animation problem
Hey, I'd like to animate two units, switching their places, in standart time rate, (which is 200ms)
This code almost works, except the
How to animate units changing places properly?
This code almost works, except the
animator:add(u, "movement", "hit",{with_bars = false})
part takes 500ms (because some units do have longer animation, which is played over more tiles), resulting in the saurian visually teleporting back 2 times.How to animate units changing places properly?
Code: Select all
animator:add(u, "pre_movement", "hit",{with_bars = false})
animator:add(u2, "pre_movement", "hit",{with_bars = false})
animator:run()
animator:clear()
animator:add(u, "movement", "hit",{with_bars = false})
animator:add(u2, "movement", "hit",{with_bars = false})
animator:run()
animator:clear()
local loc = u.loc
local loc2 = u2.loc
u:extract()
u2.loc = loc
u.loc = loc2
u:to_map()
wesnoth.wml_actions.redraw({clear_shroud=true})
animator:add(u, "post_movement", "hit",{with_bars = false})
animator:add(u2, "post_movement", "hit",{with_bars = false})
animator:run()
animator:clear()
- Celtic_Minstrel
- Developer
- Posts: 2371
- Joined: August 3rd, 2012, 11:26 pm
- Location: Canada
- Contact:
Re: Unit movement animation problem
Sadly, this is unsupported. Even #9487 wouldn't enable what you want. Maybe you can get the desired effect via some complicated workaround but I'm not sure how you'd go about that.
- ZombieKnight
- Posts: 371
- Joined: June 27th, 2022, 2:26 pm
- Location: Czech Republic
Re: Unit movement animation problem
I don't see why resolving one unit weird movement animation, wouldn't resolve two unit animations? (The greatest feature of Lua animator is that it can animate more things at once)Celtic_Minstrel wrote: ↑April 23rd, 2025, 2:58 am Sadly, this is unsupported. Even #9487 wouldn't enable what you want. Maybe you can get the desired effect via some complicated workaround but I'm not sure how you'd go about that.
I want to do lots of things with the synchronized move animation, like improved [move_units_fake] which currently looks terrible, moving one unit at a time for bigger numbers of units...
So perhaps it could be solved before 1.20, in a way it resolves both issue reported in by Ravana and the more complex form of the issue.