Avian Era WML thread

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.
Vanagandr
Posts: 36
Joined: May 17th, 2014, 5:48 pm

Avian Era WML thread

Post by Vanagandr »

While doing the fly special for the Avian faction, I encountered some peculiar behaviour:
When one right clicks on the Kingfisher, a menu item will open that will enable the unit to change from its flying to ground variation and vice versa. Also the unit should play its flying/landing animation when doing that. In 1.11.13 one has the option to toggle the menu item by hotkeys (v for flying, l for landing). Now, the animation only plays when using hotkeys, and not when opening the right-click menu and clicking on fly/land. I don't know whether that's a bug or I coded it wrong, I don't really know what would lead to this behaviour. Can someone help me out?
Attachments
Avian_Era.rar
(305.75 KiB) Downloaded 183 times
Last edited by Vanagandr on June 10th, 2014, 2:36 pm, edited 1 time in total.
User avatar
Heindal
Posts: 1459
Joined: August 11th, 2011, 9:25 pm
Location: Germany, Karlsruhe
Contact:

Re: [animate_unit] in right click menu

Post by Heindal »

One possible solution is to shift the terrain or movement type of the unit for a while. Annother solution would be to change the animation of the unit, but I'm not quite sure if it can be done and how it can be done. But as the change of other variables is possible, I'm quite sure it can be done.


PS:

According to the wiki, you can not animate the units animations with - [modify_unit] , maybe somebody else has experience with animate unit.
You could try to use an overlay. But this depends on your animation.

Code: Select all

    [unit_overlay]
        id=...
        image=...
    [/unit_overlay]

    [delay]
        time=100
    [/delay]

    [remove_unit_overlay]
        id=...
        image=...
    [/remove_unit_overlay]
Last edited by Heindal on May 24th, 2014, 11:02 pm, edited 1 time in total.
The future belongs to those, who believe in the beauty of their dreams.
Developer of: Trapped, Five Fates, Strange Legacy, Epical, UR Epic Era
Dungeonmasters of Wesnoth, Wild Peasants vs Devouring Corpses, Dwarf Dwarfson Dwarvenminer
Vanagandr
Posts: 36
Joined: May 17th, 2014, 5:48 pm

Re: [animate_unit] in right click menu

Post by Vanagandr »

What do you mean? It does work, but only when using hotkeys. When you right click and choose the "Fly" option, the animation doesn't play (but the unit changes, it's only the animation that doesn't play). When you hover your mouse over the unit and press "v" and "l" respectively, the animation plays and the unit changes. So I don't see how this difference in behaviour is created, because hotkeys and manual right click should be exactly the same, right? Also, why is only [animate_unit] affected and not [transform_unit]?
User avatar
Heindal
Posts: 1459
Joined: August 11th, 2011, 9:25 pm
Location: Germany, Karlsruhe
Contact:

Re: [animate_unit] in right click menu

Post by Heindal »

Sometimes you have to use an workaround, to make things work. But maybe somebody else has some experience with that and can give you a better answer.
The future belongs to those, who believe in the beauty of their dreams.
Developer of: Trapped, Five Fates, Strange Legacy, Epical, UR Epic Era
Dungeonmasters of Wesnoth, Wild Peasants vs Devouring Corpses, Dwarf Dwarfson Dwarvenminer
User avatar
zookeeper
WML Wizard
Posts: 9742
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Re: [animate_unit] in right click menu

Post by zookeeper »

For what it's worth, I have absolutely no idea why the same menu item would behave differently depending on whether it's triggered by clicking or via a hotkey. If that's the case then that's definitely a bug.
Vanagandr
Posts: 36
Joined: May 17th, 2014, 5:48 pm

Re: [animate_unit] in right click menu

Post by Vanagandr »

