Jump to content
Bobblehead84

Trigger Area for automated Kart repair

Recommended Posts

Hey everyone.

In hope of finding someone who can help me with my problem, here's what I did/want to do:
I set up a race track for some kart racing, for my friends. But even though the karts are a tough nut to crack, and can survive a few crashes, it happens that they are breaking down.

Some drive better, some drive worse, which of course changes the durability of the vehicle on the track.
Therefore I need to hang out in Zeus mode, while the others are racing, to regularly apply "ACE Heal" (NOT Full Heal, just Heal) to the kart. This will repair it fully, even with the player inside, and while driving. Even though it does not heal the player inside the kart. Still, I would very much like to get that process automated by placing triggers around the track, which apply said ACE Heal as soon as the player enters the area with the kart. Maybe even get a trigger set up seperately which players can enter and leave their kart to get healed themself.

 

But for the life of me, I can't get it done, and every search I did just lead me to a dead end. I tried some things I could find on YT/Forums but they don't work, no matter what I do. I was able to set up a test trigger to activate when a person enters it, but not with a vehicle. Which, of course, is also a problem. Furthermore I was never able to apply any kind of healing/repair to anything inside the trigger, no matter what.

I need help with this, if possible. Be advised though, that I never did anything with a trigger before, and don't know much about scripts.
If someone could give me a solution to all this, it would be greatly appreciated.

 

Thank you in advance.

Share this post


Link to post
Share on other sites

set up a trigger wich covers your desired healing area.

 

condition field:

thisList select {isPlayer _x} findIf {damage _x > 0.2 || damage objectParent _x > 0.2} > -1

 

activation:

{ _x setDamage 0; objectParent _x setDamage 0;} count thisList select {isPlayer _x && {damage _x > 0.2 || damage objectParent _x > 0.2}}

 

this is not tested and it's not an ACE solution but could be similar for it.

  • Like 1

Share this post


Link to post
Share on other sites
8 hours ago, sarogahtyp said:

set up a trigger wich covers your desired healing area.

 

condition field:


thisList select {isPlayer _x} findIf {damage _x > 0.2 || damage objectParent _x > 0.2} > -1

 

activation:


{ _x setDamage 0; objectParent _x setDamage 0;} count thisList select {isPlayer _x && {damage _x > 0.2 || damage objectParent _x > 0.2}}

 

this is not tested and it's not an ACE solution but could be similar for it.

 

Thank you for your input, but sadly this doesn't work at all. Not in any form. I tried it in different ways, i.e. trigger-area as line/field and with different heights. I set the Activation on "Anybody" and Activation Type on "Present" but nothing at all.
Do you have any other ideas that might be worth a try ?

Share this post


Link to post
Share on other sites

Most barebones solution would be to simply place a repair truck nearby.

Vanilla repair truck is holding 1 trillion (1x10^12 or 1.000.000.000.000) repair cargo, should last for an afternoon.

 

Cheers

Share this post


Link to post
Share on other sites

NOTE:

This might be somewhat faulty. I wrote it in the forums code thingie so might have some spelling misstakes or such. Basically, it's a modified version of the script I use for repairing vehicle on military servers that's been adapted to racing.

 

Recommend making several "Pits" for the different "teams/karts".

 

INSTRUCTIONS:

 

Create a trigger on player present.

In condition field put: !isEngineOn (thislist select 0);

On activation put: null = (thislist select 0) execVM "repair.sqf";

 

Repair.sqf

Spoiler

//Define vehicle from thislist select 0 passed in the trigger. 
params ["_vehicle"];

//Make sure vehicle is alive and not player.
if (!alive _vehicle || _vehicle isKindOf "Man") exitWith {};

//Get displayname of vehicle for some fancy dialog. 
//IE: _name =  Kart (Blueking) or Hatchback (Sport). 
_name = getText (configFile >> "CfgVehicles" >> typeOf _vehicle >> "displayName");

//Start service
_vehicle vehicleChat format ["Servicing: %1", _name];
_fuel = fuel _vehicle;
_vehicle setFuel 0;

//Repair
sleep 1.5;
if (!alive _vehicle) exitWith {};
_vehicle vehicleChat "Repair: Started";
sleep 5;
while {damage _vehicle != 0} do {
	_vehicle SetDamage (damage _vehicle - 0.1);
	sleep 0.1;
};
_vehicle setDamage 0;
_vehicle vehicleChat "Vehicle repaired!";

//Refuel.
sleep 1.5;
_vehicle vehicleChat "Refuel: Started,";
_vehicle vehicleChat "please keep the engine off.";
_vehicle setFuel _fuel;

//Refuel vehicle until full OR engine starts. 
while {fuel _vehicle != 1 && !isEngineOn _vehicle} do {
	_vehicle setFuel (fuel _vehicle + 0.01);
	sleep 0.1;
};
_vehicle vehicleChat format ["%1%2 Refueled", round (fuel _vehicle * 100), "%"];

//End message
if (!alive _vehicle) exitWith {};
_vehicle vehicleChat format ["%1 Serviced!", _name];
if (true) exitWith {};

 

 

  • Like 1

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

×