Jump to content
MrFata

Vehicle Rearm, Refuel and Repair Script

Recommended Posts

Hi all again!

I'm working on a new version of the ream/refuel/repair. On this, you need to turn off your engines, and if you turn on it during the rearm/refuel/repair process it will stop!

This script show message since the arrive to the repair zone unto the end of the process with some indications, and percents of how the rearm/refuel/repair process are are show on a box at topright corner.

Soon I will share with you! Sorry my english and regards!

Share this post


Link to post
Share on other sites
here you go (from our arma2 missions)

//in mission.sqm
class Sensors
{
	items=3;
	class Item0
	{
		position[]={4619.7158,0.19623651,-1617.5906};
		timeoutMin=1;
		timeoutMid=1;
		timeoutMax=1;
		interruptable=1;
		age="UNKNOWN";
		text="pinit";
		name="pinit";
		expCond="local player";
		expActiv="plays = [] execVM ""scripts\pinit.sqf"";";
		class Effects
		{
		};
	};
	class Item1
	{
		position[]={9645.6133,13,2998.0623};
		a=400;
		b=180;
		angle=90;
		rectangular=1;
		activationBy="ANY";
		age="UNKNOWN";
		text="airport";
		name="AirportIn";
		class Effects
		{
		};
	};
	class Item2
	{
		position[]={8441.6699,678.59814,10571.127};
		a=40;
		b=40;
		angle=50;
		activationBy="WEST";
		repeating=1;
		interruptable=1;
		age="UNKNOWN";
		name="farp1";
		class Effects
		{
		};
	};
};
};

make a folder in your mission folder called "scripts" and place these into it

//scripts\pinit.sqf
_cthread = [] execVM "scripts\MainThreadC.sqf";
//and any other player clientside scripts you care to run at player join

//scripts\mainthreadC.sqf
EGG_EVO_Repair = 
{
_vec = (vehicle player);
_type = typeOf vehicle player;

if(getDammage _vec > 0 or fuel _vec < 0.98 and not (_vec isKindOf "Man")) then
{
	_inrepairzone = ((_vec in list AirportIn) or (_vec in list farp1) );//your sensor zones in the mission named "Airportin" or "farp1" etc
	if(((_vec in list AirportIn) or (_vec in list farp1) ) and _vec != player and speed _vec > -2 and speed _vec < 2 and position _vec select 2 < 2.0 and (local _vec)) then
	{
		 titleText [localize "STR_M04t83", "PLAIN DOWN",0.3];
		 for [{_loop2=0}, {_loop2<1}, {_loop2=_loop2}] do
		 {
		    sleep 0.200;	    		    
		    if (getDammage _vec > 0) then {_vec setDammage ((getDammage _vec)-0.0125);};
		    if (Fuel _vec < 1) then {_vec setFuel ((Fuel _vec)+0.0125);};
		    if (getDammage _vec == 0 and Fuel _vec == 1) then {_loop2=1;};
		    if(_vec != vehicle player or speed _vec < -2 or speed _vec > 2 or position _vec select 2 > 2.0) then {_loop2=1;titleText [localize "STR_M04t84", "PLAIN DOWN",0.3];};
		    _dam = (getDammage _vec)*100;
		    _ful = (Fuel _vec)*100;
		    hint format["Damage: %1\nFuel: %2",Round _dam,Round _ful];
		};
		_vec setVehicleAmmo 1;	
	};
};
};

for [{_loop=0}, {_loop<1}, {_loop=_loop}] do
{
[] call EGG_EVO_Repair;
sleep 1.01;
};

this is the standard repair/refuel/rearm function for Arma1 and2 for us

just go into your mission in the editor and move the trigger/sensors about until they are where you want them

i'll be polishing this up for use at all fuel stations too soon (repair not rearm!)

Sorry a little confused. How do you insert into mission.sqm? Was it supposed to be mission.sqf? I have your mission downloaded and have been trying to figure it out, but I am lost at this point sorry. Please help.

Edited: NVM Stupid me I got it thanks.

Edited by mech79

Share this post


Link to post
Share on other sites

How to tell VRV-6e Bobcat the repairing tank to repair my vehicle? ??Currently I'm working on this mission where we have two platoons of tanks. And each platoon has a CRV-6e Bobcat as a supportive tank. I want the CRV-6e come repair my tank when it's damaged, but I don't know how to script that and I can't find any anything relevant by pressing those complicated F1~~F12 or #1~~0 buttons. Looks like right now the only way repairing happens is when someone shouts loudly, "status red!", then those CRV-6es will come, but that's too late. Need a script that tells CRV-6es to come repair AI and player's vehicles upon their some sort of radio request. And I noticed that CRV-6e doesn't have enough ammo, for example when it supplies a cheetah it will supply 2 missiles and that's it. This amount is really not enough. So need the script to change amount of ammo that CRV-6e can carry as well. Anyone knows how to do this and would like to help me?

Share this post


Link to post
Share on other sites
On 3/12/2013 at 10:23 PM, hellstorm77 said:

if (isEngineOn _object) exitwith {_object vehicleChat "Service Cancelled"}; _object setVehicleInit "this setVehicleAmmo 1"; processInitCommands; _object vehicleChat "Refuelling...";

 

Just a heads up  the processInitCommands command was disabled in ARMA 3 for security reasons.  It says use remoteExec or BIS_fnc_MP instead.  How exactly would you incorporate that into the script now?

 

Thanks 

 

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

×