Smash-bros style hitboxes?

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!

Moderator: GZDoom Developers

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!)
Post Reply
User avatar
TDRR
Posts: 831
Joined: Sun Mar 11, 2018 4:15 pm
Location: Venezuela

Smash-bros style hitboxes?

Post by TDRR »

I know most of my questions are left unanswered (probably because they are too hard?) but after goofing around myself i couldn't find a way to do this.

Basically, what i want is hitboxes that when touched (except by the person who spawned them obviously) do these things to the opponent: give a certain amount of a inventory item, send the opponent flying with a set force and angle (also taking into account how much of the previous inventory item there is) and cause some animation.

Unlike all my previous questions though, this time ZScript is allowed and prefered, but if you have any other method of doing it that is also acceptable.
User avatar
Cherno
Posts: 1337
Joined: Tue Dec 06, 2016 11:25 am

Re: Smash-bros style hitboxes?

Post by Cherno »

Writing a complete working example would require hours of testing, so I'll just try to describe how it would work in my mind.

Hitboxes themselves are no problem of course. Just spawn them via Spawn(), store the return value (the spawned actor) in a variable and then use this reference to make the actor a child. I think Spawn() also allows to do this directly with a flag.
Now, in the hitbox' overridden Tick() function, position it relative to the master. Also check for the existence of a master beforehand to avoid potential null reference errors.

What's left is the damage receiving functionality. Override DamageMobj and pass the damage along to the master, and also do any of the additional stuff like thrusting and item giving.

I don't know how well versed you are in zScript so I don't know how much of this makes sense to you.
User avatar
TDRR
Posts: 831
Joined: Sun Mar 11, 2018 4:15 pm
Location: Venezuela

Re: Smash-bros style hitboxes?

Post by TDRR »

Cherno wrote:Writing a complete working example would require hours of testing, so I'll just try to describe how it would work in my mind.

Hitboxes themselves are no problem of course. Just spawn them via Spawn(), store the return value (the spawned actor) in a variable and then use this reference to make the actor a child. I think Spawn() also allows to do this directly with a flag.
Now, in the hitbox' overridden Tick() function, position it relative to the master. Also check for the existence of a master beforehand to avoid potential null reference errors.

What's left is the damage receiving functionality. Override DamageMobj and pass the damage along to the master, and also do any of the additional stuff like thrusting and item giving.

I don't know how well versed you are in zScript so I don't know how much of this makes sense to you.
I know C++ (not an expert by any stretch though) ACS and DECORATE, so most of ZScript makes total sense to me. But what would be a good formula for kickback ramp-up? I want something that is somewhat close to Super Smash Bros. (any of the games)

Thanks for the info.

EDIT: I just noticed you told me everything i already tried in DECORATE, i need to thrust depending on the angle, which i can't seem to figure out.
User avatar
Arctangent
Posts: 1235
Joined: Thu Nov 06, 2014 1:53 pm
Contact:

Re: Smash-bros style hitboxes?

Post by Arctangent »

TDRR wrote:But what would be a good formula for kickback ramp-up?
The one the games themselves use, I'd imagine.
Post Reply

Return to “Scripting”