Please read the following description before using this.
The basic story behind this mutator is that I wanted an onHurt hook, but that doesn't exist in the API. There doesn't seem to be a straightforward way to check for collisions in the current API either, but whipping that up was easier than a theoretical onHurt, so thus the birth of this mutator, good enough.
This mutator isn't really meant to be used standalone. Rather, it's meant to be used as a library. A simple example of this is in player_collision_example.mut
. Only player_collision_detector.mut
and player_collision_detector_header.asc
are needed if you plan to use it.
———
COLLIDE::getDetector() returns the object where you can interact with the detector. If your plus.ini
file contains the line AngelscriptDebug=True
under [General]
then messages will be logged to your chatlog window if the function fails for whatever reason.
It is important to note that the methods described above only apply to the local player. This does not matter if you use them in a hook that is called for all players (e.g., onLevelLoad, onLevelBegin), but if these are not your use cases then you must consider this. On the other hand, the methods listed below will affect all players:
———
Any function can be passed as the first argument to setHook as long it has the signature void function(jjPLAYER@ victim, jjPLAYER@ collider, COLLIDE::Collide collision, uint8 eventID) The first two parameters are self-explanatory. The third parameter is the type of collision that gets passed in as an argument. Possible values are:The fourth parameter, if collision is COLLIDE::BULLET or COLLIDE::BULLETPU, is the event ID of the bullet that collided with the victim player. This value may be useful, especially if passed as an argument to the function:
jjOBJ@ COLLIDE::getProbableBulletAccordingToThisCollision(const jjPLAYER@ victim, const jjPLAYER@ collider, uint8 eventID)
Since onCollide gives you access to victim, collider, and eventID, it's only natural to pass them as arguments to the above function. The function returns a jjOBJ@ that is likely the bullet that collided with the victim. Note the emphasis on likely since the function cannot guarantee it's the same bullet (or that it even returns non-null at all!) since all objects are copies for each client. This function isn't very useful outside of onCollide but you're technically allowed to do that.
———
Change Log:
May 2, 2025 2 AM UTC (starting with this upload)
- Bullet detection no longer relies on overriding their default behavior. This means custom weapons should be less broken now.
- Reduced amount of packets being sent to update a player's buttstomp/special move status.
- Reduced amount of packets being sent to trigger onCollide for buttstomp, special moves, and bumps.
- Made bump collision detection a bit more accurate by accounting for directions, speed, and ignoring blinking players.
- Bump collision detection is now done at the bumper's side instead of the bumped's side.
- Fixed secondary detection incorrectly relying on rabbit animations for frog and bird players.
- New parameter added to onCollide: eventID. If a collision comes from a bullet then this is set to its corresponding OBJECT::Object constant. The value has no meaning if the collision stems from player movements.
- New experimental function added: jjOBJ@ COLLIDE::getProbableBulletAccordingToThisCollision(const jjPLAYER@ victim, const jjPLAYER@ collider, uint8 eventID) – to be used inside onCollide. See above description for more details.
- Separated COLLIDE::STOMPORRUSH to COLLIDE::STOMP and COLLIDE::SUGARRUSH
Apr. 12, 2025 1 AM UTC
- The detection algorithm was revamped to do a second check after a potential region of collision is detected. This second check relies on a timeout mechanism, which should catch more cases than the previous versions, but that's not fully guaranteed.
Apr. 11, 2025 5 PM UTC
- Splitscreeners now supported.
Mar. 14, 2025 4 AM UTC
- Bullet detection no longer uses onObjectHit as this caused issues with some objects overriding their own default behavior. The drawback of this is that if the player being shot is not an enemy, the detection will be less accurate.
Mar. 1, 2025 4 PM UTC
- Fixed a potential issue with RF bullets.
Feb. 19, 2025 10 PM UTC
- Fixed bugs that caused some weapons to be in an infinite exploding state and Gun8 not firing for the local player.
Feb. 19, 2025 6 AM UTC
- First release
![]() |
Player-to-Player Collision Detector | 12.81 kB |
![]() |
2.43 kB | |
![]() |
1.61 kB |
You must log in to write a comment or review.
Jazz2Online © 1999-INFINITY (Site Credits). We have a Privacy Policy. Jazz Jackrabbit, Jazz Jackrabbit 2, Jazz Jackrabbit Advance and all related trademarks and media are ™ and © Epic Games. Lori Jackrabbit is © Dean Dodrill. J2O development powered by Loops of Fury and Chemical Beats.
Eat your lima beans, Johnny.