Problem with [set_extra_recruit]

The place to post your WML questions and answers.

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.
Post Reply
User avatar
pipapopinguin
Posts: 35
Joined: November 3rd, 2019, 10:36 am

Problem with [set_extra_recruit]

Post by pipapopinguin »

Code: Select all

[event]
name=moveto
first_time_only=no
    [filter]
	    side=$side_number
	    [filter_location]
		    x=26,25
			y=11,11
		[/filter_location]
	[/filter]
	[store_side]
		[filter_side]
			side=$side_number
		[/filter_side]
		variable=current_side_variable
	[/store_side]
	[disallow_recruit]
	       [filter_side]
			side=$side_number
		[/filter_side]
	[/disallow_recruit]
	[allow_extra_recruit]
	    [filter]
		    side=$side_number
		    canrecruit=yes
			[not]
			    [filter_location]
		                   x=26,25
		         	    y=11,11
		             [/filter_location]
			[/not]
		[/filter]
		extra_recruit=$current_side_variable.recruit
	[/allow_extra_recruit]
    [switch]
	    variable=x1
		[case]
		    value=26
			[set_extra_recruit]
					        [filter]
						    x,y=$x1,$y1
						[/filter]
						extra_recruit=Drake Fighter
			[/set_extra_recruit]
		[/case]
		[case]
		    value=25
			[set_extra_recruit]
					        [filter]
						    x,y=$x1,$y1
					        [/filter]
						extra_recruit=Drake Glider
			[/set_extra_recruit]
		[/case]
		[else]
		[message]
		message=bruh tf
		[/message]
		[/else]
	[/switch]
[/event]
This code will not give my unit standing at x,y=$x1,$y1 recruitment for Drake Gliders or Drake Fighters and keep normal recruitment for my other canrecruit unit. Instead, this code gives both of my units the drake glider or fighter units, but also make the unit actually not associated with the event not being able to recruit any of my normal recruitment pool. Sorry for some lines being messed up i copied it out of my notepad++ and it didnt seem to like that. I would like to see what is wrong with the code or even if there is a bug/lesser known feature with canrecruit units.
Author of Corpse Mod 2, Breeze-Mod,Reflections and don't click here.
User avatar
WhiteWolf
Forum Moderator
Posts: 769
Joined: September 22nd, 2009, 7:48 pm
Location: Hungary

Re: Problem with [set_extra_recruit]

Post by WhiteWolf »

Don't use an explicit [filter] tag inside [set_extra_recruit]. It takes the standard unit filter keys directly as arguments. https://wiki.wesnoth.org/DirectActionsW ... recruit.5D
Main UMC campaigns: The Ravagers - now for 1.16, with new bugs!
Old UMC works: The Underness Series, consisting of 5 parts: The Desolation of Karlag, The Blind Sentinel, The Stone of the North, The Invasion Of The Western Cavalry, Fingerbone of Destiny
Post Reply