Help on Northern Outpost WML

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
turin
Lord of the East
Posts: 11662
Joined: January 11th, 2004, 7:17 pm
Location: Texas
Contact:

Help on Northern Outpost WML

Post by turin »

This is really confusing me a lot. Look at the scenario code at the end of my post. There is a bug: you are able to undo the capturing of villages. Looking at this code, I don't see how this could be. Even if for some reason the second event allowed undo, which it shouldn't, the first should disallow it. So does anyone know why this is happening? I'd really like to get this fixed before 1.0.

Code: Select all

	[event]
	name=capture
	first_time_only=no
		[filter]
		side=1
		[/filter]
	[/event]

	[event]
	name=capture
	first_time_only=no
		#creates random enemies when you flag a village
		[filter]
		side=1
		[/filter]
		{RANDOM 0..10}
		[if]
			[variable]
			name=random
			less_than=$trapdiff
			[/variable]
			[then]
				[set_variable]
				name=numban
#ifdef EASY
				random=0..4
#endif
#ifdef NORMAL
				random=1..5
#endif
#ifdef HARD
				random=2..6
#endif
				[/set_variable]
				[set_variable]
				name=numban
				add=$trapdiff
				[/set_variable]
				[while]
					[variable]
					name=numban
					greater_than=0
					[/variable]
					[do]
						{RANDOM Footpad,Thug,Thief,Poacher,Thug,Thief,Footpad,Thug,Thief,Poacher,Thug,Thief,Rogue,Bandit}
						{TRAPMAN $random}
						[set_variable]
						name=numban
						add=-2
						[/set_variable]
					[/do]
				[/while]
				{CLEAR_VARIABLE numban}
				[message]
				speaker=unit
				message= _ "They're here!"
				[/message]
				#decides if the badguy leader appears
				#badguy leader has less chance of appearing early on. (as in 0% chance for first 5 villages. :P)
				{RANDOM 4..10}
				[if]
					[or]
						[variable]
						name=random
						greater_than_equal_to=$trapdiff
						[/variable]
					[/or]
					[or]
						[variable]
						name=shodranoshown
						equals=yes
						[/variable]
					[/or]	
					[else]
						[unit]
						type=Assassin
						side=4
						x=$x1
						y=$y1
						description=Shodrano
						user_description= _ "Shodrano"
						[/unit]
						[set_variable]
						name=shodranoshown
						value=yes
						[/set_variable]
						[message]
						description=Shodrano
						message= _ "So, you have found my hiding place. Very well, I guess I will have to kill you!"
						[/message]
						[message]
						description=Owaec
						message= _ "That's the bandit leader! Kill him, and we will have fulfilled our duty!"
						[/message]
					[/else]
				[/if]
			[/then]
			[else]
				[message]
				speaker=unit
				message= _ "No outlaws in this village."
				[/message]
			[/else]
		[/if]
		[set_variable]
		name=trapdiff
		add=1
		[/set_variable]
	[/event]
For I am Turin Turambar - Master of Doom, by doom mastered. On permanent Wesbreak. Will not respond to private messages. Sorry!
And I hate stupid people.
The World of Orbivm
claus
Posts: 186
Joined: April 4th, 2005, 5:51 am

Post by claus »

I think capture events do not block undo. You can use a moveto event for all village locations instead of the first capture event. (will block more undos than neccessary, you can use a binary variable for each village which says, if side 1 owns the village or not (more capture events for other sides), and in the moveto event if cases, which allow undo when it was no capture)
User avatar
turin
Lord of the East
Posts: 11662
Joined: January 11th, 2004, 7:17 pm
Location: Texas
Contact:

Post by turin »

claus wrote:I think capture events do not block undo. You can use a moveto event for all village locations instead of the first capture event. (will block more undos than neccessary, you can use a binary variable for each village which says, if side 1 owns the village or not (more capture events for other sides), and in the moveto event if cases, which allow undo when it was no capture)
Hm... if it is true that capture events don't block undo, that seems like a bug to me. I'll report it, after I do some more tests.
For I am Turin Turambar - Master of Doom, by doom mastered. On permanent Wesbreak. Will not respond to private messages. Sorry!
And I hate stupid people.
The World of Orbivm
quartex
Inactive Developer
Posts: 2258
Joined: December 22nd, 2003, 4:17 am
Location: Boston, MA

Post by quartex »

Normally doesn't ANY event firing prevent an undo? That's the whole reason why they invented [allow_undo] becuase even a signpost with a moveto event would prevent the player from undoing his move. So I doubt that a capture event should allow an undo.
User avatar
turin
Lord of the East
Posts: 11662
Joined: January 11th, 2004, 7:17 pm
Location: Texas
Contact:

Post by turin »

Well, according to the wesnoth-cvs-commits mailing list, someone (don't remember who) just committed a fix. If it works with CVS now (I'll check tomorrow), I can FINALLY close that bug.
For I am Turin Turambar - Master of Doom, by doom mastered. On permanent Wesbreak. Will not respond to private messages. Sorry!
And I hate stupid people.
The World of Orbivm
Post Reply