i was watching the fps techzone tutorial and noticed the rockets dont do damage does anyone know how to add it? please help! rocket script:
if it helps here is the machine gun script with damage from same download:
So what Meater6 was trying to say was to add a hit points system. I commented it and simplified it to make it less confusing.
Attach this to your rocket, by the way. Cheers!
answered Apr 25 '11 at 01:59 AM
heres what i would do, this is a health script add this to the object you want to take damage:
and add a tag Rocket to your rocket prefab.
answered Apr 25 '11 at 02:05 AM
To do damage, you must have something that takes the damage. Make a enemy status script, if don't have one already, for if you do, put it in your question.
Ok, you need to check to see if the rocket hit a valid target. Add a rocket damage script to the rocket you are instantiating. Using
Add a "Enemy" tag to the thing your shooting at and check to see if the rocket hit something with that tag. If it has, send a message using
in the rocket damage script. This will run the SubtractHealth function with parameters "damage" in the enemy status script. For the complete script, comment on this saying so.
Actually, an easier way is to just have a hitPoints variable, and subtract form that.
"RocketStatus" (The one that goes on the rocket itself)
"EnemyStatus" (The one that controls the hit points)
These scripts are untested, but I am positive they will work fine. Hope this gives you a better idea of how this works.