How to uncover fog/shroud during [move_unit]

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
yonightmare
Posts: 12
Joined: May 4th, 2015, 11:38 pm

How to uncover fog/shroud during [move_unit]

Post by yonightmare »

So in my scenario that I'm creating, I'm at the beginning with a cutscene. So, my one Paladin should be able to move through the shroud or fog (preferably both) and uncover the shroud or fog to the number of hexes as is their sight range. I am aware that there is a tag called [redraw] for this, but I am not sure how to really use it. I checked the wiki's but it could not explain it to me. If you could fix mine or give me an example of how it could work I would appreciate it. Thanks.
This is my full code in case it helps
Spoiler:
This is where I define side 1 (my side)

Code: Select all

	[side]
		side=1
		controller=human
##		fog=yes
		shroud=yes
		team_name="good"
		user_team_name= _ "My Team"
		id= _ "MyLeader"
		name= _ "RJ"
		type="Grand Marshal"
		unrenamable=yes
		canrecruit=yes
		recruit="Spearman, Cavalryman, Dragoon, Fencer, Duelist, Heavy Infantryman, Shock Trooper, Horseman, Knight, Lancer, Mage, Red Mage, White Mage, Bowman, Longbowman, Javelineer, Peasant, Pikeman, Swordsman, Sergeant, Lieutenant, Woodsman"
		gold=500
	[/side]
And here is where I want to walk and talk and perform some cutscene actions:

Code: Select all

[move_unit]
			id = Lieutenant
			hexes = 20
			delay_shroud = yes
			from_x, from_y = 5,5
			to_x, to_y = 125,36
			check_passability = yes
			force_scroll = yes
			[redraw]
				clear_shroud=yes
				side=1
			[/redraw]
		[/move_unit]
		[message]
            		speaker=Watchman
            		message= _ "Halt, who goes there? "
        	[/message]
		[message]
            		speaker=Lieutenant
            		message= _ "I am Lieutenant Flavian, of The Prestigious. I speak on behalf of King RJ. I wish to speak with King Crentle"
        	[/message]
		[message]
            		speaker=Watchman
            		message= _ "You may enter. He's in his castle"
        	[/message]
		[move_unit]
			id = Lieutenant
			hexes = 5
			delay_shroud = no
			from_x, from_y = 125,36
			to_x, to_y = 131,39
			check_passability = yes
			force_scroll = yes
		[/move_unit]
		[message]
            		speaker=Lieutenant
            		message= _ "King Crentle. I came on behalf of King-"
        	[/message]
		[message]
            		speaker=ally
            		message= _ "I anticipated your arrival. And yes, I am well aware of the threat. We will join you in war to our best ability, but- we have been defeated many times before. and are weak. Nonetheless, we will spare all of our resources."
        	[/message]
		[message]
            		speaker=Lieutenant
            		message= _ "Thank you, King Crentle, I will inform King RJ."
        	[/message]
		[move_unit]
			id = Lieutenant
			hexes = 20
			delay_shroud = no
			from_x, from_y = 131,39
			to_x, to_y = 5,5
			check_passability = yes
			force_scroll = yes
		[/move_unit]
So, restating, how does the redraw tag work. Thanks
User avatar
beetlenaut
Developer
Posts: 2825
Joined: December 8th, 2007, 3:21 am
Location: Washington State
Contact:

Re: How to uncover fog/shroud during [move_unit]

Post by beetlenaut »

You can't [redraw] during [move_unit], so it will only recalculate the shroud at the end. This is the workaround I used:

Code: Select all

#define MOVE_AND_UNSHROUD X Y
    [move_unit]
        id=Ardonna
        to_x, to_y={X},{Y}
    [/move_unit]
    [redraw]
        remove_shroud=yes
        side=1
    [/redraw]
#enddef

[event]
    ...
    {MOVE_AND_UNSHROUD 2 4}
    {MOVE_AND_UNSHROUD 3 5}
    {MOVE_AND_UNSHROUD 4 5}
    ...
[/event]
I move my unit a little at a time. If your unit has a long way to go, you could use a loop, but this is the basic idea.

BTW, You will have more success if you stop inventing your own WML. The wiki lists everything that is available inside of each tag. For [move_unit], it doesn't list hexes, from_x, from_y, delay_shroud, or [redraw], so those won't do a thing. I didn't check the rest of your code to see if you do it in other places, but don't. :eng:
Campaigns: Dead Water,
The Founding of Borstep,
Secrets of the Ancients,
and WML Guide
yonightmare
Posts: 12
Joined: May 4th, 2015, 11:38 pm

Re: How to uncover fog/shroud during [move_unit]

Post by yonightmare »

Thank you very much. Also, after I played with what you gave me, I was able to do this. A similar problem has occurred, however, and I believe it is a simple error (because as of now I am working on learning the definitions (macros)). So, all I want is for a side number that is inputted when calling the definition to add fog.
To try to do this, I made this short thing:

Code: Select all

#define FOG_SIDE Z
[modify_side]
	side=Z
	fog=yes
[/modify_side]
[redraw]
   remove_shroud=yes
   side=Z
[/redraw]
#enddef
[event]
   {FOG_SIDE 1}
[/event]
It seems pretty simple and I believe the problem would have to do with where I call it, using the number 1 to be passed on to variable Z. What I was trying to do was to use this definition as used before (from what was given in the comment above) to input the grid numbers, only this time using sides
User avatar
Ravana
Forum Moderator
Posts: 3002
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: How to uncover fog/shroud during [move_unit]

Post by Ravana »

Code: Select all

#define FOG_SIDE Z
[modify_side]
   side={Z}
   fog=yes
[/modify_side]
[redraw]
   remove_shroud=yes
   side={Z}
[/redraw]
#enddef
Notice {Z} there.

Also, event without name will not be fired.
Post Reply