Using [harm_unit] within a cut-scene
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.
Re: Using [harm_unit] within a cut-scene
Well, just in case, here's what it would look like though. I tested it, and this works correctly for me now. That said, I've had my issues with it back in the day (and this is a mainline campaign, not even an add-on), and I don't know what caused it, I don't know if it's fixed or was just specific to that one laptop I had back then... so no idea.
Anyway, this did work for me now:
You could copy-paste it, it might be worth a try and see if it works for you.
I don't know of a way to make the "ugh" sound play at the right time. You can play it before or after [harm_unit] with [sound], but that doesn't make much sense probably.
Anyway, this did work for me now:
Code: Select all
[animate_unit]
flag=attack
[filter]
x,y=5,4
[/filter]
[primary_attack]
name=pincers
[/primary_attack]
[secondary_attack]
name=pincers
[/secondary_attack]
hits=yes
text= _ "<span color='red'>4</span>"
[facing]
x,y=6,4
[/facing]
[animate]
flag=defend
[filter]
x,y=6,4
[/filter]
[primary_attack]
name=dagger
[/primary_attack]
[secondary_attack]
name=pincers
[/secondary_attack]
hits=yes
[facing]
x,y=5,4
[/facing]
[/animate]
[/animate_unit]
I don't know of a way to make the "ugh" sound play at the right time. You can play it before or after [harm_unit] with [sound], but that doesn't make much sense probably.
Main UMC campaigns: The Ravagers - now for 1.16, with new bugs!
Old UMC works: The Underness Series, consisting of 5 parts: The Desolation of Karlag, The Blind Sentinel, The Stone of the North, The Invasion Of The Western Cavalry, Fingerbone of Destiny
Old UMC works: The Underness Series, consisting of 5 parts: The Desolation of Karlag, The Blind Sentinel, The Stone of the North, The Invasion Of The Western Cavalry, Fingerbone of Destiny
Re: Using [harm_unit] within a cut-scene
Wesnoth doesn't like those pincers, huh?
set both primary and secondary to range=melee and nothing else, you'll get your animation on both but it'll be the sting attack for the scorpion. I agree with WhiteWolf, it looks like a bug.
set both primary and secondary to range=melee and nothing else, you'll get your animation on both but it'll be the sting attack for the scorpion. I agree with WhiteWolf, it looks like a bug.
Re: Using [harm_unit] within a cut-scene
That's automatically bundled into his animation. You could probably also use [play_sound], if memory serves.
Re: Using [harm_unit] within a cut-scene
It works! Thank you. The doomed orc now has a defend animation, and it looks so much better. Thanks for taking the time to write the code.
I watched the videos. Freaky. Hopefully that strange thing won't happen to the orc, but if it does, at least we'll be able to rule-out your old laptop as the reason. Heh.
WhiteWolf's code works, but I'll try that solution in a different scenario. Thanks for the info.
I checked the Wiki. The tag for playing a sound is
[sound]
. But you're right, the orc's sound is bundled with the animation, so I don't need to use a tag. The orc now says "Ugh" automatically when he's hit by the Giant Scorpion, which is awesome.Author of:
DIY Campaign, Confederacy of Swamp Creatures: Big Battle 1, Confederacy of Swamp Creatures: Big Battle 2, Frogfolk Delivery Service, The Pool of Ek.
DIY Campaign, Confederacy of Swamp Creatures: Big Battle 1, Confederacy of Swamp Creatures: Big Battle 2, Frogfolk Delivery Service, The Pool of Ek.
- Celtic_Minstrel
- Developer
- Posts: 2233
- Joined: August 3rd, 2012, 11:26 pm
- Location: Canada
- Contact:
Re: Using [harm_unit] within a cut-scene
The problem in your original post seems to be that you have
EDIT: Re-reading it makes me wonder if this is in fact incorrect. Hold on.
EDIT2: So if the wiki is right it sounds like
[primary_attack]
and [secondary_attack]
backwards. Primary attack should be dagger and secondary should be pincers, according to the wiki.EDIT: Re-reading it makes me wonder if this is in fact incorrect. Hold on.
EDIT2: So if the wiki is right it sounds like
[primary_attack]
decides the defense animation and [secondary_attack]
decides the attack animation, but both select a weapon on the attacker. So, for example, you could make an Elvish Sylph use a melee defense animation against a ranged attack. I think normally best practice would be to set both filters to be the same.Re: Using [harm_unit] within a cut-scene
I'm quite sure that's what we arrived at too, and it doesn't seem to function properly. If both are set toCeltic_Minstrel wrote: ↑November 22nd, 2020, 5:51 pm EDIT2: So if the wiki is right it sounds like[primary_attack]
decides the defense animation and[secondary_attack]
decides the attack animation, but both select a weapon on the attacker. So, for example, you could make an Elvish Sylph use a melee defense animation against a ranged attack. I think normally best practice would be to set both filters to be the same.
range=melee
like this:
Code: Select all
[harm_unit]
[filter]
x,y=10,11 # position for my test orc
[/filter]
[filter_second]
x,y=10,10 # position for my test orc
[/filter_second]
[primary_attack]
range=melee
[/primary_attack]
[secondary_attack]
range=melee
[/secondary_attack]
amount=4
animate=yes
[/harm_unit]
range=melee
is ambiguous, I guess that's the one that gets chosen first.So ff we want to set which attack in specific to use, and we set both to
name=pincers
, only the attacker is animated, and the defender animation is missing.
Code: Select all
[harm_unit]
[filter]
x,y=10,11
[/filter]
[filter_second]
x,y=10,10
[/filter_second]
[primary_attack]
name=pincers
[/primary_attack]
[secondary_attack]
name=pincers
[/secondary_attack]
amount=4
animate=yes
[/harm_unit]
name
. If you can confirm that this is indeed a bug, I could open a github issue for it.Main UMC campaigns: The Ravagers - now for 1.16, with new bugs!
Old UMC works: The Underness Series, consisting of 5 parts: The Desolation of Karlag, The Blind Sentinel, The Stone of the North, The Invasion Of The Western Cavalry, Fingerbone of Destiny
Old UMC works: The Underness Series, consisting of 5 parts: The Desolation of Karlag, The Blind Sentinel, The Stone of the North, The Invasion Of The Western Cavalry, Fingerbone of Destiny
- Celtic_Minstrel
- Developer
- Posts: 2233
- Joined: August 3rd, 2012, 11:26 pm
- Location: Canada
- Contact:
Re: Using [harm_unit] within a cut-scene
Try setting the first one to range=melee and the second one to name=pincers.
Re: Using [harm_unit] within a cut-scene
That would animate both, but it will use the sting animation, not the pincers. It looked and sounded exactly the same as range=melee for both.Celtic_Minstrel wrote: ↑November 22nd, 2020, 8:09 pm Try setting the first one to range=melee and the second one to name=pincers.
Please see and try attached file.
It sets the primary to type=impact (pincers animation) and tries all variations for secondary.
None of them will illicit a defense animation from either the bowman or the orchish assassin.
Code: Select all
{MOVE_HARM 1 (type=impact) (range=melee)}
{MOVE_HARM 2 (type=impact) (range=melee)}
{MOVE_HARM 3 (type=impact) (range=ranged)}
{MOVE_HARM 4 (type=impact) (range=ranged)}
{MOVE_HARM 5 (type=impact) (type=blade)}
{MOVE_HARM 6 (type=impact) (type=blade)}
{MOVE_HARM 7 (type=impact) (type=impact)}
{MOVE_HARM 8 (type=impact) (type=impact)}
{MOVE_HARM 9 (type=impact) (type=pierce)}
{MOVE_HARM 10 (type=impact) (type=pierce)}
{MOVE_HARM 11 (type=impact) (name=pincers)}
{MOVE_HARM 12 (type=impact) (name=pincers)}
{MOVE_HARM 13 (type=impact) (name=sting)}
{MOVE_HARM 14 (type=impact) (name=sting)}
{MOVE_HARM 15 (type=impact) (name=whatever)}
{MOVE_HARM 16 (type=impact) (name=whatever)}
{MOVE_HARM 17 (type=impact) ()}
{MOVE_HARM 18 (type=impact) ()}
I tried the following and it didn't work either.
Code: Select all
{MOVE_HARM 1 (type=impact) (name=dagger)}
{MOVE_HARM 2 (type=impact) (name=dagger)}
{MOVE_HARM 3 (type=impact) (name=throwing knives)}
{MOVE_HARM 4 (type=impact) (name=throwing knives)}
{MOVE_HARM 5 (type=impact) (name=short sword)}
{MOVE_HARM 6 (type=impact) (name=short sword)}
{MOVE_HARM 7 (type=impact) (name=bow)}
{MOVE_HARM 8 (type=impact) (name=bow)}
- Attachments
-
- _main.cfg
- (6.96 KiB) Downloaded 143 times
Last edited by vghetto on November 22nd, 2020, 9:59 pm, edited 1 time in total.
- Celtic_Minstrel
- Developer
- Posts: 2233
- Joined: August 3rd, 2012, 11:26 pm
- Location: Canada
- Contact:
Re: Using [harm_unit] within a cut-scene
I'm not clear on whether there's a real bug here but I think there's definitely an issue - the situation is confusing at best, broken at worst. From what I can tell, it might not be limited to
[harm_unit]
- it seems like there's something weird about [animate_unit]
as well. I don't understand why it needs a primary and secondary attack for a single animation… can anyone think of anything that would need that? Keeping in mind that the defend animation and the attack animation are two separate animations that just play simultaneously.Re: Using [harm_unit] within a cut-scene
But the code with [animate_unit] that did the same thing seems to have worked.Celtic_Minstrel wrote: ↑November 22nd, 2020, 9:56 pm it might not be limited to[harm_unit]
- it seems like there's something weird about[animate_unit]
as well.
Though it is true, that here the primary attack is different in [animate_unit] and [animate]. For the former, it's pincers for both and for the latter, the primary attack is actually the orc's dagger.
So maybe there's something wrong/not well enough thought-out about how [harm_unit] calls [animate_unit]? I didn't look at the implementation, I'm just guessing.
I don't quite understand the need for primary and secondary filters either. The wiki doesn't make it much clearer:
This emphasis on "may be needed" sounds like this is needed in some cases as a workaround for something?[secondary_attack]: Similar to [primary_attack]. May be needed to trigger a defense animation correctly, if there are more than one animations available for the defending unit.
Main UMC campaigns: The Ravagers - now for 1.16, with new bugs!
Old UMC works: The Underness Series, consisting of 5 parts: The Desolation of Karlag, The Blind Sentinel, The Stone of the North, The Invasion Of The Western Cavalry, Fingerbone of Destiny
Old UMC works: The Underness Series, consisting of 5 parts: The Desolation of Karlag, The Blind Sentinel, The Stone of the North, The Invasion Of The Western Cavalry, Fingerbone of Destiny
Re: Using [harm_unit] within a cut-scene
I'm not sure how you came to the conclusion that the name must be the same for both. Could you explain that part please?WhiteWolf wrote: ↑November 22nd, 2020, 11:15 pm But the code with [animate_unit] that did the same thing seems to have worked.
Though it is true, that here the primary attack is different in [animate_unit] and [animate]. For the former, it's pincers for both and for the latter, the primary attack is actually the orc's dagger.
I just tried your code and I set primary to name=pincers and secondary to name=gabagaba and it worked just as well as before.
for the flag=defend block you could have set both to blank and it would have worked.
I just tried leaving the primary empty and the secondary to name=hubahuba and again that worked!
The only one that was required seemed to have been primary name=pincers (or type=impact) in the flag=attack block, the rest could have been omitted.
Edit: It looks like the text line should be moved to the defend block
Edit2: OP, omit the text line completely if harm_unit is called straight after the animate_unit.
for completeness this seems to mimic the desired effect. It is WhiteWolf's code above, I included with_bars=yes to both.
Code: Select all
{REPEAT 3 (
[animate_unit]
flag=attack
[filter]
x,y=11,"$({Y}+1)"
[/filter]
[primary_attack]
{PRIMARY}
[/primary_attack]
[secondary_attack]
[/secondary_attack]
hits=yes
with_bars=yes
[facing]
x,y=10,{Y}
[/facing]
[animate]
flag=defend
[filter]
x,y=10,{Y}
[/filter]
[primary_attack]
[/primary_attack]
[secondary_attack]
[/secondary_attack]
hits=yes
with_bars=yes
#text= _ "<span color='red'>4</span>"
[facing]
x,y=11,"$({Y}+1)"
[/facing]
[/animate]
[/animate_unit]
[harm_unit]
[filter]
x,y=10,{Y}
[/filter]
[filter_second]
x,y=11,"$({Y}+1)"
[/filter_second]
amount=4
animate=no
experience=yes
[/harm_unit]
)}
In harm_unit, the lua doesn't flip them! Maybe that has something to do with it?
Edit4: Ok, seems that was the bug with harm_unit, it uses the correct filter in defend
T.filter { id = unit_to_harm.id }
but it didn't flip the primary and secondary attacks.- Celtic_Minstrel
- Developer
- Posts: 2233
- Joined: August 3rd, 2012, 11:26 pm
- Location: Canada
- Contact:
Re: Using [harm_unit] within a cut-scene
It's possible. From what I can tell, it looks like using
[harm_unit]
is equivalent to two separate [animate_unit]
calls, one for the attack and one for the defend… which does seem wrong.Re: Using [harm_unit] within a cut-scene
Don't you need them to be separate if the units are not adjacent?Celtic_Minstrel wrote: ↑November 23rd, 2020, 2:38 amIt's possible. From what I can tell, it looks like using[harm_unit]
is equivalent to two separate[animate_unit]
calls, one for the attack and one for the defend… which does seem wrong.
- Celtic_Minstrel
- Developer
- Posts: 2233
- Joined: August 3rd, 2012, 11:26 pm
- Location: Canada
- Contact:
Re: Using [harm_unit] within a cut-scene
I'm pretty sure you don't, but you'd have to try it, I guess.
Generally speaking, I believe you need to use the nested
Generally speaking, I believe you need to use the nested
[animate]
block in [animate_unit]
if you want multiple animations to play simultaneously.Re: Using [harm_unit] within a cut-scene
I tried it and you're correct.Celtic_Minstrel wrote: ↑November 23rd, 2020, 6:12 am I'm pretty sure you don't, but you'd have to try it, I guess.
The difference seems to be a scroll between attacker and defender. I tried setting delay=0 but it still felt much slower and not simultaneous like animate_unit with an enclosed animate.
Maybe that's something that can be looked into at a future date.