Attacks in units
Moderator: Forum Moderators
Forum rules
- Please use [code] BBCode tags in your posts for embedding WML snippets.
- To keep your code readable so that others can easily help you, make sure to indent it following our conventions.
- pyrophorus
- Posts: 533
- Joined: December 1st, 2010, 12:54 pm
Attacks in units
Hi !
In unit_type, there is an 'attacks' key which specifies how much time the unit can attack per turn.
In an actual unit, this key is unknown (i.e. modifying 'unit.attacks' fails but reading it succeed).
I'm puzzled with this. How to change attacks number of a particular unit ? Which relationship exists within attacks in unit_type and max_attacks in unit data ?
Thanks in advance,
In unit_type, there is an 'attacks' key which specifies how much time the unit can attack per turn.
In an actual unit, this key is unknown (i.e. modifying 'unit.attacks' fails but reading it succeed).
I'm puzzled with this. How to change attacks number of a particular unit ? Which relationship exists within attacks in unit_type and max_attacks in unit data ?
Thanks in advance,
HowTos: WML filtering, WML variables
Re: Attacks in units
Use max_attacks=2 or something like that in the [unit_type] tag.
Re: Attacks in units
I believe that [unit_type]attacks= becomes $unit.max_attacks. Then $unit.attacks_left goes from $unit.max_attacks down to zero. This is like how [unit_type]hitpoints= becomes $unit.max_hitpoints, and how $unit.hitpoints goes from $unit.max_hitpoints down to zero.
SingleUnitWML is missing documentation for $unit.attacks_left.
SingleUnitWML is missing documentation for $unit.attacks_left.
--Kernigh http://www.wesnoth.org/wiki/User:Kernigh
- Elvish_Hunter
- Posts: 1576
- Joined: September 4th, 2009, 2:39 pm
- Location: Lintanir Forest...
Re: Attacks in units
What Kernigh says is right. In [unit_type], you can put attacks=2, or even attacks=10, if you want.
Once that you create (not if you recruit or recall it, as usual) a unit of that kind, it'll have its variables $attacks_left and $max_attacks equal to 2 (or 10, or any other value that you choose). At the start of every turn, $attacks_left will be replenished to equal $max_attacks.
At this point, it will be nice to have EffectWML supporting an apply_to=attacks key (as well as an apply_to=halo, but that's another story), with a structure like this:
Once that you create (not if you recruit or recall it, as usual) a unit of that kind, it'll have its variables $attacks_left and $max_attacks equal to 2 (or 10, or any other value that you choose). At the start of every turn, $attacks_left will be replenished to equal $max_attacks.
Fixed.Kernigh wrote:I believe that [unit_type]attacks= becomes $unit.max_attacks. Then $unit.attacks_left goes from $unit.max_attacks down to zero. This is like how [unit_type]hitpoints= becomes $unit.max_hitpoints, and how $unit.hitpoints goes from $unit.max_hitpoints down to zero.SingleUnitWML is missing documentation for $unit.attacks_left.
At this point, it will be nice to have EffectWML supporting an apply_to=attacks key (as well as an apply_to=halo, but that's another story), with a structure like this:
What's your opinion?attacks: modifies the unit's number of time that it can attack per turn.
increase: maximum attacks number is increased by this amount. It can be positive, negative, or specified as a percentage.
set: maximum attacks number is set to a specific value.
Current maintainer of these add-ons, all on 1.16:
The Sojournings of Grog, Children of Dragons, A Rough Life, Wesnoth Lua Pack, The White Troll (co-author)
The Sojournings of Grog, Children of Dragons, A Rough Life, Wesnoth Lua Pack, The White Troll (co-author)
- pyrophorus
- Posts: 533
- Joined: December 1st, 2010, 12:54 pm
Re: Attacks in units
Hi,
Thanks for your replies !
My opinion is EffectWML should have the same features as [modify_unit]. I will not say if it should be done allowing [modify_unit] inside [effect], but something of the like would be handy. For now, it is not easy to modify an unit in custom advance, except of course, what is already available in 'apply_to'.
Friendly,
Thanks for your replies !
My opinion is EffectWML should have the same features as [modify_unit]. I will not say if it should be done allowing [modify_unit] inside [effect], but something of the like would be handy. For now, it is not easy to modify an unit in custom advance, except of course, what is already available in 'apply_to'.
Friendly,
HowTos: WML filtering, WML variables