im trying to get the distance from the player to the pawn he shoots it.im using the take damage function in the pawn as below but it always returns the distance from the players spawn point to the pawn and not the current distance.
Code:
event TakeDamage(int Damage, Controller EventInstigator, vector HitLocation, vector Momentum, class<DamageType> DamageType, optional TraceHitInfo HitInfo, optional Actor DamageCauser) { local int OldHealth; local float enemyDist; enemyDist = VSize( Location - EventInstigator.Location ); `log("longshot" @ enemydist); if(enemydist <= 1500) { `log("shot" @ enemydist); } }
Comment