English How does the bomb explode hook work?

4 replies
Goto Page
To the start Previous 1 Next To the start
Up
I couldn't find enough information about it, but how does the cs2d lua hook bombexplode hook work?

The player parameter to be precise, is what I'm asking.

What happens if the player that planted the bomb leaves the game?
Will it still send their ID, or will it not call it at all? Or perhaps, it will send
0
?

Thank you.
fish
23.05.21 06:45:14 pm
Up
Masea
Super User
Offline Off
That's not hard to see it yourself. You can even test it via bots, I believe.
23.05.21 07:07:32 pm
Up
DC
Admin
Offline Off
That hook is always called. Even if the bomb planter left and even if the bomb item on the map is removed (in the latter case x and y will be 0).

It looks like the player ID will still contain the ID of the player who planted the bomb. Even if that player already left / a new player joined and received the same ID.

The same value is also used for the scoring system. Therefore this special edge case can probably even lead to a bug (wrong player getting extra score for bomb planting without planting it at all).
www.UnrealSoftware.de | www.CS2D.com | www.CarnageContest.com | Use the forum & avoid PMs!
23.05.21 10:09:20 pm
Up
I see, I think that should be documented on the website.

Also, will that ever change, or should I override the game action with a Lua script of my own?


EDIT:
It appears that you get the score for planting the bomb even if the bomb doesn't end up exploding (returned 1 on the cs2d lua hook bombexplode).
edited 4×, last 23.05.21 11:24:26 pm
fish
23.05.21 11:06:14 pm
Up
DC
Admin
Offline Off
I guess it's a bug that the score is still affected when you return 1 in the hook. Can't tell you if this will be changed/fixed some day. Probably not.

Regarding range:
See cs2d entity info_bombspot - it's in int[0]. You can use cs2d lua cmd entity to get that value.

The explosion damage value is 500 when you're exactly in the center of the explosion. The default range (when a range of 0 is specified) is 400.
www.UnrealSoftware.de | www.CS2D.com | www.CarnageContest.com | Use the forum & avoid PMs!
To the start Previous 1 Next To the start