Incendiary / molotov grenades #214
-
We dont have "fire" grenades events. All other grenades have a "detonate" event, but incendiary / molotov doesnt. Apparently https://github.com/akiver/CSGO-Demos-Manager have it all. Maybe we can parse in a different way, based on them. |
Beta Was this translation helpful? Give feedback.
Replies: 9 comments 1 reply
-
Use the 'inferno_startburn' event |
Beta Was this translation helpful? Give feedback.
-
@saul, it can be used for both? How can i identify the "thrower"? |
Beta Was this translation helpful? Give feedback.
-
There's an entityindex event variable that can be passed into |
Beta Was this translation helpful? Give feedback.
-
It worked! Thanks. |
Beta Was this translation helpful? Give feedback.
-
Does the demoFile.gameEvents.on('inferno_startburn', e => {
let grenade = demoFile.entities.entities[e.entityid];
let type = grenade.className;
let position = grenade.position;
let thrower = grenade.owner;
}); |
Beta Was this translation helpful? Give feedback.
-
Use |
Beta Was this translation helpful? Give feedback.
-
Does grenade.serverClass.name still work? The name is always the same. |
Beta Was this translation helpful? Give feedback.
-
Sorry for the delay. I have found another method which involves listening (heh) for the explosion sound to be emitted: //const SEED = 1146049601;
const molotovExplode = 3580951569; // murmurHash2("inferno.start", SEED);
const incExplode = 1110819271; // murmurHash2("inferno.start_incgrenade", SEED);
demoFile.on("svc_Sounds", e => {
for (const sound of e.sounds) {
if (
sound.soundNumHandle !== molotovExplode &&
sound.soundNumHandle !== incExplode
) {
continue;
}
const inferno = (demoFile.entities.entities.get(
sound.entityIndex
) as unknown) as BaseEntity<CInferno>;
const pos = inferno.position;
const thrower = inferno.owner as Player;
const isMolotov = sound.soundNumHandle === molotovExplode;
console.log(
`${isMolotov ? "Molotov" : "Incendiary"} thrown by ${
thrower.name
} exploded at (${pos.x},${pos.y},${pos.z})`
);
}
}); Should print similar to:
Hope that helps. |
Beta Was this translation helpful? Give feedback.
-
demoFile.gameEvents.on('inferno_startburn', e => { granade is as undefined in all events |
Beta Was this translation helpful? Give feedback.
Sorry for the delay. I have found another method which involves listening (heh) for the explosion sound to be emitted: