Jump to content
Sign in to follow this  
Lord_Jereth

Vehicle Repair Point Script by Xeno works intermittently

Recommended Posts

Ok, I have tried several scripts to rearm/repair/refuel and all of them have the same problem: they don't work on all aircraft, specifically helicopters.

I am presently using the script by Xeno (or a derivation, thereof by cobra4v320) from here: http://forums.bistudio.com/showthread.php?86154-Repair-and-service-script&p=1434570&viewfull=1#post1434570

I know it's been a lot of years since anyone's probably messed with this script in any kind of way, but I have been having a little trouble with it.

I have a mission with several choppers, land vehicles and fixed wing aircraft sitting at an airport.

The problem I have with the script is that certain choppers never seem to trip the script, no matter what I do. The problem seems to be most acute in MP when on a dedicated server, although it's happened locally, through preview in the mission editor, also. Land vehicles work reliably, as do the fixed wing aircraft. Sadly, it is the choppers that sometimes work, sometimes don't. I seem to have the most problems specifically with one of the iterations of the Little Bird, but have had the problem with some Cobras, also. I land them on the trigger, yet nothing happens no matter how big or how small that trigger is. I then hop in a different chopper and do the same, then it works fine. I have made the trigger as small as 20m, and as big as the entire runway of the airport. I have also tried several iterations of the script from all over the net, but they all have the same problem.

I know that this is ancient history for most of you, but is there any way of tweaking this to make it a bit more reliable for choppers of all types? I am beginning to wonder if the script, itself, isn't being messed with by any of the other scripts I have going on the map. I have respawn scripts for all of the vehicles and ammo boxes, and I also run a script on the PMC SUV with the minigun to make it go up and down. If it would help, I could send my mission for testing, if anyone feels so inclined.

Any help would be greatly appreciated. Thank you in advance,

- LJ

Share this post


Link to post
Share on other sites

I didn't quite understand what is your problem. So you are trying to make something like "Vehicle service" point? if yes, then its already included in arma 2 editor, in warfare (i think). You can later manipulate it with scripts.

Share this post


Link to post
Share on other sites

Odd enough, I was just messing with Xeno's script in my Carrier Flight Operations. I didn't try helicopters, but was having problems with planes. The script is not the problem, but the trigger was.

This is what I was using for my setTriggerStatements:

setTriggerStatements ["(thisList select 0) isKindOf 'Air' && (getPos (thisList select 0) select 2) < 2", "null = [(thisList select 0)] execVM 'scripts\x_reload.sqf';",""];

It would trigger for AV8's, but I couldn't get it to work for Meatball's F/A18 or John Spartan's...

Ended up ditching the trigger and just scripting the whole thing :D

Edited by panther42

Share this post


Link to post
Share on other sites

@ sudslv - If you'll follow the link I posted, you will see that this is an actual downloadable script we're talking about that only works only intermittently in multiplayer. I believe it was a ported script from Warfare, but for use in any game type. I was asking if anyone had any insights as to why the script doesn't work reliably in MP since it's been around for about 4 years, and if they could post any fixes they had found in the intervening years.

- LJ

---------- Post added at 01:18 ---------- Previous post was at 01:16 ----------

Thanks, panther42. It does help to know that I am not the only one who is having problems. Sadly, I don't know how to script well enough to be able to figure out your method. Care to share?

- LJ

Share this post


Link to post
Share on other sites

Lord_Jereth, how is your trigger set up? Can you show us the condition/on execution statements?

My issue was dealing with planes I had landed at the airport. Each has a LandedStopped eventhandler which checks fuel and damage, then if needed, routes them to a repair point. They were moving to the repair point(trigger at first), but the trigger it self was only activating for certain planes... I ditched that trigger and just execute Xeno's repair script from within the movetorepair script. Works fine now.

Maybe your trigger is not catching all of your helicopters?

I will need to try it with the helicopters in my mission...

Share this post


Link to post
Share on other sites

@panther42,

Here is my x_reload.sqf

private ["_config","_count","_i","_magazines","_object","_type","_type_name"];

