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

WML Workshop • Re: check_passability for [modify_unit]?

$
0
0
While I can kind of understand that [modify_unit], [teleport], and [move_unit] have some overlaps in what they do, they are basically three different things. (Although, [move_unit] is technically redundant; more on that in a moment.)
  • [modify_unit] modifies the unit's stats and variables.
  • [teleport] moves the unit to another location.
  • [move_unit] is a redundant wrapper that combines [move_unit_fake] with [teleport].
  • [move_unit_fake] plays a movement animation across a specified series of hexes.
So, in essence, the entire point of [move_unit] is to animate a unit moving to another tile (and actually move it to that tile as well). Therefore, it's obviously not what you need here. Although [modify_unit] can also move the unit, that's not really its purpose – it's kind of more of a side-effect of how it's implemented. (Although, I don't expect that the ability would ever be removed even if the implementation changes, as I'm sure people depend on it.) Therefore, [teleport] is the correct answer.

But as you've noticed, it doesn't support moving multiple units in a batch. Unfortunately, there's nothing you can do about that within the confines of WML – you'll have to loop and teleport them one-by-one, as you've noticed. If you can stomach a little Lua though, it's not that hard to make a version of [teleport] that can handle multiple units. In essence, the loops you were describing end up inside the tag's implementation, instead of in your WML.

About [modify_unit] implementing passability checks, I agree that there's no good reason to do this. [unstore_unit] implements them for the same reason that [unit] does – it's spawning a brand-new unit on the map. But [modify_unit] is modifying a unit in-place on the map. Other than exotic cases where you modify the unit's movement costs (or its location), it's not going to end up on an impassable space all of a sudden. And if you're in one of those more exotic cases, it can't be that hard to do the check yourself manually… or in the movement case, use [teleport].

Statistics: Posted by Celtic_Minstrel — Today, 3:35 am



Viewing all articles
Browse latest Browse all 1158

Trending Articles