[remove_shroud] and [terrain] question

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
User avatar
Sapient
Developer
Posts: 4430
Joined: November 26th, 2005, 7:41 am
Contact:

Re: [allow_undo] in moveto events

Post by Sapient » March 18th, 2017, 10:25 pm

gfgtdf wrote: I dont se how this could help here, if he used that instead of of rand= in his code he'd get OOS if the actions was undone since the wml-implemented pseudo random counter would have changed.
Oops. You're totally right about that.
http://www.wesnoth.org/wiki/User:Sapient... "Looks like your skills saved us again. Uh, well at least, they saved Soarin's apple pie."

User avatar
zookeeper
WML Wizard
Posts: 9713
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Re: [allow_undo] in moveto events

Post by zookeeper » March 18th, 2017, 10:38 pm

Sapient wrote:Probably better to pick the ambush points in advance. I think there's an HttT scenario that does that, which you could look at for an example.
Yes, spawning enemies or the like in a moveto event usually isn't a very good idea. As a player you're going to be really annoyed if you move someplace, nothing happens, you undo, and then decide to move back there anyway and now something happens all of a sudden. If it's something good that happens, then you can just repeatedly use moves and undos to make sure you get it, and if it's something bad that happens then that's just unfair.

User avatar
Paulomat4
Moderator
Posts: 708
Joined: October 16th, 2012, 3:32 pm
Location: Wesmere library, probably summoning Zhangor

Re: [allow_undo] in moveto events

Post by Paulomat4 » March 19th, 2017, 5:42 pm

Requiring a random variable ([set_varialbe] rand=) is in internal change of the gamestate that cannot be undone without causing OOS. The game engine detects this and ignores your [allow_undo]
Okay, understood :)
this means you can make it undoable if you don't use rand= to determine whether a unit is spawned, you coudl for example make the unit spawned only depend on the turn and the coodinate, like:
That won't work. I've simplified the chances for demonstration but normally only one in ten moves should trigger something.
if he used that instead of of rand= in his code he'd get OOS if the actions was undone since the wml-implemented pseudo random counter would have changed.
the code is only for a campaign scenario, so Oos shouldn't be a problem.
Yes, spawning enemies or the like in a moveto event usually isn't a very good idea. As a player you're going to be really annoyed if you move someplace, nothing happens, you undo, and then decide to move back there anyway and now something happens all of a sudden. If it's something good that happens, then you can just repeatedly use moves and undos to make sure you get it, and if it's something bad that happens then that's just unfair.
true. Maybe I should rethink the event.
Creator of Dawn of Thunder and Global Unitmarkers

"I thought Naga's used semi-automatic crossbows with incendiary thermite arrows . . . my beliefs that this race is awesome are now shattered." - Evil Earl

User avatar
zookeeper
WML Wizard
Posts: 9713
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Re: [allow_undo] in moveto events

Post by zookeeper » March 19th, 2017, 6:03 pm

If the enemies are slow, then you can still use moveto events to take note of when the player steps in a given area, and then on the next turn start, spawn enemies in that area in random locations. That way the player gets a much better chance to react, although of course there can still be a danger of getting unfairly trapped without a chance to escape, especially if they're also likely to be tangling with other enemies at the same time.

User avatar
Paulomat4
Moderator
Posts: 708
Joined: October 16th, 2012, 3:32 pm
Location: Wesmere library, probably summoning Zhangor

Re: [allow_undo] in moveto events

Post by Paulomat4 » March 19th, 2017, 9:35 pm

Okay, So i might have found a solution.

Code: Select all

	[event]
		name=select
		first_time_only=no
		[set_variable]
			name=spawnlevel
			rand=0,1,2,3
		[/set_variable]
	[/event]
The problem about undoing things and random spawns still exist, but at least it's possible to do.
I just don't know if the ai is using select events. But If I think about it, I could even create a second moveto event which triggers every time the other one is triggered...
Creator of Dawn of Thunder and Global Unitmarkers

"I thought Naga's used semi-automatic crossbows with incendiary thermite arrows . . . my beliefs that this race is awesome are now shattered." - Evil Earl

gfgtdf
Developer
Posts: 994
Joined: February 10th, 2013, 2:25 pm

Re: [allow_undo] in moveto events

Post by gfgtdf » March 19th, 2017, 9:41 pm

This will sureley casue OOS in mp or corrupt replays in sp.
Scenario with Robots SP scenario (1.11/1.12), allows you to build your units with components, PYR No preperation turn 1.12 mp-mod that allows you to select your units immideately after the game begins.

User avatar
Paulomat4
Moderator
Posts: 708
Joined: October 16th, 2012, 3:32 pm
Location: Wesmere library, probably summoning Zhangor

[remove_shroud] question

Post by Paulomat4 » March 6th, 2018, 6:41 pm

Hello,
it's been some time that I have written some wml so I might be missing something obvious.

Code: Select all

[remove_shroud]
	side=1
	x,y=33,12
	radius=3
[/remove_shroud]
It is supposed to remove shroud from a given location and place a 6-hex castle somewhere else. Pretty simple actually.
Now, the shroud is removed on the entire field and no castle is placed anywhere? Any help? :)

Edit: solved the [terrain] error myself. The error was not in the [terrain] tag, but in a terrain mask that was added later
Creator of Dawn of Thunder and Global Unitmarkers

"I thought Naga's used semi-automatic crossbows with incendiary thermite arrows . . . my beliefs that this race is awesome are now shattered." - Evil Earl

User avatar
Kwandulin
Art Contributor
Posts: 334
Joined: March 30th, 2014, 7:35 am
Location: Germany

Re: [remove_shroud] and [terrain] question

Post by Kwandulin » March 6th, 2018, 6:53 pm

I've had the same problem with [terrain] some time ago and our zookeeper helped me out with it. Apparently, radius belongs into an [and] [/and]. Try the following code. Your placement of the keep looks fine to me, though

Code: Select all

[terrain] 
	[and]		
		x,y,radius=42,9,1	
	[/and]
	terrain=Ce
[/terrain]

User avatar
Paulomat4
Moderator
Posts: 708
Joined: October 16th, 2012, 3:32 pm
Location: Wesmere library, probably summoning Zhangor

Re: [remove_shroud] and [terrain] question

Post by Paulomat4 » March 6th, 2018, 6:57 pm

Hey Kwandulin, thanks for the help! I figured the terrain error out by myself. It's still a mystery to me why the shroud is removed for everyone.
I've tried with an explicit [filter_side] and without to no avail.
Creator of Dawn of Thunder and Global Unitmarkers

"I thought Naga's used semi-automatic crossbows with incendiary thermite arrows . . . my beliefs that this race is awesome are now shattered." - Evil Earl

Post Reply