Grenade Impact Damage and Explosion damage

MarkusKer

Member
Hello,

i am having the problem that if i change the damage value under the throwable object script of the grenade the thrown object itself is causing damage. i disabled this by turning the value to 0. If i do that and the explosion happens the player is no longer taking damage. If i spawn the explosion directly in the world for testing the players are taking damage. This explosion is assigned to the frag grenade.

Did anyone ever had this problem before?

Regards,
Markus
 
Sorry I didn't respond to this yesterday, must have missed it!

Is your grenade item using the GrenadeItem component, and the grenade object using the Grenade component? When the GrenadeItem gets used, it passes its DamageAmount to the Grenade object it spawns, and the Grenade will apply its DamageAmount to the explosion when it Destructs.
 
Yes i am using those components. Can i somehow prevent passing down those values? If the impact of the grenade object is causing the same damage like the explosion it is kind of weird and if i set the impact damage of to 0 the explosion is not causing damage anymore.
 
The grenade object and explosion object have separate impact damage amounts, so you should be able to just set the grenade object's impact damage to 0 and the explosion object's damage to whatever you want. (The explosion object is set in the Grenade component's "Destruction" area)
 
If i spawn the explosion in the scene with an simple instantiate script the demage is working. However if it spawn from the frag grenade object there is no damage. Only if i set the damage amount in the item assigned to the player it is working. Once i set the damage value on the item itself to 0 the explosion is not causing any damage.
 
Last edited:
I am getting the same bug with a projectile that does no damage but explodes, when shootable damage is 0 the explosion damage is 0 too. fixed by setting impact damage to not 0
 
I am getting the same bug with a projectile that does no damage but explodes, when shootable damage is 0 the explosion damage is 0 too. fixed by setting impact damage to not 0
If you set the impact damage to for example 1. Does the explosive object apply the right amount of damage? Or do you have to set the impact damage amount to be the explosions damage amount?
 
To workaround this problem simply add a new private float named for example "customdamage".
1613994823957.png
In the OnEnable function let the customdamage float get the damage float. This way the customdamage gets the damage value set in the inspector.
1613994994890.png

In the damage function later simply override the passed on damage amount

1613995048048.png
 
I may be late here, but is there any possibility that a check-box could be added to the explosion script that overrides the damage being passed from the grenade script @Justin?
 
I had this same issue, It's odd you can't just set the two damage values directly in the editor, it seems like it should use the damage for the grenade projectile; for just that and the explosion damage for the explosion damage, it caused me to scratch my head for awhile to figure out what was going on the first time I set this up. but I ended up with a solution similar to MarkusKer's and that was fine.. my issue is every time I update UIS and TPC or install in fresh project and such I end up having to fix it again, which gets kinda old..
 
I had this same issue, It's odd you can't just set the two damage values directly in the editor, it seems like it should use the damage for the grenade projectile; for just that and the explosion damage for the explosion damage, it caused me to scratch my head for awhile to figure out what was going on the first time I set this up. but I ended up with a solution similar to MarkusKer's and that was fine.. my issue is every time I update UIS and TPC or install in fresh project and such I end up having to fix it again, which gets kinda old..
Agree 100%. I remember trying to debug why my stun grenades weren't incapacitating my character. I tried everything, and then I realised that I had updated UFPS and forgot to copy over my modified Explosion.cs script :ROFLMAO: Logically, the impact damage of the grenade and the damage inflicted by the explosion itself should be separate in my opinion.
 
Top