Jump to content
Sign in to follow this  
Tankbuster

repair at repair stations?

Recommended Posts

Thanks fellas. I do have it working now. nearObjects (or nearestObjects) is too laggy with these big radii so I put the triggers on the buildings in sqm. Bit cludgy, and not very geeky, but it works best, I think.

Could you post up your end code and a little simple mission for the people that were following this thread like me:)

Share this post


Link to post
Share on other sites

Here's the trigger. You can see it's on the repair station building in the barracks area in Feruz Abad.

http://i.imgur.com/Slznw.jpg

And here's the code. Apologies for the commented out debug and hints. Note that it's from a Domination mod so uses some Xeno calls and global variables.

//t_repairstationrepair.sqf by tankbuster
private "_repveh", "_veh_dam", "_veh_fuel";
if (!X_Client) exitWith {};
_repveh = _this select 0;
//_reppos = getPos thistrigger;
// if ((_repveh distance _reppos) < 11) exitWith {};
// hint "exec!";
_veh_dam = getDammage _repveh;
_veh_fuel = fuel _repveh;
sleep 1;
//diag_log format ["repveh %1 reppos %2" ,_repveh, _reppos];
if (!(vehicle _repveh isKindOf "LandVehicle" or vehicle _repveh isKindof "Helicopter")) exitwith {Hint "We can't repair that here"};

//while {getDammage _repveh  > 0 and _repveh distance _reppos  < 11} do {
while {(getDammage _repveh  > 0)} do {   
   //titleText ["Repairing", "PLAIN"] ;
[vehicle player, "Repairing. Stay on board!"] call XfVehicleChat;
   _repveh setFuel 0;
//hint "repairing";
sleep 2;
   _veh_dam = _veh_dam - 0.1;
   _repveh setdamage _veh_dam;
};
if (getDammage _repveh  == 0) then {
   //titleText ["Repairs Complete", "PLAIN"] ;
[vehicle player, "Repairs complete!"] call XfVehicleChat;
//hint "repaired";
_repveh setFuel _veh_fuel;
_repveh engineOn true;
} else {
    // titleText ["Vehicle is Still Damaged", "PLAIN"] ;
  [vehicle player, "Vehicle still damaged!"] call XfVehicleChat;
  _repveh setFuel _veh_fuel;
     };  

---------- Post added at 07:34 PM ---------- Previous post was at 07:29 PM ----------

Here's another view of where the trigger actually is.

http://i.imgur.com/qzouB.jpg

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  

×