[Lock_View] Usage

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
Sire
Posts: 158
Joined: April 6th, 2012, 11:03 pm
Location: USA

[Lock_View] Usage

Post by Sire »

Trying to get back into Wesnoth and tinkering away at various projects.

So, I'm trying to lock the camera in place while a "cutscene" plays. However, attempting to use [lock_view] simply skips over the entire cutscene. The following is an except of the event, but the full file is attached if you want to see the full thing.

What am I doing wrong?

Code: Select all

	[scroll_to]
	x,y=30,38
	[/scroll_to]
	[lock_view]
	
	{MOVE_UNIT (id=Tudok) 28 38}

	[message]
	speaker=Tudok
	message = _ "Milord, the two enemy armies have arrived. Crossroads Keep has been taken by Covos while Nightfall Keep was captured by Rhade. They seem to be regrouping for another push forward."
	[/message]

	[message]
	speaker=Mycen
	message = _ "I see. The front line must hold out long enough for our reinforcements to arrive. Then we can begin a fighting retreat back to Winterfell and hope we can outlast their onslaught."
	[/message]

	[message]
	speaker=Sire
	message = _ "...and there were many more messages cut out for the sake of time and space."
	[/message]

	{MOVE_UNIT (id=Lann) 30 37}
	{FLASH_WHITE ({TELEPORT_UNIT (id=Syris) 31 38})}

	[message]
	speaker=Syris
	message = _ "Sir, I regret to inform you that Orcs have been spotted near the Eternal Valley. While we have dealt with their scouts, I expect a larger force to be arriving in about two days."
	[/message]

	{MOVE_UNIT (id=Denvan) 31 39}	
	
	[message]
	speaker=Denvan
	message = _ "Baron Mycen. Greetings. I am Denvan of the Nighthawks. If you would have us, we would like to join your cause."
	[/message]	

{LOYAL_UNIT 1 (Outlaw) 32 38}
{LOYAL_UNIT 1 (Bandit) 32 39}
{LOYAL_UNIT 1 (Rogue) 31 40}
	
	[message]
	speaker=Mycen
	message = _ "For Winterfell! For Esteria! Forward!"
	[/message]

	[/lock_view]	
	[unlock_view]
	[/unlock_view]

Attachments
01_Red_Winter.cfg
(46.94 KiB) Downloaded 161 times
Current Projects: [Sire's Scenarios] || [Red Winter Reborn]
User avatar
Pentarctagon
Project Manager
Posts: 5531
Joined: March 22nd, 2009, 10:50 pm
Location: Earth (occasionally)

Re: [Lock_View] Usage

Post by Pentarctagon »

Have you tried doing just [lock_view][/lock_view], instead of putting the contents of your cutscene inside the [lock_view]? My guess would be that [lock_view] takes no subtags, and so everything inside [lock_view] in your code snippet is just ignored.
99 little bugs in the code, 99 little bugs
take one down, patch it around
-2,147,483,648 little bugs in the code
User avatar
Sire
Posts: 158
Joined: April 6th, 2012, 11:03 pm
Location: USA

Re: [Lock_View] Usage

Post by Sire »

Placing the [lock_view][/lock_view] next to each other does not work. The camera remains unlocked and the game tracks unit movements instead of staying in the "cutscene area."
Current Projects: [Sire's Scenarios] || [Red Winter Reborn]
User avatar
WhiteWolf
Forum Moderator
Posts: 769
Joined: September 22nd, 2009, 7:48 pm
Location: Hungary

Re: [Lock_View] Usage

Post by WhiteWolf »

That is how it works though, as Pentarctagon said, you should place the opening and closing tags of lock_view next to each other, without subtags, and the actions should follow then.

According to the wiki, it only restricts camera movements from the player, so the game will still track unit movements by WML, explicit scroll_to's and stuff like that. I didn't look into your scenario in depth, but my suggestion is that if you're moving units that are off-screen from where you want to lock the camera, then just use [teleport] instead of {MOVE_UNIT }. It's just a guess, but that probably won't be tracked by the camera, and it should stay where you locked it.
Or, a probably even better alternative could be [move_unit_fake] (storing the unit, using this, then unstoring the unit at the new location). It has the force_scroll key, which can disable map-scrolling when [lock_view is in effect, which I think is just the solution for your issue.


EDIT:
I looked it up, and [move_unit] has force_scroll too. So ignore my original guessing, and it's just that you should replace all your {MOVE_UNIT id x y} with:

Code: Select all

[move_unit]
    id=id
    x=x
    y=y
    force_scroll=no
[/move_unit]
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
Sire
Posts: 158
Joined: April 6th, 2012, 11:03 pm
Location: USA

Re: [Lock_View] Usage

Post by Sire »

Thanks for the help! Everything works now after I created a "new" macro that removes the scrolling for unit movement.

I started suspecting that moving units had force scroll and may have went with the fake unit movement, but making a modified version of the existing MOVE_UNIT FILTER TO_X TO_Y macro helps immensely for my purposes.

Thanks again for the assistance!
Current Projects: [Sire's Scenarios] || [Red Winter Reborn]
Post Reply