Jump to content
Sign in to follow this  
nebulazerz

Change or Ignore an empty Vehicles Faction

Recommended Posts

I have written a script to spawn a vehicle in the middle of 2 bases that red and blu can contend over, when blue kills red they get money and vice versa but I have run into a problem with spawning neutral vehicles. If I use an opfor vehicle then when i kill opfor from the vehicles weapon, it thinks I am killing a friendly. Is there a way that when I spawn this vehicle with this script I can also set the vehicles faction or tell it to ignore that it has a faction?


	if (isServer) then {
		disableSerialization;
		private["_position","_direction","_nearestTargets","_scanArea"];
//Create Marker
		createMarker ["LSVM1",[2914.5,12625.5]];
		"LSVM1" setMarkerType "Empty";
		"LSVM1" setMarkerSize [2, 2];
//Check if the marker has any cars near it
		_position = getMarkerPos "LSVM1";
		_scanArea = 5;
		_direction = 125;
		_nearestTargets = nearestObjects[_position,["landVehicle","Air","Ship"],_scanArea] select 0;
//if the marker has no cars near it then spawn the new car with nothing in inventory
if (!isNil "_nearestTargets") then {
			sleep 300;
		}else{
				_veh = createVehicle ["O_T_LSV_02_armed_F", _position, [], 0, "FLY"];
				_veh setVariable ["BIS_enableRandomization", false];
				_veh setDir _direction;
				_veh setPos [2914.5,12625.5,4];
				clearWeaponCargoGlobal _veh;
				clearMagazineCargoGlobal _veh;
				clearItemCargoGlobal _veh;
				_veh setVehicleVarName "MercLSV1";
				MercLSV1 = _veh;
//Delete Vehicle in 299 Seconds and delete the marker
				execVM "Classes\Merc\Vehicles\Veh1Cleanup.sqf";
				deleteMarker "LSVM1";
				sleep 300;
		};
	};
};

459C7F21B99CF145D0DBE22160F157E72CBC79EA

Share this post


Link to post
Share on other sites

I have written a script to spawn a vehicle in the middle of 2 bases that red and blu can contend over, when blue kills red they get money and vice versa but I have run into a problem with spawning neutral vehicles. If I use an opfor vehicle then when i kill opfor from the vehicles weapon, it thinks I am killing a friendly. Is there a way that when I spawn this vehicle with this script I can also set the vehicles faction or tell it to ignore that it has a faction?

 

EDIT: NVM changing the level system fixed it.

while{true} do{
	if (isServer) then {
		disableSerialization;
		private["_position","_direction","_nearestTargets","_scanArea"];
//Create Marker
		createMarker ["LSVM1",[2914.5,12625.5]];
		"LSVM1" setMarkerType "Empty";
		"LSVM1" setMarkerSize [2, 2];
//Check if the marker has any cars near it
		_position = getMarkerPos "LSVM1";
		_scanArea = 5;
		_direction = 125;
		_nearestTargets = nearestObjects[_position,["landVehicle","Air","Ship"],_scanArea] select 0;
//if the marker has no cars near it then spawn the new car with nothing in inventory
if (!isNil "_nearestTargets") then {
			sleep 300;
		}else{
				_veh = createVehicle ["O_T_LSV_02_armed_F", _position, [], 0, "FLY"];
				_veh setVariable ["BIS_enableRandomization", false];
				_veh setDir _direction;
				_veh setPos [2914.5,12625.5,4];
				clearWeaponCargoGlobal _veh;
				clearMagazineCargoGlobal _veh;
				clearItemCargoGlobal _veh;
				_veh setVehicleVarName "MercLSV1";
				MercLSV1 = _veh;
//Delete Vehicle in 299 Seconds and delete the marker
				execVM "Classes\Merc\Vehicles\Veh1Cleanup.sqf";
				deleteMarker "LSVM1";
				sleep 300;
		};
	};
};

459C7F21B99CF145D0DBE22160F157E72CBC79EA

This is actually still a problem, even using larrows xp/money system tested on a dedicated server with clients connected. It gives me score when i kill, but its not giving me money or xp because it thinks the vehicle is killing and not the player for the side check in the xp system. Is there no way to make this vehicle spawn as independent owned rather than opfor owned? If i can spawn things as independent then it is neutral to both sides but that still might not fix it because it thinks the vehicle is killing, so in that case i would have to look into tying score gain to xp/money gain instead of just looking for kills? I wish that BI would just make it so it is bypassing the vehicle as the killer and just think its the player, kind of an annoying bug for level systems.

Share this post


Link to post
Share on other sites

I think it should be possible with assigning the veh8cle to a group of the side u need. if u not have already a group wh8ch is suitable then u can create 9ne. But be aware bout the 144 groups limit and use a script to clean up groups which have no members because afaik arma isnt deleting empty groups automatically.

This code creates a group and assigns a vehicle to it:

_group1 = createGroup west;

_group1 addVehicle your_desired_vehicle;

Now is your_desired_vehicle part of side west and should be treated as those one.

  • 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
Sign in to follow this  

×