[allow_undo] in moveto events

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.

Re: [allow_undo] in moveto events

Postby 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
Sapient
Developer
 
Posts: 4325
Joined: November 26th, 2005, 7:41 am

Re: [allow_undo] in moveto events

Postby 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
zookeeper
WML Wizard
 
Posts: 9519
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Re: [allow_undo] in moveto events

Postby 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
Paulomat4
Moderator
 
Posts: 666
Joined: October 16th, 2012, 3:32 pm
Location: Wesmere library, probably summoning Zhangor

Re: [allow_undo] in moveto events

Postby 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
zookeeper
WML Wizard
 
Posts: 9519
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Re: [allow_undo] in moveto events

Postby 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
User avatar
Paulomat4
Moderator
 
Posts: 666
Joined: October 16th, 2012, 3:32 pm
Location: Wesmere library, probably summoning Zhangor

Re: [allow_undo] in moveto events

Postby 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.
gfgtdf
Developer
 
Posts: 843
Joined: February 10th, 2013, 2:25 pm

Previous

Return to WML Workshop

Who is online

Users browsing this forum: Bing [Bot] and 1 guest