Hi, I need to retrieve the damage amount a player has given to a prop. I have a Zombie Boss created and I am using my own UI for the health of the prop. I have set to the zombie to be damaged by 1.0 on any damage event. I want to change the damage amount to reflect the weapon the player is using to damage the Zombie.
Meaning, right now if I hit my Zombie with a rocket launcher or a smg, it will be the same damage (1.0). I want to make it so I can reflect the correct damage in my UI.
How can I retrieve the damage given to the prop or the weapon type used from the agent that triggered the prop DamagedEvent?
Current working code:
@editable ZombiePropManipulator : prop_manipulator_device = prop_manipulator_device{}
ZombiePropManipulator.DamagedEvent.Subscribe(OnZombieDamaged)
OnZombieDamaged(Agent:agent):void=
for(Player : PlayersMap):
Player.TakeDamage(1.0, IsZombieWalking)
zeroHealth := Player.ZeroHealth()
if (zeroHealth = true):
set IsZombieDead = true
Player.UpdateHealthBar()
I want to change my OnZombieDamaged to something like this below:
OnZombieDamaged(Agent:agent):void=
var DamageAmount : float = 0
if (Agent.WeaponType = Assult_Rifle)
set DamageAmount = 0.5
else if (Agent.WeaponType = SMG)
set DamageAmount = 0.2
else if (Agent.WeaponType = RocketLauncher)
set DamageAmount = 1.0
for(Player : PlayersMap):
Player.TakeDamage(DamageAmount, IsZombieWalking)
zeroHealth := Player.ZeroHealth()
if (zeroHealth = true):
set IsZombieDead = true
Player.UpdateHealthBar()
Or something like this if possible:
OnZombieDamaged(Agent:agent):void=
var DamageAmount : float = 0
set DamageAmount = Agent.GetDamage #somehow get damage from this event?
for(Player : PlayersMap):
Player.TakeDamage(DamageAmount, IsZombieWalking)
zeroHealth := Player.ZeroHealth()
if (zeroHealth = true):
set IsZombieDead = true
Player.UpdateHealthBar()