Page 1 of 1

Smash-bros style hitboxes?

Posted: Sun Mar 24, 2019 11:14 am
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.

Re: Smash-bros style hitboxes?

Posted: Sun Mar 24, 2019 11:28 am
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.

Re: Smash-bros style hitboxes?

Posted: Sun Mar 24, 2019 2:19 pm
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.

Re: Smash-bros style hitboxes?

Posted: Sun Mar 24, 2019 4:30 pm
by Arctangent
TDRR wrote:But what would be a good formula for kickback ramp-up?
The one the games themselves use, I'd imagine.