_object = _this select 0;

_type = typeof _object;

if (_object isKindOf "ParachuteBase") exitWith {};

//if (!local _object) exitWith {};

if (!alive _object) exitWith {};
_object setFuel 0;
_object setVehicleAmmo 1;	// Reload turrets / drivers magazine

_type_name = typeOf _object;

_object vehicleChat format ["Servicing %1... Please stand by...", _type];

_magazines = getArray(configFile >> "CfgVehicles" >> _type >> "magazines");

if (count _magazines > 0) then {
_removed = [];
{
	if (!(_x in _removed)) then {
		_object removeMagazines _x;
		_removed = _removed + [_x];
	};
} forEach _magazines;
{
	_object vehicleChat format ["Reloading %1", _x];
	sleep 4;
	if (!alive _object) exitWith {};
	_object addMagazine _x;
} forEach _magazines;
};

_count = count (configFile >> "CfgVehicles" >> _type >> "Turrets");

if (_count > 0) then {
for "_i" from 0 to (_count - 1) do {
	scopeName "xx_reload2_xx";
	_config = (configFile >> "CfgVehicles" >> _type >> "Turrets") select _i;
	_magazines = getArray(_config >> "magazines");
	_removed = [];
	{
		if (!(_x in _removed)) then {
			_object removeMagazines _x;
			_removed = _removed + [_x];
		};
	} forEach _magazines;
	{
		_object vehicleChat format ["Reloading %1", _x];
		sleep 4;
		if (!alive _object) then {breakOut "xx_reload2_xx"};
		_object addMagazine _x;
		sleep 4;
		if (!alive _object) then {breakOut "xx_reload2_xx"};
	} forEach _magazines;
	// check if the main turret has other turrets
	_count_other = count (_config >> "Turrets");

	if (_count_other > 0) then {
		for "_i" from 0 to (_count_other - 1) do {
			_config2 = (_config >> "Turrets") select _i;
			_magazines = getArray(_config2 >> "magazines");
			_removed = [];
			{
				if (!(_x in _removed)) then {
					_object removeMagazines _x;
					_removed = _removed + [_x];
				};
			} forEach _magazines;
			{
				_object vehicleChat format ["Reloading %1", _x]; 
				sleep 4;
				if (!alive _object) then {breakOut "xx_reload2_xx"};
				_object addMagazine _x;
				sleep 4;
				if (!alive _object) then {breakOut "xx_reload2_xx"};
			} forEach _magazines;
		};
	};
};
};
_object setVehicleAmmo 1;	// Reload turrets / drivers magazine

sleep 4;
if (!alive _object) exitWith {};
_object vehicleChat "Repairing...";
_object setDamage 0;
sleep 4;
if (!alive _object) exitWith {};
_object vehicleChat "Refueling...";
while {fuel _object < 0.99} do {
//_object setFuel ((fuel _vehicle + 0.1) min 1);
_object setFuel 1;
sleep 0.01;
};
sleep 4;
if (!alive _object) exitWith {};
_object vehicleChat format ["%1 is ready...", _type_name];

if (true) exitWith {};

In my trigger:

Condition:

((thisList select 0) isKindOf 'Air' && (getPos (thisList select 0) select 2) < 1) && (speed (thislist select 0) < 10)

onAct.

_xhandle= [(thislist select 0)] execVM "x_reload.sqf";

The trigger is set for "Anybody", and "Repeatedly". At the moment, the trigger is 400x20 and covering the entire airstrip, although I had it at 20x20 at first with the same problems.

------

I love the way that x_reload.sql works, but since the trigger is so unreliable, I was tinkering with the idea of making it a radio trigger, but couldn't get it to work. Maybe you'll have more luck?

- LJ

Share this post


Link to post
Share on other sites

Sorry Lord_Jereth, haven't had time to mess around with this, and I do not play multiplayer. If your issues are from MP, I wouldn't have a clue.

Only other thing I would think of at this time, is using debug console or other means to check the position of your helicopter at the time it should be activating the trigger.

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  

×