(01-21-2012, 05:53 PM)Streetboat Wrote: Interesting idea, I hope it works out!
As it happens, I have a solution for ya, because I did something similar. Hint: use LocalVarInts. Every time the axe collides with the door, check for the LocalVarInt and set the health to a certain level, and at the same time, add 1 to the LocalVarInt. That way, every time the function is called, a different output will be made. For example:
void hurtdoor(string &in asParent, string &in asChild, int alState)
{
if(GetLocalVarInt("hit") == 0)
{
SetPropHealth(80.0f);
AddLocalVarInt("hit", 1);
}
if(GetLocalVarInt("hit") == 1)
{
SetPropHealth(60.0f);
AddLocalVarInt("hit", 1);
}
...and so on. Hope that helps!
I think I know how you're thinking, but I need to see more of the script to understand it, I think.
Edit: Nevermind I'm just stupid. I pasted your script and fixed the names but it didn't work on the door or the barrel.
Edit2: Oh wait I'm even more stupid. Hold on..
Edit3: Ok I got it working the way you were thinking (I guess) and made it all the way down to 0, which should take 4 hits but it breaks instantly (the barrel right now), probably cause there are a lot of tiny collisions. I would need to make it so that it only counts when it collides with a pretty big amount of force..
(01-21-2012, 05:59 PM)Your Computer Wrote: Try
if (GetPropHealth("prop_name") > 0)
SetPropHealth("prop_name", GetPropHealth("prop_name")-10);
Did not work, at least not with the way I inserted it. Besides, I don't understand that at all, and I hate using scripts which I don't understand how to make, or how they work. I appreciate the tip, though.