Side.faction not registering in conditional

The place to post your WML questions and answers.

Moderators: Forum Moderators, Developers

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
GreenKnight
Posts: 2
Joined: April 7th, 2020, 4:03 am

Side.faction not registering in conditional

Post by GreenKnight »

Hi there,

I'm having some trouble getting a new function to work in multiplayer. Essentially I want to make it so as the leader advances, he can recruit higher level troops.
LEVELED_RECRUIT_LIST_TRIBE is a macro to add the required units to the recruitment list, however I am having trouble determining which list of units to add.

The $UpgradeSide.faction successfully returns ElvesIE, however it does not evaluate truy in the if statement. When I run it, it always jumps to "No matchElvesIE".

I have also tried using the Switch conditional, and Contains in the variavle tag to no effect.

As far as I can see they are both identical strings and so should compare correctly?

Code: Select all

[event]
		name=post advance
		first_time_only=no
		[filter]
			canrecruit=yes
			side=$unit.side
		[/filter]
		[store_side]
			side=$unit.side
			variable=UpgradeSide
		[/store_side]
		[if]
			[variable]
				name=$UpgradeSide.faction
				equals="ElvesIE"
			[/variable]
			[then]
				{LEVELED_RECRUIT_LIST_TRIBE $unit.level $unit.side}
			[/then]
			[else]
				[message]
					message="No match" + $UpgradeSide.faction
				[/message]
			[/else]
		[/if]	
	[/event]



Any help would be greatly appreciated.

User avatar
Pentarctagon
Project Manager
Posts: 4368
Joined: March 22nd, 2009, 10:50 pm
Location: Earth (occasionally)

Re: Side.faction not registering in conditional

Post by Pentarctagon »

name=$UpgradeSide.faction shouldn't have the $.
99 little bugs in the code, 99 little bugs
take one down, patch it around
-2,147,483,648 little bugs in the code

GreenKnight
Posts: 2
Joined: April 7th, 2020, 4:03 am

Re: Side.faction not registering in conditional

Post by GreenKnight »

Perfect, that worked! I knew there had to be some silly error I was missing.

Thank you very much :)

Post Reply