Register FAQ Search Today's Posts Mark Forums Read
Go Back   JazzJackrabbit Community Forums » Maintenance & Feedback » JJ2+ Issue Tracker

Feature Request Hook function for collisions between players and other players/bullets

froducish

JCF Member

Joined: Jan 1970

Posts: 8

froducish has disabled reputation

Jun 7, 2025, 10:24 AM
froducish is offline
Reply With Quote
Hook function for collisions between players and other players/bullets

JJ2+'s AngelScript API currently doesn't provide a straight-forward way to determine what to do when collision occurs between players and other players/bullets. The closest to this is onRoast which doesn't cover all cases.

Example of such a hook's function signature:
Code:
void onCollide(jjPLAYER@ victim, jjPLAYER@ collider, COLLIDE::Collide collision, jjOBJ@ bullet)
where COLLIDE::Collide is what type of collision it is, and bullet is non-null if collision's value is COLLIDE::BULLET or something.

In fact, I already made a mutator (https://www.jazz2online.com/download...on-detector-v2) that attempts to do this because I'm working on a script that sometimes needs to decide what to do when specific collisions happen. Even then, my mutator isn't the most elegant solution, so I think this would be better as a native feature if that's feasible.
Violet CLM

JCF Éminence Grise

Joined: Mar 2001

Posts: 11,119

Violet CLM has disabled reputation

Jun 7, 2025, 06:10 PM
Violet CLM is offline
Reply With Quote
This hook would be called near constantly I think. What's the use case here, what do you want to accomplish by having such a hook?
__________________
froducish

JCF Member

Joined: Jan 1970

Posts: 8

froducish has disabled reputation

Jun 8, 2025, 11:15 AM
froducish is offline
Reply With Quote
Quote:
Originally Posted by Violet CLM View Post
This hook would be called near constantly I think. What's the use case here, what do you want to accomplish by having such a hook?
With the hook I want to be able to affect players in other ways besides from just being hurt.
Quote:
Originally Posted by froducish View Post
[...] because I'm working on a script [...]
To clarify a bit on this, the script involves a player gambling to obtain an effect that's either a benefit or a drawback for them. Some effects will check if the player got hurt (or hurts another player) then based on that will decide to either modify either player's properties or do something else (e.g. spawning an object). This sounds like it could be just onHurt instead but I also want to affect non-enemy players sometimes so I also use onCollide for collisions that would've hurt.
For bullet-based collisions sure I could just override a bullet's behavior but this script I mentioned is designed as carefully as possible to not conflict with custom weapons, so that's not an option for me. I realize this suggestion may be a rather niche use case though
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT -8. The time now is 02:59 AM.