How to create a fake attack animation during an event?
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.
How to create a fake attack animation during an event?
In a campaign I am writing, during a particular event, I want one unit to fake attacking another. With that, I mean that the attack animation should show, the defense or hit animation should show, and the associated sound effects should play. I want to be in control of the number of strokes (just one, actually) and whether the attack hits or misses. There should be no floating numbers or actual changes to the units. Consider something like {FAKE_UNIT_MOVE}, only for an attack animation.
Unfortunately, I could not find a macro or something equivalent in WML.
Now, given that the involved units are of specific unit types and even at specific hex coordinates, I could probably do what I want by hiding the units and building the animation via [item] tags. However, this is not particularly future-proof as the animation frames (file names, paths, numbers) might change between Wesnoth versions, so this might work in one particular version of Wesnoth, but not in the next. Similar thing with the sounds.
So, did I miss something, or do I have to do this the awkward way?
Unfortunately, I could not find a macro or something equivalent in WML.
Now, given that the involved units are of specific unit types and even at specific hex coordinates, I could probably do what I want by hiding the units and building the animation via [item] tags. However, this is not particularly future-proof as the animation frames (file names, paths, numbers) might change between Wesnoth versions, so this might work in one particular version of Wesnoth, but not in the next. Similar thing with the sounds.
So, did I miss something, or do I have to do this the awkward way?
The Cost Of Living (1.8): main thread, feedback thread
Re: How to create a fake attack animation during an event?
[animate_unit]. Look how it's used for example in 'Towards the Caves' in SoF.
Re: How to create a fake attack animation during an event?
As far as I'm aware, you also need a {MODIFY_UNIT} to change facing. Maybe I just had lots of problems.
Here's a snippet from my old abandoned campaign, where a unit on 4,5 is attacking a unit with an ID of Gun1, with his axe:
Here's a snippet from my old abandoned campaign, where a unit on 4,5 is attacking a unit with an ID of Gun1, with his axe:
Code: Select all
{MOVE_UNIT x,y=3,8 4 5}
{MODIFY_UNIT x,y=4,5 facing ne}
{MODIFY_UNIT x,y=5,5 facing sw}
[animate_unit]
flag=attack
[filter]
x,y=4,5
[/filter]
[filter_second]
id=Gun1
[/filter_second]
[primary_attack]
name=axe
[/primary_attack]
hits=yes
[/animate_unit]
"What do you mean, "a dwarvish dragonguard with marksman is overpowered"?"
Story of a Drake Outcast | The Nonsense Era
Played HttT-Underground Channels? Thought it was rubbish? Help us develop it here!
Story of a Drake Outcast | The Nonsense Era
Played HttT-Underground Channels? Thought it was rubbish? Help us develop it here!
Re: How to create a fake attack animation during an event?
Not sure how I could miss the [animate_unit] tag when it's right there in the docs. Either way, works a treat. Thank you very much.
The Cost Of Living (1.8): main thread, feedback thread
Re: How to create a fake attack animation during an event?
You can put the facing directly into [animate_unit]
Example:
Example:
Spoiler:
“It is written in my life-blood, such as that is, thick or thin; and I can no other.” - J.R.R. Tolkien
My campaign: Swamplings - Four centuries before the founding of Wesnoth, the first wolf rider emerges from a tribe of lowly swamp goblins.
My campaign: Swamplings - Four centuries before the founding of Wesnoth, the first wolf rider emerges from a tribe of lowly swamp goblins.