sorry to bother with this long post but iam trying to keep it detailed as possible
here is how iam getting the abilities
in the auto* abilityEntity = ability.Entity();
we are calling CGameEntitySystem.h
to get the entity like this:
then we are calling the GetEntity from the same class (CGameEntitySystem) to get the entity like so:
here is the abilities output iam getting
I wanna know why all my abilities entities are invalid ?
and once again iam really sorry for the long post
here is how iam getting the abilities
C++:
CDOTABaseNPC* hero = reinterpret_cast<CDOTABaseNPC*>(const_cast<CBaseEntity*>(entity));
if (hero && IsValidReadPtr(hero)) {
printf("DEBUG: Hero pointer is valid, processing abilities\n");
printf("DEBUG: Hero address: %p\n", hero);
printf("DEBUG: Hero abilities: %p\n", hero->GetAbilities());
for (auto ability : hero->GetAbilities()) {
// Check if the handle is valid first
if (!ability.IsValid())
continue;
// Get the entity pointer safely
auto* abilityEntity = ability.Entity();
if (!abilityEntity || !IsValidReadPtr(abilityEntity))
printf("DEBUG: Ability entity is invalid\n");
continue;
// Check if the identity is valid
auto* identity = abilityEntity->GetIdentity();
if (!identity || !identity->GetName())
printf("DEBUG: Ability identity is invalid\n");
continue;
printf("DEBUG: Ability address: %p\n", abilityEntity);
printf("DEBUG: Ability name: %s\n", identity->GetName());
printf("DEBUG: Ability index: %d\n", abilityEntity->GetIndex());
}
} else {
printf("DEBUG: Hero pointer is invalid\n");
}
in the auto* abilityEntity = ability.Entity();
we are calling CGameEntitySystem.h
to get the entity like this:
C++:
template<typename T>
inline T* CHandle<T>::Entity() const {
return CGameEntitySystem::Get()->GetEntity<T>(Index());
}
then we are calling the GetEntity from the same class (CGameEntitySystem) to get the entity like so:
C++:
template<typename T = CBaseEntity>
T* GetEntity(int index)
{
auto identity = GetIdentity(index);
if (identity && IsValidReadPtr(identity) && identity->entity && IsValidReadPtr(identity->entity))
return (T*)identity->entity;
return nullptr;
}
here is the abilities output iam getting
Код:
DEBUG: Hero pointer is valid, processing abilities
DEBUG: Hero address: 000001E4EB9C1000
DEBUG: Hero abilities: 00000047830EF9E0
DEBUG: Ability entity is invalid
DEBUG: Ability entity is invalid
DEBUG: Ability entity is invalid
DEBUG: Ability entity is invalid
DEBUG: Ability entity is invalid
DEBUG: Ability entity is invalid
DEBUG: Ability entity is invalid
DEBUG: Ability entity is invalid
DEBUG: Ability entity is invalid
DEBUG: Ability entity is invalid
DEBUG: Ability entity is invalid
DEBUG: Ability entity is invalid
DEBUG: Ability entity is invalid
DEBUG: Ability entity is invalid
DEBUG: Ability entity is invalid
DEBUG: Ability entity is invalid
DEBUG: Ability entity is invalid
DEBUG: Ability entity is invalid
DEBUG: Ability entity is invalid
DEBUG: Ability entity is invalid
DEBUG: Ability entity is invalid
I wanna know why all my abilities entities are invalid ?
and once again iam really sorry for the long post
Последнее редактирование: