PDA

View Full Version : Problem in Dota 2 scripting


Equiment
10-12-2014, 16:02
Good day!
Excuse me, if created topic in the wrong section.
I hooked death event in Dota 2 and server all time give me 0 userid - console (so it think that died console, not player). Tried events "dota_player_kill" and "dota_player_killed".
Can someone help me?

Equiment
10-16-2014, 17:14
Someone knows how to fix it?

Equiment
10-29-2014, 17:11
I n e e d y o u r h e l p.

Powerlord
10-29-2014, 17:16
If you're using player_death, have you tried using dota_player_kill (https://wiki.alliedmods.net/Dota_2_Events#dota_player_kill) instead?

Equiment
10-30-2014, 12:10
Powerlord, yep > Tried events "dota_player_kill" and "dota_player_killed".

psychonic
10-30-2014, 12:19
entity_killed

Equiment
10-30-2014, 18:36
psychonic, don't work ;(

psychonic
10-30-2014, 19:35
psychonic, don't work ;(
I respectfully disagree.

Equiment
10-31-2014, 03:08
Psychonic, it return 0 userid

psychonic
10-31-2014, 07:41
There is no "userid" field in that event.

"entity_killed"
{
"entindex_killed" "long"
"entindex_attacker" "long"
"entindex_inflictor" "long"
"damagebits" "long"
}

Equiment
10-31-2014, 07:52
Psychonic, k, how can I pick player from entindex.killed?

psychonic
10-31-2014, 08:58
That field is the entity index / client index of the player, the same value used for GetClientName, GetClientAuthId, etc.

If you need the user id from it, you can use GetClientUserId.

Equiment
10-31-2014, 09:33
GetClientOfUserId return 0 in this func :(

psychonic
10-31-2014, 09:36
GetClientOfUserId return 0 in this func :(
GetClientOfUserId isn't applicable since the value is an entity index, not a userid.

Additionally, not all entities killed will be clients. Creeps, neutrals, towers, Roshan, etc. are all entities.

Equiment
10-31-2014, 10:51
[SM] Native "GetClientUserId" reported: Client index 92 is invalid

asherkin
10-31-2014, 11:04
Additionally, not all entities killed will be clients. Creeps, neutrals, towers, Roshan, etc. are all entities.

Powerlord
10-31-2014, 11:19
...which means you have to make sure if (0 < entindex_killed <= MaxClients). Assuming that DOTA2 supports MaxClients.

Equiment
10-31-2014, 11:21
92 - my id (id of my hero)

Equiment
10-31-2014, 11:28
Powerlord, do this, now its nothing printed.

psychonic
10-31-2014, 12:47
If it's giving the hero index, you can loop through all players on the server and see which one has control of that hero. It's stored in a sendprop on the player, m_hHeroEntity or something similarly named. GetEntPropEnt can read it to compare to the index.

Equiment
10-31-2014, 14:25
Right, done, thanks to all of you :)