Does {MODIFY_UNIT (type=whatever) canrecruit yes} work?
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.
-
- Posts: 9
- Joined: November 22nd, 2013, 5:57 pm
Does {MODIFY_UNIT (type=whatever) canrecruit yes} work?
Here's what I'm trying to do:
In plain English, whenever any unit advances to an Elvish Lord, I want that Elvish Lord to gain the canrecruit=yes property. (I'm settling for ALL Elvish Lords gaining the canrecruit=yes property; I'm not picky.)
I appear to be doing it wrong, though. Right now, whenever a unit advances to an Elvish Lord, exactly zero Elvish Lords gain the canrecruit=yes property.
I've also tried:
Which also doesn't work.
Halp?
Code: Select all
[event]
name=post advance
{MODIFY_UNIT (type=Elvish Lord) canrecruit yes}
[/event]
I appear to be doing it wrong, though. Right now, whenever a unit advances to an Elvish Lord, exactly zero Elvish Lords gain the canrecruit=yes property.
I've also tried:
Code: Select all
[event]
name=post advance
first_time_only=no
[filter]
type=Elvish Lord
[/filter]
[modify_unit]
[filter]
type=Elvish Lord
[/filter]
canrecruit=yes
[/modify_unit]
[/event]
Halp?
Re: Does {MODIFY_UNIT (type=whatever) canrecruit yes} work?
The first sample will work exactly once (because
Tested successfully with an Elvish Archer → Ranger level-up sequence.
So, where (file and parent tag) are you placing this code that currently doesn’t work?
first_time_only=no
isn’t specified and alter all Elvish Lords on the map, which is inefficient and pointless as odds are that they already have canrecruit=yes
once their number is not singular. The second sample should work correctly but it’s also going to modify all Elvish Lords on the map. A more efficient filter for the action should be x,y=$x1,$y1
, which will match the location of the primary unit for which the event was triggered:Code: Select all
[event]
name=post advance
first_time_only=no
[filter]
type=Elvish Lord
[/filter]
[modify_unit]
[filter]
x,y=$x1,$y1
[/filter]
canrecruit=yes
[/modify_unit]
[/event]
So, where (file and parent tag) are you placing this code that currently doesn’t work?
Author of the unofficial UtBS sequels Invasion from the Unknown and After the Storm (now available for Wesnoth 1.14.x and 1.15.4+).
-
- Posts: 9
- Joined: November 22nd, 2013, 5:57 pm
Re: Does {MODIFY_UNIT (type=whatever) canrecruit yes} work?
Awesome, thank you!shadowm wrote:The first sample will work exactly once (becausefirst_time_only=no
isn’t specified and alter all Elvish Lords on the map, which is inefficient and pointless as odds are that they already havecanrecruit=yes
once their number is not singular. The second sample should work correctly but it’s also going to modify all Elvish Lords on the map. A more efficient filter for the action should bex,y=$x1,$y1
, which will match the location of the primary unit for which the event was triggered:
... outside of the [unit_type] block, instead of inside it, like a dummy. Putting it inside the [unit_type] block like I THOUGHT I was doing fixes it, and changing the filter to x,y=$x1,$y1 makes it much more efficient.So, where (file and parent tag) are you placing this code that currently doesn’t work?
Thank you so much!