Jump to content

Recommended Posts

Hi;

I want an action to repair buildings.

Init player:

player addAction ["Repair Building", "repairbuild.sqf"];

repairbuild.sqf:

_rbuilding = nearestBuilding player;

_rbuilding setdamage 1;

sleep 2;

_rbuilding setdamage 0;

The script works fine, my problem is that it only detects the default map buildings, if I add a building to the map, (with @ deditor or @ CJTFEditor) is not detected as a building, I do not know why.

any help?

Share this post


Link to post
Share on other sites

Try

_buildings = nearestobjects [player,["House"],5];
_rBuilding = _buildings select 0;

This should choose the closest Building.

However, you might want to try adding addActions to all buildings in for example your init.sqf to avoid uncertainties.

Edited by mantls

Share this post


Link to post
Share on other sites

Good idea!! adding addActions to buildings works fine!!

Thank you!!

Now, my problem is add cooldown to player for repair other building, any idea?

Share this post


Link to post
Share on other sites

I just tried this script because I was wanting something like it as well but I get undefined variable errors. What am I doing wrong? I created the repairbuild.sqf just as is presenting above. ???

edit:

Nevermind.. I figured out my issue. I had to save my test mission in the editor first. Just previewing without saving wasn't changing anything.

Thanks!!!

Edited by Zlin

Share this post


Link to post
Share on other sites

so why exactly can't anybody figure out how to replicate this script?

There is plenty of information here. 

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

×