Hi there.
I'd like some melee monsters to start their attack animation, but then choose from one of two possible ends of the animation depending on if they successful hit their target or not. Is it possible? I'm guessing it might be based on the fact that it could be done with the sound, just like in the revenant's punch (it is 'hard-code' side, but still...).
Thanks in advance!
[DECORATE] Make monster 'know' if it hits target.
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.
Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.
Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
-
Ravick
- Posts: 2053
- Joined: Sun Aug 22, 2010 10:59 pm
- Location: Tubarão, Brasil
-
Matt
- Posts: 9696
- Joined: Sun Jan 04, 2004 5:37 pm
- Preferred Pronouns: They/Them
- Operating System Version (Optional): Debian Bullseye
- Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia
Re: [DECORATE] Make monster 'know' if it hits target.
Does it have to be DECORATE? This seems to be exactly the sort of thing we have ZScript (and pointers and custom functions with returns and thinkers, etc.) for...
Use of +HITTRACER, A_GiveToTarget, A_RearrangePointers, etc. can help you transfer this information using inventory items and pointers even without ZS, but it will only be able to tell if an actor had been hit (not necessarily the target).
Use of +HITTRACER, A_GiveToTarget, A_RearrangePointers, etc. can help you transfer this information using inventory items and pointers even without ZS, but it will only be able to tell if an actor had been hit (not necessarily the target).
-
Arctangent
- Posts: 1235
- Joined: Thu Nov 06, 2014 1:53 pm
Re: [DECORATE] Make monster 'know' if it hits target.
Actually, monster melee attacks don't use hitscans. If it's possible to hit the target ( i.e. they're in range and there's no line of sight blockers between them and the monster, keeping in mind that other actors don't block line of sight ) then they hit the target. That's why it's impossible to cause infighting between melee monsters.Matt wrote:Use of +HITTRACER, A_GiveToTarget, A_RearrangePointers, etc. can help you transfer this information using inventory items and pointers even without ZS, but it will only be able to tell if an actor had been hit (not necessarily the target).
-
Ravick
- Posts: 2053
- Joined: Sun Aug 22, 2010 10:59 pm
- Location: Tubarão, Brasil
Re: [DECORATE] Make monster 'know' if it hits target.
I like to share some stuff with some zandronum modder friends, thats why I usually use DECORATE (well, that and the fact I'm still TOO MUCH noob in ZScript). I wouldn't even know where to start.
I guess I'll try a distance check them. But it'd bug when its target is behind a line that is suposed to be glass or so.
I guess I'll try a distance check them. But it'd bug when its target is behind a line that is suposed to be glass or so.
-
Arctangent
- Posts: 1235
- Joined: Thu Nov 06, 2014 1:53 pm
Re: [DECORATE] Make monster 'know' if it hits target.
It'd also bug if the target is behind any line of sight blocker that is thin enough to still leave the target in range. This is why something like [wiki]A_JumpIfTargetInLOS[/wiki] is important.Ravick wrote:I guess I'll try a distance check them. But it'd bug when its target is behind a line that is suposed to be glass or so.
-
Ravick
- Posts: 2053
- Joined: Sun Aug 22, 2010 10:59 pm
- Location: Tubarão, Brasil
Re: [DECORATE] Make monster 'know' if it hits target.
Good thinking! I'll use that. Thanks! 
-
Matt
- Posts: 9696
- Joined: Sun Jan 04, 2004 5:37 pm
- Preferred Pronouns: They/Them
- Operating System Version (Optional): Debian Bullseye
- Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia
Re: [DECORATE] Make monster 'know' if it hits target.
No one is required to use that, though. In fact, my first instinct is typically to use a short-range invisible projectile, just because it's so much simpler to add more complex behaviours (blocking, etc.) if desired.Arctangent wrote:Actually, monster melee attacks
(and beyond that I'm pretty sure there is actually a line check involved even if no puff is necessarily generated... and I'm not sure that there is no no puff without looking it up)
-
Arctangent
- Posts: 1235
- Joined: Thu Nov 06, 2014 1:53 pm
Re: [DECORATE] Make monster 'know' if it hits target.
I think there technically is ... but not for determining whether or not the attack hits, but rather for determining where blood decals spray. Check the definition of a typical monster attack function - it's nothing more than a check if the target is in range, and if so, deal damage, play a sound, and cause it to bleed. Otherwise, do the projectile attack instead. Even dedicated melee attack functions, like the pinkies', work the same way.Matt wrote:(and beyond that I'm pretty sure there is actually a line check involved even if no puff is necessarily generated... and I'm not sure that there is no no puff without looking it up)
And yes, CheckMeleeRange() doesn't have line trace snuck in.
And sure, all of this means that standard monster melee attacks aren't suited for things like making that barriers and barricades block 'em ... but I feel like you're overestimating the amount of mods that do stuff like that, especially considering this is about basically doing what the vanilla revenant does, but with more flare and polish.