Jump to content
Sign in to follow this  
pviera11

Repair building script.

Recommended Posts

Hello, are there scripts where you can repair, and refuel, and possibly rearm vehicles, i was wondering if there was a script that i could add into my game mode to repair buildings, so far as i know Arma 2 has hitpoints for everything if the building had 10,000 hit points and each bullet did one it would take 10,000 bullets to destroy the building, is it possible to make a script where someone can repair the building by lets say 1,000 hitpoints every so many seconds? If anyone know how i can make it or has a link to it then please help me.

Edited by pviera11

Share this post


Link to post
Share on other sites

I'm not sure you can really, I haven't looked at hit points as such but when I restored some buildings that had been damaged I had a problem with flickering.

All the damage effects and broken windows are still there along with the repaired building so they fight for the same space.

Share this post


Link to post
Share on other sites

You can repair them using the setDamage but if it's been rubbled you can't "recreate" the building without... work. Probably reloading the map, though you might be able to fake it using hideObject and recreating it, but that would get messy.

Share this post


Link to post
Share on other sites

Well every time a building gets destroyed i don't want to be restarting the map or game or restarting it every day, i am trying to keep the servers running until we need to update it. Also i do not see how i could setdamage or hideobject during game play?

Share this post


Link to post
Share on other sites

I did try using setdamage incrementing it slowly but it always just appears fully intact.

Share this post


Link to post
Share on other sites

Ok even if you can just run up to the building and select an option rebuild, and the building reappears. That is just as good, until eventually in the future i could somehow make it go through the stages of rebuilding. I just want to be able to rebuild the buildings even if it appears as a new one.

Share this post


Link to post
Share on other sites

I just did another check and it doesn't repair the building to new, it repairs the major structure but not windows or scorch marks.

Maybe that's where the hit points come in.

for what it's worth

place a game logic over the damaged building and name it ReBuild

place trigger set radio alpha

and put this in the cond nul=[rebuild,5] execVM "ReBuild.sqf"

save the code as ReBuild.sqf

// nul=[rebuild,5] execVM "ReBuild.sqf"

_pos = _this select 0;

_dist = _this select 1;

_static = nearestobjects [_pos,["Building"], _dist];

{

_x setdammage 0;

} foreach _static;

you can adjust the radius to repair building over a large area default is 5

When you want to restore the building call radio alpha

If you change setdamage 1 to setdamage 0 it can be used to destroy a building or several buildings

---------- Post added at 02:04 AM ---------- Previous post was at 01:52 AM ----------

kylanias idea of hiding the building then popping a new one does work, I did it before but only as a simple test.

You will need to align the buildings direction ,position and possibly angle. If you hide the old build using Hideobject I don't think you do have to restore the map that was only true when using deletecollection. Which I really wish they'd never removed it was a great command.

Edited by F2k Sel

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  

×