Name | Author | Game Mode | Rating | |||||
---|---|---|---|---|---|---|---|---|
![]() |
Player-to-Player Collision... | froducish | Mutator | N/A | ![]() |
#pragma require "player_collision_detector_interface.asc"
#include "player_collision_detector_interface.asc"
COLLIDE::DetectorI@ collisionDetector;
void onLevelLoad() {
@collisionDetector = COLLIDE::getDetector(true);
if (collisionDetector !is null) {
// setHook actually takes two arguments: function that will be called when a collision is detected (COLLIDE::HOOK@) and the module ID (uint)
// These arguments are already filled for you (setHook assumes you have a global function named onCollide, and the module ID is set to this script module's ID)
// However, if you want to provide a different funcion instead then you may do say by calling setHook(myFunction). You could even provide a different ID by calling
// setHook(myFunction, id), but this is not a good idea!
collisionDetector.setHook();
// Don't forget to call this to get the hook actually working. If you have any weapons modified
// in other script files, then make sure this is the last thing that gets called.
collisionDetector.startDetecting();
}
}
void onCollide(jjPLAYER@ victim, jjPLAYER@ collider, COLLIDE::Collide collision) {
array<string> labels = {"BULLET", "BULLETPU", "BUMP", "STOMPORRUSH", "SPECIALMOVE"};
jjSamplePriority(SOUND::RAPIER_HITCHAR);
jjAlert("[" + jjLocalPlayers[0].nameUnformatted + "] " + collider.nameUnformatted + " collided with " + victim.nameUnformatted + " via " + labels[collision]);
}
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.