Closed cqiaoben closed 8 years ago
I had a quick look and it looks like m_hOwnerEntity is the way to go. You can detect if it's an illusion or not with checking m_hReplicatingOtherHeroModel (equals 16777215 when it is NOT an illusion). I also am not quite sure if it works for all cases though...
I have done a test on a demo (matchid = 2026982487). m_hOwnerEntity of CDOTA_BaseNPC_Creep_Neutral, being 16777215 most of the time, has other values as well:
066395: CDOTA_BaseNPC_Creep_Neutral (m_hOwnerEntity = 10945431) has spawned 066395: CDOTA_BaseNPC_Creep_Neutral (m_hOwnerEntity = 10945431) has spawned 072853: CDOTA_BaseNPC_Creep_Neutral (m_hOwnerEntity = 7783822) has spawned 072853: CDOTA_BaseNPC_Creep_Neutral (m_hOwnerEntity = 7783822) has spawned 073819: CDOTA_BaseNPC_Creep_Neutral (m_hOwnerEntity = 1688292) has spawned 073819: CDOTA_BaseNPC_Creep_Neutral (m_hOwnerEntity = 1688292) has spawned
Meanwhile, m_hOwnerEntity 10191233 is mapped to [CDOTA_BaseNPC_Creep, CDOTA_Unit_Hero_Beastmaster_Hawk, CDOTA_Unit_Hero_Beastmaster_Boar]. Beastmaster has another m_hOwnerEntity.
All of those make me wonder what m_hOwnerEntity really is...
Just a follow up. To get the owner number of an entity e1, the following code could do the work: Entity ownerEntity = ctx.getProcessor(Entities.class).getByHandle(e1); fp = ownerEntity.getDtClass().getFieldPathForName("m_iPlayerID"); return ownerEntity.getPropertyForFieldPath(fp);
I am able to get beastmaster's player position as a result, but I am still unable to interpret m_hOwnerEntity for CDOTA_BaseNPC_Creep_Neutral.
Of what type are entities 10945431, 7783822, 1688292?
Are they also neutral creeps? If so, the spawned creeps could have been spawned by another neutral creep, making it their owner (for example, Troll Summoner skeletons).
Yes you are right. The DtClass type is also neutral creeps. Is there a way to get real replay time based on the time tick? It would be nice if I can verify that.
The control slider used while playing the replay is directly related to tick. There are 30 ticks per second.
For example how should I access phantom lancer's illusions and get corresponding positions (or beastmaster's hawk)? My guess is to get all units spawned and check m_hOwnerEntity, but I am not sure if that works for all the cases.