Jump to content
Sign in to follow this  
revide

Reset destroyed buildings, completely

Recommended Posts

Hey community.

 

Is there a way to get ALL destroyed buildings on a Map and auto-rebuild them, like a Map reset, but without restart.

 

I've seen solutions with triggers on the buildings itself, which is not quite suitable if the whole map should be affected.

 

 

 

Open for any ideas, thanks.

Share this post


Link to post
Share on other sites

The most efficient way would be to register destroyed building positions in an array. I don't know if there is an eventHandler for destroying buildings, had a quick glance at the BIKI but it doesn't look like it: https://community.bistudio.com/wiki/Arma_3:_Event_Handlers

 

Then again, since we're all verhicles in the Armaverse, maybe buildings also trigger the Killed event?

 

And there's always brute-force: call nearestBuildings with a sufficiently large radius, loop through the returned buildings and resurrect whatever needs resurrecting.

Share this post


Link to post
Share on other sites

yea thats what I thought as well, but the efficiency is quite a pain in the ***. :')

 

 

MP or SP?

MP but There are no MP handlers doing that.

 

 

@BI that would be awesome, eventHandler for buildings.

 

 

Im going to look into the killed thing with building, maybe they call it.

Share this post


Link to post
Share on other sites

I would save all map buildings in an array at mission start and use that to check for destroyed buildings later.

Share this post


Link to post
Share on other sites

Have a read through this.

 

http://killzonekid.com/arma-scripting-tutorials-scripted-charges-v2/

 

You might want to check yourself but setDamage on the destroyed buildings does not sync for JIP players (as map objects are local to everyone) so you end up with different people seeing different things.  (Unless you don't have JIP and then it's not a problem).  But if you do try and sync it all up (esp over the whole map) then you end up with bandwidth problems.

 

I was doing a similar thing a while ago and gave up as once you add a few players during the game, it red-chains like crazy.

Share this post


Link to post
Share on other sites

Read through it, I like the shockwave simulation :D.

 

Well his PostScript says that setDamage is now JIP compatible. I would now just have to cache in all the builds that got destroyed and reset them to setDamage 0. Well an event Handler would make that possible.

Share this post


Link to post
Share on other sites

Ok cool I didn't know that had changed.

 

In that case, add a killed EH to every building during init and build an array through the game.  Then access the array when you run your reset command and every destroyed building should be back to normal.

Share this post


Link to post
Share on other sites

Im at work, but I would say nonononono to almost everything.

 

Yes, you can add an EH to buildings. I've done it to Radio Towers in Antistasi.

 

The owner of the buildings regarding the EH is the server.

 

But you cannot do a super simple _building setDamage 0; Because in arma engine, the alive object seems to no longer exist and it is replaced with another object with the damaged model.

 

So.

 

You need to store in the array the exact position, model, dir etc.. of the building. Then, hideObjectGlobal the destroyed model (you won't be able to do it with every kind of building, at least RT no) and createVehicle a new one with the params you stored.

Share this post


Link to post
Share on other sites

Im at work, but I would say nonononono to almost everything.

 

Yes, you can add an EH to buildings. I've done it to Radio Towers in Antistasi.

 

The owner of the buildings regarding the EH is the server.

 

But you cannot do a super simple _building setDamage 0; Because in arma engine, the alive object seems to no longer exist and it is replaced with another object with the damaged model.

 

So.

 

You need to store in the array the exact position, model, dir etc.. of the building. Then, hideObjectGlobal the destroyed model (you won't be able to do it with every kind of building, at least RT no) and createVehicle a new one with the params you stored.

 

 

Yea ran into that as well, didn't bothered to post this. But this is kinda screwed up. BI pls, give us some commands for hardReset whole map.

 

Similar to the deadCorpseHandler that manages the disappearance of dead corpses. Just reset a building after it has been destroyed after certain circumstances.

Share this post


Link to post
Share on other sites

Can't help but wonder why exactly you don't want to do a restart? If the map really got messed up then this would be much better for performance, especially in the long run.

 

Just save any variables and settings you need, make a quick restart and load your data again.

 

 

ps.: I've read your thread about that project you're working on (I assume this is related)... maybe we should talk :)

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  

×