Game Development Community

BOOK: Weapon component _hitPoints don't stick

by Brandon · in Torque X 2D · 01/21/2009 (7:12 pm) · 1 replies

I guess because this is used in an event, the proper data is not being passed to allow for different hit points. No matter what it is the default..


Anyone done a work around to this?

#1
01/21/2009 (8:23 pm)
GAH!!!

Nevermind..

All I had to do was add the weapon component to the enemy projectile template and set the hit points in that. Then in the ApplyDamage function/event in the weapon component I just do this:

WeaponComponent weapon = ourObject.Components.FindComponent<WeaponComponent>();
            
            if (enemyDamage != null)
            {
                enemyDamage.ReduceHealth(weapon._hitPoints, theirObject);
            }