Jump to content
Sign in to follow this  
malakdecaen

need help"UserActions" for my addon

Recommended Posts

Hi everbody ;

I try to add a fonction to my addon , i have make a building and i want to add a action to repair vehicle when they are into with a script .

i have try to put this in my config.cpp

class UserActions 
	{
		class repair_vehicle
		{
			displayName = "Reparer Vehicule";
			position = "repair_action";
			radius = 6;
			onlyForPlayer = 0;
			condition = "(""LandVehicle"" countType thislist  > 0) && ((getpos (thislist select 0)) select 2 < 1)";
			statement = "_xhandle= (thislist select 0) execVM ""x_reload.sqf""";
		};
	};

and i put the script in my addon file .

Maybe i miss something ??

need something in model.cfg or in class AnimationSources in config.cpp?

thanks a lot for helping me .

Edited by kakarot
forgot

Share this post


Link to post
Share on other sites

try:

""YourAddonPboName\x_reload.sqf"""

have you added a memory point called repair_action?

Share this post


Link to post
Share on other sites

thanks for you'r reply , yes i put the memory point , and i tried what do you say but ingame i can't see any action .

Share this post


Link to post
Share on other sites

Think it actually needs to be \addoname\scriptname on reflection, but the action should still be visible regardless of whether the script works or not.

Have you tried removing the condition to check if that is causing the problem?

Share this post


Link to post
Share on other sites

when i removed the condition is the same i can't see any action ; it's very strange

---------- Post added at 03:35 PM ---------- Previous post was at 01:51 PM ----------

class useractions :

class repairautoo

{

displayName = "Reparer Vehicule";

position = "repair_action";

radius = 26;

onlyForPlayer = 0;

condition = "";

statement = "this execVM ""\malak_car\garage\x_reload.sqf""";

};

i find something if i put an other script like hint "jdhfjhfj"; that work ! so i think my script doesn't work

what's the problem with the repar script ? why it don't work ?

_object = _this;

_type = typeOf _object;

x_reload_time_factor = 0.01;

_object setVehicleAmmo 1;

_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 x_reload_time_factor;
	_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 x_reload_time_factor;
		_object addMagazine _x;
		sleep x_reload_time_factor;
	} forEach _magazines;
	_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 x_reload_time_factor;
				_object addMagazine _x;
				sleep x_reload_time_factor;
			} forEach _magazines;
		};
	};
};
};
_object setVehicleAmmo 1;	// Reload turrets / drivers magazine

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

if (true) exitWith {};

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  

×