Animate hidden unit's attack
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.
Animate hidden unit's attack
Hi, I want to animate a lightning strike without the unit showing. So that it just looks like a lightning bolt.
This is my code:
Supposedly this should work, but in practice it doesn't. Is it not possible to animate a hidden unit? When I run this code I don't see anything at all so is the problem that the animation is hidden as well?
Any help would be great!
This is my code:
Code: Select all
# create fake unit
{NAMED_GENERIC_UNIT 1 (Elder Mage) 10 9 fake fake}
# hide fake unit
[hide_unit]
id=fake
[/hide_unit]
# move the screen so it is centered on the lightning
[scroll_to_unit]
id=fake
[/scroll_to_unit]
#animate the lightning attack
[animate_unit]
flag=attack
[filter]
id=fake
[/filter]
[primary_attack]
range=ranged
[/primary_attack]
hits=yes
[/animate_unit]
# kill the fake unit
[kill]
id=fake
[/kill]
Any help would be great!
Creator of: The Reign of The Lords Era,The Gnats Franken Dungeon.
Re: Animate hidden unit's attack
sorry for stupid question but have you tried the same code without hiding unit? Make sure the code works at all first..
PS. after you figure out if the problem is with "hidden unit" or with your code, here is a part of my working code for unit animation attack:comparing yours and mine I noticed a difference.. hits=hit (mine) hits=yes (yours) no idea if that makes a difference or not.. but for some reason i have
PS. after you figure out if the problem is with "hidden unit" or with your code, here is a part of my working code for unit animation attack:
Code: Select all
[animate_unit]
flag=attack
[filter]
x,y=$CG_archer.x,$CG_archer.y
[/filter]
[primary_attack]
range=ranged
[/primary_attack]
hits=hit
with_bars=yes
[facing]
[filter]
x,y=$hac_ranged_attack_target.x,$hac_ranged_attack_target.y
[/filter]
[/facing]
[/animate_unit]
hit
instead of yes
.. idkRe: Animate hidden unit's attack
No that is a perfectly reasonable question. Yes I did test it and it animated the attack exactly when I remove:
Code: Select all
[hide_unit]
id=fake
[/hide_unit]
Also is your code animating a hidden unit?
Creator of: The Reign of The Lords Era,The Gnats Franken Dungeon.
Re: Animate hidden unit's attack
nope my code is not for hidden units...
I also would want to know a way to animate hidden units.. but not hidden like u did, but hidden via using:
coz unit animations dont seem to work on that unit anymore.. unless maybe i need to start them with ~BLIT(...?
I also would want to know a way to animate hidden units.. but not hidden like u did, but hidden via using:
Code: Select all
[effect]
apply_to=image_mod
replace="O(0)"
[/effect]
Re: Animate hidden unit's attack
Yes I agree it would be quite useful. I briefly considered animating a fake unit which had no image, but then you would still be able to see the HP bar, which defeats the point.
Potentially is it possible to animate a fake unit, such as the
Potentially is it possible to animate a fake unit, such as the
move_unit_fake
does?Creator of: The Reign of The Lords Era,The Gnats Franken Dungeon.
Re: Animate hidden unit's attack
Bars can be given offset to make them out of screen.
I would first ask why you want to make it part of unit animation? Could use event.
I would first ask why you want to make it part of unit animation? Could use event.
Re: Animate hidden unit's attack
It might be possible to create a unit with no image. Then to animate it
But that would require an extra unit which I would rather not create if it is possible.
EDIT: @ ravana - I am merely trying to simulate the attack frame for the Elder Mage lightning. Is there another way?
with_bars=no
. That would be equivalent to an invisible unit.But that would require an extra unit which I would rather not create if it is possible.
EDIT: @ ravana - I am merely trying to simulate the attack frame for the Elder Mage lightning. Is there another way?
Creator of: The Reign of The Lords Era,The Gnats Franken Dungeon.
Re: Animate hidden unit's attack
Havent tried animations, didnt notice anything useful from reference today. Seems that doing it with unit is still the way to go.
Re: Animate hidden unit's attack
Okay. Thank you for responding!
So for now I believe I will create a fake version of the
So for now I believe I will create a fake version of the
[base_unit]
Elder Mage, not listed in the help menu with no picture and animate it with_bars=no
.Creator of: The Reign of The Lords Era,The Gnats Franken Dungeon.
- beetlenaut
- Developer
- Posts: 2825
- Joined: December 8th, 2007, 3:21 am
- Location: Washington State
- Contact:
Re: Animate hidden unit's attack
I've done this before, and it works fine: Use a
[for]
loop that does something like:
Code: Select all
[item]
...
halo="image-"+$i+".png"
[/item]
[delay]...
[remove_item]...
Campaigns: Dead Water,
The Founding of Borstep,
Secrets of the Ancients,
and WML Guide
The Founding of Borstep,
Secrets of the Ancients,
and WML Guide
Re: Animate hidden unit's attack
wait.. could you tell me why you are hiding the unit at all? because your unit doesnt have the type of attack or? coz I just add the attack in some animation cases and remove it right after attack happened.. ?
PS.
ah yeah i think i know what you mean..
in this case you could probably add animation to your king that would have ranged lightning strike.. and then remove it after attack... just a thought..
oh well.. im full of silly ideas.. you could change defense animation of the unit before lightning (the defense animation would include lightning strike in it) and then use [harm_unit] tag with just defender animation in it... and then of course restore the defense animation to default..
PS.
ah yeah i think i know what you mean..
in this case you could probably add animation to your king that would have ranged lightning strike.. and then remove it after attack... just a thought..
oh well.. im full of silly ideas.. you could change defense animation of the unit before lightning (the defense animation would include lightning strike in it) and then use [harm_unit] tag with just defender animation in it... and then of course restore the defense animation to default..
Re: Animate hidden unit's attack
Its because I want a lightning strike far off on the other side of the map. For story reasons it is a strange sighting that the characters see.
That is true but I want the event un-related to your units. I appreciate your suggestions though and will keep them in mind for future scenarios
in this case you could probably add animation to your king that would have ranged lightning strike.. and then remove it after attack... just a thought..
you could change defense animation of the unit before lightning (the defense animation would include lightning strike in it) and then use [harm_unit] tag with just defender animation in it... and then of course restore the defense animation to default..
Thank you! I think this is probably best for what I want to do.beetlenaut wrote: ↑December 29th, 2018, 11:30 pm I've done this before, and it works fine: Use a [for] loop that does something like:
Creator of: The Reign of The Lords Era,The Gnats Franken Dungeon.
Re: Animate hidden unit's attack
Thanks to beetlenaut here is my final working code:
Code: Select all
{RANDOM 1..3} # random direction for the lightning
# iterate through each image to animate a lightning strike
[for]
start,end,step=1,4,1
[do]
# show the image
# using halo="" not image="" so that a larger sized image such as lightning can be shown
[item]
redraw=yes
x,y=10,9
halo="halo/lightning-bolt-$random|-$i|.png"
[/item]
# pause so the animation can be seen properly
[delay]
time=80
[/delay]
# remove that frame of the animation
[remove_item]
x,y=10,9
[/remove_item]
[/do]
[/for]
{CLEAR_VARIABLE random}
Creator of: The Reign of The Lords Era,The Gnats Franken Dungeon.