-
@saul are you aware about an issue regarding grenade_bounce event not triggering? |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments
-
There is no grenade_bounce event as far as I’m aware. Are you looking for hegrenade_bounce, flashbang_bounce etc.? |
Beta Was this translation helpful? Give feedback.
-
Thanks for replying @saul :) |
Beta Was this translation helpful? Give feedback.
-
Okay so I was completely wrong about the Instead use this code: function printGrenadeLocation(grenade) {
let modelParts = grenade.modelName.split('/');
console.log('%d(%s) %O', grenade.handle, modelParts[modelParts.length-1], grenade.position);
}
demoFile.entities.on('postcreate', e => {
if (e.entity.getProp('DT_BaseCSGrenadeProjectile', 'm_nBounces') === undefined)
return;
printGrenadeLocation(e.entity);
});
demoFile.entities.on('change', e => {
if (e.varName !== 'm_nBounces')
return;
printGrenadeLocation(e.entity);
}); Here we exploit the fact that when a grenade bounces, its Output is like:
Note you'll need to update to demofile 0.4.18 for the above to work! I've just added BaseEntity#modelName. Any questions let me know. |
Beta Was this translation helpful? Give feedback.
-
Let me know if you have any other questions. |
Beta Was this translation helpful? Give feedback.
-
Thank you so much @saul ! It works :) |
Beta Was this translation helpful? Give feedback.
Okay so I was completely wrong about the
hegrenade_bounce
etc events. However you're right in that it looks like the grenade_bounce event isn't in the demo files. Even if it was, it has no useful information.Instead use this code: