Raised This Month: $9 Target: $400
 2% 

Dota 2 problem


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Equiment
AlliedModders Donor
Join Date: Feb 2014
Old 11-12-2014 , 10:38   Dota 2 problem
Reply With Quote #1

HTML Code:
	new resource = GetPlayerResourceEntity();
	new level = GetEntProp(resource, Prop_Send, "m_iLevel", _, player);
	PrintToChatAll("level %N : %d", player, level);  
Have this error in logfile:

HTML Code:
[SM] Native "GetEntProp" reported: Element 133 is out of bounds (Prop m_iLevel has 10 elements).
And this errors with all resources (like m_iDeath, m_iKills, etc.)
Equiment is offline
psychonic

BAFFLED
Join Date: May 2008
Old 11-12-2014 , 13:40   Re: Dota 2 problem
Reply With Quote #2

Most of the fields on the Player Resource objects in Dota are indexed by a value called player ID, which is between 0-9 inclusive for players on Radiant or Dire, and 10-31 for spectators and broadcasters. Some of the fields have a size of 10, and some 32.

Your value for player is 133, which isn't a player id, or even a player/client entity index. It may be another entity, such as a hero. You can get a player's id by looking at the m_iPlayerID sendprop on the player.
psychonic is offline
Mathias.
Veteran Member
Join Date: Aug 2010
Location: Canada is my city
Old 11-12-2014 , 16:23   Re: Dota 2 problem
Reply With Quote #3

1 thing to note, the ID get fucked up if player are not placed in team in the same order they joined the server.

Let say we got 2 player A, B

B join the game, A join the game A join team Dire, B join Team Radiant, A ID will be 1 but in data storage he is 0 while B ID is 0 but data storage is 1.

If B join the game, A join the game, B join team Dire, A join Team Radiant, A ID will be 1 and the data storage for dota will also be 1.

Player ID = order of player join.
Storage ID = order of player join a team.

EDIT: I've notice your issue. You have a UNIT ID which is kind of different, HEROs have different ID than players but they are owned by one. And just to make things even more clarify, a summoned unit will create new unit that the play is able to control but the owner will be the hero not the player. So here is a little snippet to get the root player owner.

PHP Code:
/* GET THE ATTACKER */
    
int unit_owner GetEntPropEnt(unitProp_Send"m_hOwnerEntity");
        
    
/* UNIT CONTROLLED BY PLAYER OR A SUMMONED UNIT */
    
while (unit_owner >= 10)
        
unit_owner GetEntPropEnt(unit_ownerProp_Send"m_hOwnerEntity"); 
if unit_owner == -1 it mean that the "player" owner is not a player (creeps, neutral, roshan)

Last edited by Mathias.; 11-16-2014 at 20:21.
Mathias. is offline
psychonic

BAFFLED
Join Date: May 2008
Old 11-12-2014 , 23:06   Re: Dota 2 problem
Reply With Quote #4

Quote:
Originally Posted by Black-Rabbit View Post
Let say we got 2 player A, B

B join the game, A join the game A join team Dire, B join Team Radiant, A ID will be 1 but in data storage he is 0 while B ID is 0 but data storage is 1.

If B join the game, A join the game, B join team Dire, A join Team Radiant, A ID will be 1 and the data storage for dota will also be 1.

Player ID = order of player join.
Storage ID = order of player join a team.
You're convoluting player id and player entity index. The entity index is in order of connection. The player id (which you call storage id) is in order of team join if not already predefined by lobby data or manually. You can get a player's player id the way I noted above.
psychonic is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 07:18.


Powered by vBulletin®
Copyright ©2000 - 2021, vBulletin Solutions, Inc.
Theme made by Freecode