|
Post by kiwi2112 on Jan 19, 2021 4:31:57 GMT
Not sure if anyone else has found a way to create this effect but here's a method I've discovered works for me (using Shooter Melee Template Version 2.5.5)
On your melee weapon's main child add a VHealthController Script
Create an event in On Damage Hit (vHitInfo) in the vMeleeWeapon script's events and choose vHeathController.AddHealth and set the value to how many hits you want your weapon to take (make sure to set it to a minus value so it removes health, so -25 with 100 health will be 4 hits)
In your weapons components create an empty child and add a box collider with is trigger enabled and a vRemoveCurrentItem script, select destroy item and immediate, make the gameobject inactive.
Finally in the vHealthController events create one for On dead and drag in the gameobject with the remove item script into it, choose GameObject.SetActive
When testing simply click on your players weapon and see if the health goes down after each hit! Hope this helps anyone, any questions incase I missed anything is appreciated! Ill try and see if I can get a test video up.
Improvements I hope to make - Being able to display the weapons health on screen / finding a way to repair/ improve damaged weapons
|
|
ovaan
New vMember
Posts: 13
|
Post by ovaan on Jan 24, 2021 13:49:05 GMT
This is GENIUS, thanks man
|
|
|
Post by kiwi2112 on Jan 28, 2021 18:11:15 GMT
You're welcome! Hopefully I can figure out a way to display the weapons health in the UI, not really that great with coding (reason how I figured out this solution lol)
|
|
|
Post by denvzla on Feb 13, 2021 23:46:18 GMT
Thanks , if you can show the health of the weapon, let me know
|
|