Jump to content
Sign in to follow this  
hogmason

fn_spawnVehicle.sqf error line 70

Recommended Posts

why am i getting this error

Error in expression <* (cos _azi), 0];
}
else
{
_veh = _type createVehicle _pos;
};


_veh setDir _az>
 Error position: <createVehicle _pos;
};


_veh setDir _az>
 Error 0 elements provided, 3 expected
File ca\modules\functions\spawning\fn_spawnVehicle.sqf, line 70
Error in expression <* (cos _azi), 0];
}
else
{
_veh = _type createVehicle _pos;
};


_veh setDir _az>
 Error position: <createVehicle _pos;
};


_veh setDir _az>
 Error 0 elements provided, 3 expected
File ca\modules\functions\spawning\fn_spawnVehicle.sqf, line 70


i am calling spawnvehicle by


for "_i" from 0 to 10 do 
	{

    _grp2 = [];
	_spawn2 = getMarkerPos "E_Patrol";
	_offset2 = [30,50,70,80,120,200,250] call BIS_fnc_selectRandom;
	_offset3 = random 100;
	_prec2 = random 100;
	_exp2 = "(1 - houses) * (1 - houses)";
	_bestplace2 = selectBestPlaces [_spawn2,_offset2,_exp2,_prec2,1];
	_spot4 = _bestplace2 select 0;
	_spot3 = _spot4 select 0;
	_safespawn2 = _spot3 findEmptyPosition [10, 75, "tank"];
	_randomvehicle2 = ["T34_TK_EP1","BRDM2_ATGM_TK_EP1","LandRover_MG_TK_EP1","T72_TK_EP1","ZSU_TK_EP1"] call BIS_fnc_selectRandom;
	_direction2 = random 359;
	[color="#FF0000"]_vehicleCreated =[_safespawn2, _direction2, _randomvehicle2, EAST] call BIS_fnc_spawnvehicle;[/color]
	_vehiclegroup = _vehicleCreated select 2;//group
	[(units _vehiclegroup) select 0, "E_Patrol","spawned","nofollow","random","nowait","delete:",120] execVM "scripts\upsmon.sqf";

	};

Share this post


Link to post
Share on other sites

This usually happens when you provide invalid argument into createVehicle. Keep in mind that findEmptyPosition might return [] (empty array) if no empty position was found, likely this is the case take this into account.

Share this post


Link to post
Share on other sites

Thanks mate

---------- Post added at 14:46 ---------- Previous post was at 14:45 ----------

well it its wierd i mean i only get that error say 1 out 3 mission loads

Share this post


Link to post
Share on other sites
Thanks mate

---------- Post added at 14:46 ---------- Previous post was at 14:45 ----------

well it its wierd i mean i only get that error say 1 out 3 mission loads

Try to add

hint format ["%1", _safespawn2];

and notice that findEmptyPosition is not reliable and not always finds position.

Share this post


Link to post
Share on other sites

for "_i" from 0 to 10 do {
_grp2 = [];
_spawn2 = getMarkerPos "E_Patrol";
_offset2 = [30,50,70,80,120,200,250] call BIS_fnc_selectRandom;
_offset3 = random 100;
_prec2 = random 100;
_exp2 = "(1 - houses) * (1 - houses)";
_bestplace2 = selectBestPlaces [_spawn2,_offset2,_exp2,_prec2,1];
_spot4 = _bestplace2 select 0;
_spot3 = _spot4 select 0;
_safespawn2 = [];
_attempts = 10;
while {(count _safespawn2 == 0) && (_attempts > 0)} do {
	_safespawn2 = _spot3 findEmptyPosition [10 + ((10 - _attempts) * 10), 75 + ((10 - _attempts) * 10), "tank"];
	_attempts = _attempts - 1;
}
if(count _safespawn2 == 3) then {
	_randomvehicle2 = ["T34_TK_EP1","BRDM2_ATGM_TK_EP1","LandRover_MG_TK_EP1","T72_TK_EP1","ZSU_TK_EP1"] call BIS_fnc_selectRandom;
	_direction2 = random 359;
	_vehicleCreated =[_safespawn2, _direction2, _randomvehicle2, EAST] call BIS_fnc_spawnvehicle;
	_vehiclegroup = _vehicleCreated select 2;//group
	[(units _vehiclegroup) select 0, "E_Patrol","spawned","nofollow","random","nowait","delete:",120] execVM "scripts\upsmon.sqf";
};
};

Here is how I would do it. Basically it attempts to find safe position 10 times and increases radius and search distance by 10 meters each attempt. And it creates group only if position was found. (You can get rid of all "10 attempts" thing actually and just skip group creation if no position was found)

(I did not test the code, let me know if it will throw an error.)

Share this post


Link to post
Share on other sites

its spitting this error out mate


Error in expression <, "tank"];
_attempts = _attempts - 1;
}
if(count _safespawn2 == 3) then {
_rando>
 Error position: <if(count _safespawn2 == 3) then {
_rando>
 Error Missing ;
File C:\Users\natho\Documents\ArmA 2 Other Profiles\=Mason=\missions\Operation_HOG_V_3.Takistan\missions\spawners\Task_Enemy\task_enemy.sqf, line 45
Error in expression <, "tank"];
_attempts = _attempts - 1;
}
if(count _safespawn2 == 3) then {
_rando>
 Error position: <if(count _safespawn2 == 3) then {
_rando>
 Error Missing ;
File C:\Users\natho\Documents\ArmA 2 Other Profiles\=Mason=\missions\Operation_HOG_V_3.Takistan\missions\spawners\Task_Enemy\task_enemy.sqf, line 45



---------- Post added at 19:52 ---------- Previous post was at 19:46 ----------

all good got i9t works great thanks mate your a legend.

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  

×