How to make a fake attack?

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
Ken_Oh
Moderator Emeritus
Posts: 2178
Joined: February 6th, 2006, 4:03 am
Location: Baltimore, Maryland, USA

How to make a fake attack?

Post by Ken_Oh »

I'm at a loss on how to do this. I think I remember it being in another campaign, but I don't remember where.

I want to make Delfador, who is at coords 25,24 use his nifty halo lightning attack to be triggered by a moveto [event] and have him attack a rock at 24,23.

I've tried just putting this in:

Code: Select all

			[animation]
				hits=yes
				direction=nw
				[frame]
					begin=-300
					end=-200
					image="units/elder-mage-ranged.png"
					halo=halo/lightning-bolt-1-1.png:100
					halo_x,halo_y=24,23
					sound=lightning.ogg
				[/frame]
				[frame]
					begin=-200
					end=-100
					image="units/elder-mage-ranged.png"
					halo=halo/lightning-bolt-1-2.png
					halo_x,halo_y=24,23
				[/frame]
				[frame]
					begin=-100
					end=100
					image="units/elder-mage-ranged.png"
					halo=halo/lightning-bolt-1-3.png
					halo_x,halo_y=24,23
				[/frame]
				[frame]
					begin=100
					end=200
					image="units/elder-mage-ranged.png"
					halo=halo/lightning-bolt-1-4.png
					halo_x,halo_y=24,23
				[/frame]
				[frame]
					begin=200
					end=250
					image="units/elder-mage-ranged.png"
					halo=misc/blank-hex.png
					halo_x,halo_y=24,23
				[/frame]
			[/animation]
But it's not doing anything. I just don't know where to go from here.

Any help to put me in the right direction is appreciated.
scott
Posts: 5248
Joined: May 12th, 2004, 12:35 am
Location: San Pedro, CA

Post by scott »

Theoretically...

The unit def needs an [extra_anim] tag per http://www.wesnoth.org/wiki/UnitWML and http://www.wesnoth.org/wiki/AnimationWML
Then, in the event that triggers it, you use an [animate_unit] tag per http://www.wesnoth.org/wiki/InterfaceActionsWML

I have never seen it used anywhere, but if someone animates a L1 gryphon rider to rear back I would. Maybe you're thinking of Delfador in Plunging into the Darkness. However, this isn't used. The sound is played and the screen flashes white.
Hope springs eternal.
Wesnoth acronym guide.
User avatar
Ken_Oh
Moderator Emeritus
Posts: 2178
Joined: February 6th, 2006, 4:03 am
Location: Baltimore, Maryland, USA

Post by Ken_Oh »

Ah, very good. Honestly, when I said I thought I remembered something liek it happening in a campaign, I must have been thinking of some other game.

I looked it through and here's part of what I put into a test scenario:

Code: Select all

[side]
	side=3
	type=Elder Mage
	description=second
	user_description= _ "Second"
	unrenamable=yes
	controller=ai
	team_name=teamone
	canrecruit=1
	recruit=Peasant
	gold=50
[/side]

[event]
	name=ai turn
	first_time_only=no
	{MODIFY_UNIT description=second goto_x 15}
	{MODIFY_UNIT description=second goto_y 15}
[/event]

[event]
	name=moveto
	[filter]
		x,y=15,15
	[/filter]
	[if]
		[have_unit]
			description=second
			x=15
			y=15
		[/have_unit]
		[then]
			[scroll_to]
				x=15
				y=15
			[/scroll_to]
			[animate_unit]
				flag=blast
				[filter]
					description=second
				[/filter]
			[/animate_unit]
		[/then]
	[/if]
[/event]
Below is what I inserted into a copied version of Elder Mage.cfg:

Code: Select all

[extra_anim]
	[animation]
		flag=blast
		direction=nw
		[frame]
			begin=-300
			end=-200
			image="units/elder-mage-ranged.png"
			halo=halo/lightning-bolt-1-1.png:100
			halo_x,halo_y=-1,-1
			sound=lightning.ogg
		[/frame]
		[frame]
			begin=-200
			end=-100
			image="units/elder-mage-ranged.png"
			halo=halo/lightning-bolt-1-2.png
			halo_x,halo_y=-1,-1
		[/frame]
		[frame]
			begin=-100
			end=100
			image="units/elder-mage-ranged.png"
			halo=halo/lightning-bolt-1-3.png
			halo_x,halo_y=-1,-1
		[/frame]
		[frame]
			begin=100
			end=200
			image="units/elder-mage-ranged.png"
			halo=halo/lightning-bolt-1-4.png
			halo_x,halo_y=-1,-1
		[/frame]
		[frame]
			begin=200
			end=250
			image="units/elder-mage-ranged.png"
			halo=misc/blank-hex.png
			halo_x,halo_y=-1,-1
		[/frame]
	[/animation]
[/extra_anim]
When "second" gets to 15,15, he stops and the game freezes. I can select stuff with the mouse, see stats and unit descriptions, but it's perpetually stuck on the ai turn (which is exactly what happened when I tried to put all this into my real campaign).

If anyone can give it a look-down, then thanks in advance. I'm getting sleepy and if I can't find anything obvious after I post this, I'll call it a night.
User avatar
Ranger M
Art Contributor
Posts: 1965
Joined: December 8th, 2005, 9:13 pm
Location: England

Post by Ranger M »

it happens in the last scenario of UTBS.
User avatar
zookeeper
WML Wizard
Posts: 9742
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Post by zookeeper »

[extra_anim] doesn't take an [animation] in it.

I think you don't need to trigger fake attack anims however, if you just make a fake unit in place of the rock, and make the AI target that aggressively enough (possibly flipping delfie to that AI side only when he steps next to the rock).
User avatar
turin
Lord of the East
Posts: 11662
Joined: January 11th, 2004, 7:17 pm
Location: Texas
Contact:

Post by turin »

what would be extremely useful (and this has been brought up before) is a tag to make a unit attack another... and be able to give the random numbers used (so you can determine how much damage is done). That would solve the problem here nicely.
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
Boucman
Inactive Developer
Posts: 2119
Joined: March 31st, 2004, 1:04 pm

Post by Boucman »

post a feature request and assign it to me, that's very doable with the current engine

I will implement it post 1.2
Fight key loggers: write some perl using vim
User avatar
Ken_Oh
Moderator Emeritus
Posts: 2178
Joined: February 6th, 2006, 4:03 am
Location: Baltimore, Maryland, USA

Post by Ken_Oh »

Thanks all!

Zookeeper had the key I needed. The extra [animation] tag is what caused the problem. zoo and EP then helped me sort out the details in irc.
User avatar
turin
Lord of the East
Posts: 11662
Joined: January 11th, 2004, 7:17 pm
Location: Texas
Contact:

Post by turin »

Boucman wrote:post a feature request and assign it to me, that's very doable with the current engine

I will implement it post 1.2
Aye aye.
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