Hi all,
im getting this crash :
Access violation - code c0000005 (first/second chance not available)
UE4Editor_CoreUObject!UClass::GetDefaultObject() + 6 bytes [d:\buildfarm\buildmachine_++depot+ue4-releases+4.7\engine\source\runtime\coreuobject\public\uobject\class.h:1958]
UE4Editor_Engine!ACharacter::ApplyDamageMomentum() + 97 bytes [d:\buildfarm\buildmachine_++depot+ue4-releases+4.7\engine\source\runtime\engine\private\character.cpp:345]
UE4Editor_Survival_5609!ABaseCharacter::TakeDamage() + 368 bytes [c:\users\alex\documents\github\survivalkind\source\survival\private\basecharacter.cpp:70]
I’m trying to hit a skeletal mesh with a LineTraceSingle and deal damage, so i call:
const float ActualDamage = Super::TakeDamage(Damage, DamageEvent, EventInstigator, DamageCauser);
on ABaseCharacter wich is subclass of character:
( class SURVIVAL_API ABaseCharacter : public ACharacter )
I’m calling the TakeDamage on ABaseCharacter from my WeaponInstant class
(I added some NULL validation just in case)
void AWeaponInstant::DealDamage(const FHitResult& Impact, const FVector& ShootDir)
{
GEngine->AddOnScreenDebugMessage(-1, 1.0, FColor::Yellow, "DEAL DAMAGE ");
FPointDamageEvent PointDmg;
PointDmg.DamageTypeClass = DamageType;
PointDmg.HitInfo = Impact;
PointDmg.ShotDirection = ShootDir;
PointDmg.Damage = HitDamage;
if (Impact.GetActor() != NULL && Impact.GetActor()->IsValidLowLevel()){
if (MyPawn->Controller->IsValidLowLevel()){
Impact.GetActor()->TakeDamage(PointDmg.Damage, PointDmg, MyPawn->Controller, this);
}
}
}
I tried also a linetrace impacting a PlayerCharacter who is also subclass of ABaseCharecter ( instantiated directly on the map ) , and it works perfectly .
The problem is with some another character that also inherits from BaseCharacter like “ZombieCharacter”, (using the same method TakeDamage ) and who is controlled by a AIController
Sorry for my English. I just spend a couple of hours with this and i dont understand why i’m getting this error