Jump to content
Sign in to follow this  
Fcn

How do you make existing map buildings invincible?

Recommended Posts

Simple question with a seemingly complex answer. How do I go about making an existing building, one with an ID on the map, invincible?

Share this post


Link to post
Share on other sites

You can use nearestObject.

//_obj is the closest object next to the building.
_house = nearestObject [_obj, "House"];

then, for SP:

_house allowDamage false

for MP:

_house addEventHandler["Hit",{_this select 0 setdammage 0}];
_house addEventHandler["Dammaged",{_this select 0 setdammage 0}];
_house addEventHandler["Killed",{_this select 0 setdammage 0}];

Edited by Benny.

Share this post


Link to post
Share on other sites

I'm really sorry, but I'm not sure how to utilise that script. a gamelogic tied to the building ID? Something like that?

Share this post


Link to post
Share on other sites

Basicly, you can use an object (gameLogic or whatever) to tie it.

In this case it shall be

 
_house = nearestObject [myGameLogic, "House"];

Share this post


Link to post
Share on other sites

So, as the object ID is: 276454

A Gamelogic named 'GameLogic', with this in the init field:

276454 addEventHandler["Hit",{_this select 0 setdammage 0}];
276454 addEventHandler["Dammaged",{_this select 0 setdammage 0}];
276454 addEventHandler["Killed",{_this select 0 setdammage 0}];

Is that right?

This is confusing.

Except that doesn't tie it properly does it. Would the stuff above go in a repeating trigger while _house = nearestObject [myGameLogic, "House"]; goes in the gamelogic?

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  

×