Jump to content
Sign in to follow this  
Psycho1

Setting back damage of a building

Recommended Posts

Okay, I have a working script that will set a buildings damage back to 0 after it is blown up, but I want to have the building's damage set back to 0 after every hit it takes.  I don't want the building to blow up, that's why I want to set the damage back to 0 right away.  Here is what I tried to do:

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">?!(local Server): Goto "end"

_building = _this select 0

#start

~0

?(_building dammage == 0):goto "start"

_building setdammage 0

Goto "start"

#end

exit<span id='postcolor'>

My problem is at:  ?(_building dammage == 0):goto "start"

dammage isn't the operator I'm looking for, and I tried setdammage as well.  I looked around but can't find any operator for the damage that a vehicle/building has.  If anyone knows what I need to put in there, plz let me know. I do realize buildings can get wiped out with 1 hit from tanks, but I still want the building to keep from blowing up for as long as possible.

By the way, that script is Karrillion's creation, I just modifed it a bit.

Share this post


Link to post
Share on other sites

I think this is what you need;

getDammage obj

Operand types:

obj: Object

Type of returned value:

Number

Description:

Object dammage in range 0 to 1

Example:

getDammage player

note: taken from the official comre

Share this post


Link to post
Share on other sites

Thx, I got it figured out once I knew how to get the damage of the building. Here is the working script:

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">?!(local Server): Goto "end"

_building = _this select 0

#start

~0

_damage= getDammage _building

?(_damage == 0):goto "start"

_building setdammage 0

Goto "start"

#end

exit<span id='postcolor'>

Share this post


Link to post
Share on other sites

Just woundering is that my script ? I made one like that ages ago.

RED

Share this post


Link to post
Share on other sites

I got it from Karrillion, he posted it here a few weeks ago.

Share this post


Link to post
Share on other sites

I'm running into a problem if the building is blown up after only 1 hit. I was sort of expecting it, and I've modified the script to try and fix it. I was almost positive it would work, but the destroyed building would still just sit there:( The reason their is a problem is because I have no delay before it sets the damage back to 0. That works unless for example an M1A1 hits the building with sabot. It goes down immediately, and with no delay, it can't set the damage back because it's still in it's blowing up routine I think. It would work if I have a delay of 20 seconds if the building blows up, so here is what I did:

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">?!(local Server): Goto "end"

_building = _this select 0

#start

~0

_damage= getDammage _building

?(_damage == 0):goto "start"

?(damage == 1):goto "destroyed"

_building setdammage 0

Goto "start"

#destroyed

~20

_building setdammage 0

Goto "start"

#end

exit<span id='postcolor'>

I was pretty sure it would work since I have the script jump to a section where the delay is 20 if the building is at a damage of 1, but it doesn't. Any help is greatly appreciated.

Share this post


Link to post
Share on other sites

LOL, I'm pretty sure I caught my error....I didn't notice it till right after I posted that last message.  As you can tell, I don't have the _ before damage for the part that jumps to destroyed, so that could very well be the only problem I made.

EDIT: Just went and checked it out. It works exactly the way I want it now, hate it when I mess things up with such a small error, hehe.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×