Jump to content
Sign in to follow this  
deady

Repairing all buildings in a city

Recommended Posts

Im trying to make a mission where at one point, a city is under attack, so buildings should be damaged etc. But later I need it to be fully repaired.

Now, destroying is the easy part, because a nicely placed GBU bomb sorts things out nicely, but repairing is tougher.

I know i can use nearestobject xxxx setdamage 0 to repair an individual building, but does anyone know a quicker way to make the game jump from object to object in some kind of scripting loop and setdamage 0 each object?

Something that takes a starting point and repairs each object outwards in a radius would be perfect.

Share this post


Link to post
Share on other sites

I don't know of a tool that will do as you ask, but I have something to offer.

USI_Zombie showed me a script he uses that repairs objects.

I do not know where he found it, or if he made it himself.

The code was applied to objects that were added to the map, and not stock island objects. I do not know if the island objects can be affected by this. I hope this can help you.

brs.sqs

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

_structure=_this Select 0

_delay=10

#start

@!(Alive _structure)

~_delay

_structure SetDammage 0

~1

_structure SetDammage 0

~1

_structure SetDammage 0

~1

Goto "start"

called out from the units init field :

[this]exec "brs.sqs"

I am guessing that you change the delay to get the desired effect, but I have only used the script in the form shown.

works great! I have used this to protect a few buildings, most important being the MASH med tent wink_o.gif

Share this post


Link to post
Share on other sites

a quick way would be to add this line to a trigger...

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">boom = nearestObjects [trig, ["house"], 200];{_x setdammage 0} foreach boom

trig being the name of a marker/trigger or something that is near the buildings you want restored.

I tested this with a setdamage 1 trigger that destroyed a whole town, then as i walked towards the town and set off the setdamge 0 trigger all buildings came backup.

cheeers

Share this post


Link to post
Share on other sites

boom = nearestObjects [trig, ["house"], 200];{_x setdammage 0} foreach boom

It doesn't work for me.. i'm trying to respawn some hangars the way you describe.. what is the rest of the trigger supposed to be set to?

Share this post


Link to post
Share on other sites

That would go in the On Activation field, then in the Condition field write your condition, name the trigger trig, and make sure it's placed where you want the center of the 200m radius search to be.

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  

×