Lifting fog around units with custom status

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
Nyanyanyan
Posts: 73
Joined: May 11th, 2018, 10:40 pm

Lifting fog around units with custom status

Post by Nyanyanyan »

I'm trying to code a possession ability and for that I need to grant vision around a unit to a side that doesn't control that unit.
For some reason the code I've written doesn't work though.
I would be happy if someone could tell me what I did wrong.

Code: Select all

				
				[event]
					delayed_variable_substitution=no
					name=turn refresh
					id=possessionliftfog$possessionvar.side
					first_time_only=no
					[lift_fog]
					multiturn=yes
					[filter_side]
					side=$possessionvar.side
					[/filter_side]
					[filter]
						status=possessedby$possessionvar.side
					[/filter]
					radius=6
					[/lift_fog]
				[/event]


This is a nested event, hence the delayed_variable_substitution=no. The unit array is cleared after the event, but using :inspect I checked the event and it does indeed keep the inserted numbers, so this code in game would be the following if side 1 had used the ability.

Code: Select all

				
				[event]
					delayed_variable_substitution=no
					name=turn refresh
					id=possessionliftfog1
					first_time_only=no
					[lift_fog]
					multiturn=yes
					[filter_side]
					side=1
					[/filter_side]
					[filter]
						status=possessedby1
					[/filter]
					radius=6
					[/lift_fog]
				[/event]


I also tried adding a [filter_location] tag around the location filters, but that didn't work either.

Any help is appreciated.
Author of Age of Lords and the Revolution and Civil War and Expendable Leaders 2 multiplayer mods.
User avatar
WhiteWolf
Forum Moderator
Posts: 769
Joined: September 22nd, 2009, 7:48 pm
Location: Hungary

Re: Lifting fog around units with custom status

Post by WhiteWolf »

Are you sure you don't want delayed_variable_substitution=yes? By setting it to no, $possessionvar.side is evaluated at the creation of the event (trigger of partent event), but unless I'm wrong, here you want it to be evaluated when the event is actually triggered. That would mean setting it to yes.
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
User avatar
Nyanyanyan
Posts: 73
Joined: May 11th, 2018, 10:40 pm

Re: Lifting fog around units with custom status

Post by Nyanyanyan »

WhiteWolf wrote: November 18th, 2020, 9:24 am Are you sure you don't want delayed_variable_substitution=yes? By setting it to no, $possessionvar.side is evaluated at the creation of the event (trigger of partent event), but unless I'm wrong, here you want it to be evaluated when the event is actually triggered. That would mean setting it to yes.
No, I do actually want it to substitute when the event is created, since the variables are cleared at the end of the creating event.
The posessedby1 status and the turn refresh event persist after that, so putting dvs=yes would break my code even further, if I understand dvs correctly since there'd be nothing to substitute.
Author of Age of Lords and the Revolution and Civil War and Expendable Leaders 2 multiplayer mods.
User avatar
Nyanyanyan
Posts: 73
Joined: May 11th, 2018, 10:40 pm

Re: Lifting fog around units with custom status

Post by Nyanyanyan »

Apparently I did not correctly save before adding the multiturn=yes. Just lifting the fog at turn refresh apparently is not working since it is recalculated at a slightly later point and thus not displayed at all. I now tested it again and it works as intended.
Author of Age of Lords and the Revolution and Civil War and Expendable Leaders 2 multiplayer mods.
Post Reply