I made another test (increased the duration of the frames to 1000) and it seems that the animation plays when you right-click manually, but much faster (so that you don't see it when duration=100). I also don't have the slightest clue why it would behave that way. You can try it if you want, just download the Avian_Era.rar and see for yourself. Maybe you will notice something I didn't.
Vanagandr
Posts: 36
Joined: May 17th, 2014, 5:48 pm

Re: [animate_unit] in right click menu

Post by Vanagandr »

I measured the times it takes for the respective animations to play:
using hotkeys: flying: 311ms (for 3 frames of duration=100 + some variable operations), landing: 611ms (for 6 frames+ variables), so this is what it should be
using manual right click: around 41ms most of the time, but there's a high variance here sometimes (usually between 30-50, but land sometimes takes over 100 ms)
Maybe this helps somehow to locate the error. It really looks like a bug to me. I attached the version that logs the times for the transformations.
Attachments
Avian_Era.rar
(305.83 KiB) Downloaded 649 times
User avatar
zookeeper
WML Wizard
Posts: 9742
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Re: [animate_unit] in right click menu

Post by zookeeper »

Could it be that use of the right-click menu briefly toggles accelerated mode on for you? You didn't say whether the animation actually plays faster or just ends sooner, but still I can't help but think of it as a distant possibility. I'm not sure how you'd test for that (unless you've assigned the right-click button to that action, which seems... very unlikely), though.
Vanagandr
Posts: 36
Joined: May 17th, 2014, 5:48 pm

Re: [animate_unit] in right click menu

Post by Vanagandr »

Hm, it seems that you are right, right clicking during an animation (I tested it for combat) seems to cancel/speed up the current animation (but not subsequent ones). It's kinda hard to time the right click with the start of the animation so you can notice it, though. Does that occur for anyone else? And btw, did anyone test the original issue with the right click menu?
Edit: The animation plays faster, and doesn't end prematurely. And of course I didn't bind right click to accelerate speed (it's ctrl+a) :)
Vanagandr
Posts: 36
Joined: May 17th, 2014, 5:48 pm

Re: [animate_unit] in right click menu

Post by Vanagandr »

I have another question: When giving a unit an object with duration=turn in a turn refresh event (the unit is on the same side as $side_number), the object immediately disappears. Is this indended? On the wiki it says that the object gets taken from the unit when it refreshes movement etc, but it also says that turn refresh occurs after healing etc. has taken place, so imo the object should be taken away before turn refresh.

And another one: When I transform a unit with for example 44/44 HP into a unit with 44 max HP and the unit has traits like strong or resilient (and not quick), the unit will end up with only 38/44 or 42/44 HP.
The relevant code for the latter problem would be:

Code: Select all

#make unit fly event
#the unit that is supposed to fly has to be stored in the unit_to_fly variable
[event]
	name=fly
	first_time_only=no
	[transform_unit]
		id=$unit_to_fly.id
		transform_to=$unit_to_fly.type|_Flying
	[/transform_unit]
	[clear_variable]
		name=unit_to_fly
	[/clear_variable]
[/event]


#fly menu item
[event]
	name=start
    first_time_only=no
	[set_menu_item]
		id=Avian_Flight
		description = _"Fly"
		[filter_location]
			[filter]
				ability=Avian_Flight
				side=$side_number
				[filter_wml]
					[not]
						moves=0
					[/not]
					[not]
						[status]
							dazed=yes
						[/status]
					[/not]
				[/filter_wml]
			[/filter]
		[/filter_location]
		[default_hotkey]
			key = v
		[/default_hotkey]
		[command]
			[animate_unit]
				flag=flying
			[/animate_unit]
			[store_unit]
				[filter]
					x,y=$x1,$y1
				[/filter]
				variable=unit_to_fly
			[/store_unit]
			[fire_event]
				name=fly
			[/fire_event]
			[modify_unit]
				[filter]
					x,y=$x1,$y1
				[/filter]
				moves=$($this_unit.moves - 1)
			[/modify_unit]
		[/command]
	[/set_menu_item]
[/event]
(That's also the relevant code for the old right-click animate unit problem btw.)
Also, how can I change the thread title?
User avatar
Turuk
Sithslayer
Posts: 5283
Joined: February 28th, 2007, 8:58 pm
Contact:

Re: [animate_unit] in right click menu

Post by Turuk »

You can change the thread title by editing your first post and changing its title.
Mainline Maintainer: AOI, DM, NR, TB and THoT.
UMC Maintainer: Forward They Cried, A Few Logs, A Few More Logs, Start of the War, and Battle Against Time
Vanagandr
Posts: 36
Joined: May 17th, 2014, 5:48 pm

Re: Avian Era WML thread

Post by Vanagandr »

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

Re: [animate_unit] in right click menu

Post by zookeeper »

As for the right-click problem, I don't really have anything more to say about it. If you could construct a standalone testcase for it and file a bug report, that'd be great, since it certainly doesn't seem like the kind of bug that just about anyone is capable of dealing with.
Vanagandr wrote:I have another question: When giving a unit an object with duration=turn in a turn refresh event (the unit is on the same side as $side_number), the object immediately disappears. Is this indended? On the wiki it says that the object gets taken from the unit when it refreshes movement etc, but it also says that turn refresh occurs after healing etc. has taken place, so imo the object should be taken away before turn refresh.
That sounds like a bug, although it could be that it was just documented misleadingly and works as intended.
Vanagandr wrote:And another one: When I transform a unit with for example 44/44 HP into a unit with 44 max HP and the unit has traits like strong or resilient (and not quick), the unit will end up with only 38/44 or 42/44 HP.
Sounds like a bug too. I'd suggest filing a bug report for that too, with a simple(r) testcase.
User avatar
tekelili
Posts: 1039
Joined: August 19th, 2009, 9:28 pm

Re: [animate_unit] in right click menu

Post by tekelili »

zookeeper wrote:
Vanagandr wrote:And another one: When I transform a unit with for example 44/44 HP into a unit with 44 max HP and the unit has traits like strong or resilient (and not quick), the unit will end up with only 38/44 or 42/44 HP.
Sounds like a bug too. I'd suggest filing a bug report for that too, with a simple(r) testcase.
hum, ignore me if I am wrong, but just in case... could be you forgot use heal_full=yes

Code: Select all

    [effect]
        apply_to=hitpoints
        increase_total={HP}
        heal_full=yes
    [/effect]
Be aware English is not my first language and I could have explained bad myself using wrong or just invented words.
World Conquest II
User avatar
ChaosRider
Posts: 1176
Joined: April 15th, 2012, 1:15 pm

Re: Avian Era WML thread

Post by ChaosRider »

You can allways add line with "increase={HP}", can be below "increase_total={HP}" in same effect and then you dont need "heal_full=yes".
Creator of WOTG (+5500 units), MWC (+615 units), SurvivorsArea, RandomColosseum, RC WOTG, RC MWC, ColosseumRandomClonesBattle, BetweenDarknessAndLight, StealingWeapons, MoreUnitsForms, MoreDamageTypes, CanBeOnlyOne, ColosseumOneWinner, BonusSpam, CriticalStrike - available at 1.18 Wesnoth server.
Post Reply