Skip to content

SmokeStart events report incorrect e.GrenadeEvent.Grenade.UniqueID2() #596

@dankotov

Description

@dankotov

Describe the bug
Some SmokeStart events report incorrect e.GrenadeEvent.Grenade.UniqueID2().

To Reproduce
Match: https://www.hltv.org/matches/2383258/leo-vs-novaq-galaxy-battle-2025-phase-3
Map: de_dust2

In round 4, neaLaN (Novaq team, T side) throws 3 smokes, with the first smoke being thrown at tick 24851, the second smoke at tick 26065 and the third smoke at tick 27369.

Code:

func x() {
...
p.RegisterEventHandler(func(e events.GrenadeProjectileThrow) {
  if e.Projectile.WeaponInstance.Type.String() == "Smoke Grenade" {
    fmt.Println("SMOKE THROWN", e.Projectile.WeaponInstance.UniqueID2(), p.GameState().IngameTick())
  }
})

p.RegisterEventHandler(func(e events.SmokeStart) {
  fmt.Println("SMOKE EXPLODED", e.GrenadeEvent.Grenade.UniqueID2(), p.GameState().IngameTick())
})

p.RegisterEventHandler(func(e events.GrenadeProjectileDestroy) {
  if e.Projectile.WeaponInstance.Type.String() == "Smoke Grenade" {
    fmt.Println("SMOKE DESTROYED", e.Projectile.WeaponInstance.UniqueID2(), p.GameState().IngameTick())
  }
})
...
}

The code above produces the following logs:

SMOKE THROWN 01JYCX0CTXM4BEQ2ANTW7M2QWC 24851
SMOKE EXPLODED 01JYCX0CTXM4BEQ2ANTW7M2QWC 25319
SMOKE THROWN 01JYCX0CXBW6M6E9CBRPPX4E5N 26065
SMOKE EXPLODED 01JYCX0CTXM4BEQ2ANTW7M2QWC 26420
SMOKE DESTROYED 01JYCX0CTXM4BEQ2ANTW7M2QWC 26731
SMOKE THROWN 01JYCX0CQD26J747ATW8AK7PRB 27369
SMOKE EXPLODED 01JYCX0CXBW6M6E9CBRPPX4E5N 27540
SMOKE DESTROYED 01JYCX0CXBW6M6E9CBRPPX4E5N 27832
SMOKE DESTROYED 01JYCX0CQD26J747ATW8AK7PRB 28952

By looking at the demo for each of the ticks from the logs, I can group these logs logically into groups for each grenade like so:

SMOKE THROWN 01JYCX0CTXM4BEQ2ANTW7M2QWC 24851
SMOKE EXPLODED 01JYCX0CTXM4BEQ2ANTW7M2QWC 25319
SMOKE DESTROYED 01JYCX0CTXM4BEQ2ANTW7M2QWC 26731

SMOKE THROWN 01JYCX0CXBW6M6E9CBRPPX4E5N 26065
SMOKE EXPLODED 01JYCX0CTXM4BEQ2ANTW7M2QWC 26420
SMOKE DESTROYED 01JYCX0CXBW6M6E9CBRPPX4E5N 27832

SMOKE THROWN 01JYCX0CQD26J747ATW8AK7PRB 27369
SMOKE EXPLODED 01JYCX0CXBW6M6E9CBRPPX4E5N 27540
SMOKE DESTROYED 01JYCX0CQD26J747ATW8AK7PRB 28952

This grouping can be confirmed by actually looking at the demo to verify the "explosion" ticks for each grenade and then using those in combination with the notion that smokes last for a constant amount of time, i.e. SMOKE_EXPLODED_TICK - SMOKE_DESTROYED_TICK should be equal and constant for each smoke, which, using this grouping, they are (1412 ticks).

However, as you can see, the IDs of the grenades in the explosion logs go haywire after the second smoke is thrown, where each following smoke explosion log has the ID of the previous one.

Expected behavior
Each SmokeStart event should report the appropriate ID, meaning the logs should look like this (granted, in a different order, but grouping here for readability):

SMOKE THROWN 01JYCX0CTXM4BEQ2ANTW7M2QWC 24851
SMOKE EXPLODED 01JYCX0CTXM4BEQ2ANTW7M2QWC 25319
SMOKE DESTROYED 01JYCX0CTXM4BEQ2ANTW7M2QWC 26731

SMOKE THROWN 01JYCX0CXBW6M6E9CBRPPX4E5N 26065
SMOKE EXPLODED 01JYCX0CXBW6M6E9CBRPPX4E5N 26420
SMOKE DESTROYED 01JYCX0CXBW6M6E9CBRPPX4E5N 27832

SMOKE THROWN 01JYCX0CQD26J747ATW8AK7PRB 27369
SMOKE EXPLODED 01JYCX0CQD26J747ATW8AK7PRB 27540
SMOKE DESTROYED 01JYCX0CQD26J747ATW8AK7PRB 28952

Library version
v4.3.3

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions