Get Structure Owner Tribe ID

Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

0x21

Well-known member
Joined
Aug 30, 2019
Messages
2
Hey. How can I get the tribe ID of the destroyed structure?
This code returns the same tribe ID for the killer and the structure owner.

C++:
bool Hook_APrimalStructure_Die(APrimalStructure* _this, float KillingDamage, FDamageEvent* DamageEvent, AController* Killer, AActor* DamageCauser)
{
    int structureTeamId = _this->TargetingTeamField();
    if (structureTeamId != 0) // tribe
    {
        if (Killer && Killer->IsA(APlayerController::StaticClass())) {
            AShooterPlayerController* player = (AShooterPlayerController*)Killer;
            int killerTeamId = player->TargetingTeamField();

            ArkApi::GetApiUtils().SendChatMessage(player, "TestPlugin", *FString("[Structure Death] StructureTeamId: " + std::to_string(structureTeamId)));
            ArkApi::GetApiUtils().SendChatMessage(player, "TestPlugin", *FString("[Structure Death] KillerTeamId: " + std::to_string(killerTeamId)));
        }
    }
}
 
Last edited:
It should be correct. You don't need to check TargetingTeam for 0 though.
TargetingTeamField should always return player id or tribe id.
 
Hook_APrimalStructure_TakeDamage: _this->TargetingTeamField() returns the ID of the structure owner.
Hook_APrimalStructure_Die: _this->TargetingTeamField() returns the ID of the killer.

What could be the reason for that?
 
Last edited:
Hm, it's weird. But try APrimalStructure::Destroyed instead of Die, it returns ID of the structure owner for sure.
Also, you can usually get faster response if you join API Discord.
 
Back
Top