By registering with us, you'll be able to discuss, share and private message with other members of our community.
SignUp Now!Thank you very much! Is just what I need.
DECLARE_HOOK(AShooterCharacter_TakeDamage, float, AShooterCharacter *, float, FDamageEvent *, AController *, AActor *);
float Hook_AShooterCharacter_TakeDamage(AShooterCharacter *_this, float Damage, FDamageEvent * DamageEvent, AController* EventInstigator, AActor * DamageCauser)
{
if (_this && _this->PlayerStateField() && EventInstigator && !EventInstigator->IsLocalController() && EventInstigator->IsA(AShooterPlayerController::StaticClass()))
{
AShooterPlayerController* InstigatorShooterController = static_cast<AShooterPlayerController*>(EventInstigator);
if (InstigatorShooterController && InstigatorShooterController->PlayerStateField() && InstigatorShooterController->GetPlayerCharacter())
{
if (InstigatorShooterController->GetPlayerCharacter()->CurrentWeaponField() && InstigatorShooterController->GetPlayerCharacter()->CurrentWeaponField()->AssociatedPrimalItemField())
{
UPrimalItem* WeaponItem = InstigatorShooterController->GetPlayerCharacter()->CurrentWeaponField()->AssociatedPrimalItemField();
const FString WeaponItemBP = ArkApi::IApiUtils::GetItemBlueprint(WeaponItem);
if (WeaponItemBP.EndsWith("PrimalItem_WeaponOneShotRifle'"))
{//长管步枪;
return AShooterCharacter_TakeDamage_original(_this, 1.0f, DamageEvent, EventInstigator, DamageCauser);
}
else if (WeaponItemBP.EndsWith("PrimalItem_WeaponMachinedSniper'"))
{//制式狙击步枪;
return AShooterCharacter_TakeDamage_original(_this, 1.0f, DamageEvent, EventInstigator, DamageCauser);
}
}
}
}
return AShooterCharacter_TakeDamage_original(_this, Damage, DamageEvent, EventInstigator, DamageCauser);
}
try AShooterCharacter::GetPrivateStaticClass() or AShooterCharacter::StaticClass()
on another note.
if you want to intercept both character and dino damage hook APrimalCharacter::TakeDamage
if you want to intercept dino damage hook APrimalDinoCharacter::TakeDamage
Thank you very much, my problem has been solved ~~~_this->IsA(AShooterCharacter::GetPrivateStaticClass())
GameServersHub is the creator of the official Ark server plugins. We're the only genuine market that offers plugins for your ark ascended servers.
We use essential cookies to make this site work, and optional cookies to enhance your experience.