Game display in wrong order

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
alda
Posts: 49
Joined: December 2nd, 2009, 4:06 pm

Game display in wrong order

Post by alda »

Hi and merry christmas everyone.

I have a problem in a campaign I'm doing. The problem is that when I creates units or items or terrains, and then displays messages, the message sometimes appear before the previous action. For example, iin this code :

Code: Select all

#opening the prison
	[event]
		name=moveto
		
		[filter]
			side=1
			x,y=51-52,23
		[/filter]
		
		[if]
			[variable]
				name=keys1
				equals=1
			[/variable]
		
			[then]
				[message]
					speaker=unit
					message=_ "Hmm, give me keys. Let's try open it..."
				[/message]
				[message]
					speaker=narrator
					message=_ "Several minutes pass"
				[/message]
				[message]
					speaker=unit
					message=_ "Yay! I opened it !"
				[/message]
			
				[terrain]
					x,y=52,22
					terrain=Uu
				[/terrain]
				
				{REMOVE_IMAGE 52 22}
				{VARIABLE_OP doors_open add 1}
			
				[unit]
					type=Goblin Rouser
					id=Bunk
					name=_ "Bunk"
					side=1
					
					x,y=54,21
					{IS_HERO}
					[modifications]
						{TRAIT_LOYAL}
					[/modifications]
				[/unit]
				
				{GENERIC_UNIT 1 (Goblin Spearman) 53 20}
				{GENERIC_UNIT 1 (Goblin Spearman) 59 23}
				{GENERIC_UNIT 1 (Wolf Rider) 56 22}
				
				[scroll_to]
					x,y=54,21
				[/scroll_to]
											
				[message]
					speaker=Bunk
					message=_ "Ah! Finally someone free us ! Salutations, troll friends. Me and fellow goblins are at your service now."
				[/message]
				
				[message]
					speaker=Tag
					message=_ "What were you doing here ?"
				[/message]
			
				[message]
					speaker=Bunk
					message=_ "Hey, mister troll, you dumb or what ? Oops sorry, you're a troll. We were prisonners, can't you see it? Captured by those damn dwarves."
				[/message]
				
				[message]
					speaker=Tag
					message=_ "So you will help us fight dwarves ?"
				[/message]
				
				[message]
					speaker=Bunk
					message=_ "Want to fight'em ? There's a whole lot of them past these gates. I'll be glad to help you slaughter these bastards."
				[/message]
				
				[message]
					speaker=Tag
					message=_ "Ok, let's kill them then."
				[/message]
				
				[message]
					speaker=narrator
					message=_ "You can now recruit goblins."
				[/message]
					
				[allow_recruit]
					side=1
					type=Goblin Spearman,Wolf Rider
				[/allow_recruit]
				
				[objectives]
					side=1
					[objective]
						condition=win
						description=_ "Kill all dwarf leaders"
					[/objective]
					[objective]
						condition=lose
						description=_ "Death of Tag"
					[/objective]
					[objective]
						condition=lose
						description=_ "Death of Bunk"
					[/objective]
					note={EARLY_FINISH_BONUS_NOTE}+{NEW_GOLD_CARRYOVER_NOTE_40}
				[/objectives]							
			[/then]
		
			[else]
				[allow_undo]
				[/allow_undo]
			[/else]
		[/if]
	[/event]
Here, after opening the door, some units are created on your side behind the door, and one of these units speaks. Problem is the units are created (it takes a little time), but you don't see them when the messages appear. So it's as if your main character speaks to darkness :? (this scenario is fog=yes shroud=yes). I tried to use remove_shroud but it just shows fog instead.

I guess it's not a code problem and this has something to do with game engine. But is there some way to avoid it ? Some waay to tell the game to refresh image before displaying message ?

Thank you for helping.

silene
Posts: 1109
Joined: August 28th, 2004, 10:02 pm

Re: Game display in wrong order

Post by silene »

alda wrote:Some way to tell the game to refresh image before displaying message ?
Have you tried putting a [redraw] tag after creating the units?

User avatar
alda
Posts: 49
Joined: December 2nd, 2009, 4:06 pm

Re: Game display in wrong order

Post by alda »

Well, I didn't know the existence of this tag, but after seeing it on wiki, it seems to be exactly what I looked for.

I'll try it then. Thank you :)

Post Reply