Jump to content
Sign in to follow this  
Wetherby

Problem with Patrol script using SHK_pos.

Recommended Posts

Hello everyone,

I have a problem with a patrol running with position find by SHK_pos(big thank to you Shuko for these great scripts) the script stop run when he must find patrol position, maybe it is the for command or incompatible position but i can't say how doesn't work so i request you help please

The Patrol script

if (!isServer) exitWith {};

_patrolgroupcentral = creategroup east;

_patrolgroupside1 = creategroup east;

_patrolgroupside2 = creategroup east;

_patrolgroupside3 = creategroup east;

_guard1 = creategroup east;

_mark = _this select 0;

_marksize = getMarkerSize _mark;

_markaxisA = _marksize select 0;

_sure = _markaxisA;

_sure2 = _markaxisA/2;

_range1 = round (Random 450);

_range2 = round (Random 300);

_spawnpos = getmarkerpos (_mark);

_pos1 = [getmarkerpos _mark,[_markaxisA/2,_sure],[0,90]] call SHK_pos;

_allunits = ["O_G_medic_F","O_G_officer_F","O_G_Soldier_A_F","O _G_Soldier_AR_F","O_G_Soldier_exp_F","O_G_Soldier_ F","O_G_Soldier_GL_F","O_G_Soldier_LAT_F","O_G_Sol dier_lite_F","O_G_Soldier_M_F","O_G_Soldier_SL_F", "O_G_Soldier_TL_F"];

_allammoboxOPFOR = ["O_supplyCrate_F","Box_IND_Support_F","Box_East_Su pport_F","Box_IND_Wps_F","Box_East_Wps_F","Box_IND _WpsSpecial_F","Box_East_WpsSpecial_F","I_supplyCr ate_F","C_supplyCrate_F","IG_supplyCrate_F","Box_I ND_AmmoOrd_F","Box_East_AmmoOrd_F","Box_IND_Grenad es_F","Box_East_Grenades_F","Box_IND_WpsLaunch_F", "Box_NATO_WpsLaunch_F","Box_East_WpsLaunch_F","Box _IND_Ammo_F","Box_East_Ammo_F","Box_NATO_AmmoVeh_F ","Box_IND_AmmoVeh_F","Box_East_AmmoVeh_F","Box_NA TO_Support_F","Box_NATO_WpsSpecial_F","Box_NATO_Wp s_F","B_supplyCrate_F","Box_NATO_Grenades_F","Box_ NATO_AmmoOrd_F","Box_NATO_Ammo_F"];

_max = (count _allunits)-1;

_maxAmmo = (count _allammoboxOPFOR)-1;

_officier1 = _patrolgroupcentral createUnit [_allunits select (round random _max),_pos1, [], 0,"NONE"];

_officier1 setskill ["commanding",1];

_officier1 setskill ["general",1];

_patrolgroupcentral setBehaviour "SAFE";

_patrolgroupcentral setSpeedMode "LIMITED";

_patrolgroupcentral setCombatMode "RED";

_patrolgroupcentral setFormation (["STAG COLUMN", "WEDGE", "ECH LEFT", "ECH RIGHT", "VEE", "DIAMOND"] call BIS_fnc_selectRandom);

//Guard

for "_j" from 0 to Numbermedian do {

_unit1 = _patrolgroupcentral createUnit [_allunits select (round random _max),position _officier1, [], 5, "FORM"];

[_unit1] join _patrolgroupcentral;

_unit1 setskill ["spotDistance",0.7];

_unit1 setskill ["spotTime",0.7];

};

for "_j" from 0 to 6000 do {

_posP1 = [getmarkerpos _mark,[150,_markaxisA],[0,90],0] call SHK_pos;

_posP2 = [getmarkerpos _mark,[150,_markaxisA],[90,180],0] call SHK_pos;

_posP3 = [getmarkerpos _mark,[150,_markaxisA],[180,270],0] call SHK_pos;

_posP4 = [getmarkerpos _mark,[150,_markaxisA],[270,0],0] call SHK_pos;

_wp1 = _patrolgroupcentral addWaypoint [_posP2, 0];

_wp1 setWaypointType "MOVE";

_wp2 = _patrolgroupcentral addWaypoint [_posP1, 0];

_wp2 setWaypointType "MOVE";

_wp3 = _patrolgroupcentral addWaypoint [_posP2, 0];

_wp3 setWaypointType "MOVE";

_wp4 = _patrolgroupcentral addWaypoint [_posP3, 0];

_wp4 setWaypointType "MOVE";

};

Great thank for your help!

Share this post


Link to post
Share on other sites

Looks a bit overly complicated, just use Shuko's shk_patrol.sqf".

Here is my random patrol spawn script using Shukos shk_pos and shk_patrol:

if (!isServer) exitwith {};

private ["_pos","_dis","_nr","_locPos","_loc","_spawnPos","_grp","_patrol","_spnr"];

_pos = _this select 0;
_dis = _this select 1;
_nr = _this select 2; // Array, use [1,1,1] for one group and [0,1,2] for random 0,1 or 2 groups

_locPos = [];
_spnr = _nr call BIS_fnc_selectRandom;
//DEBUG
/*hint format["%1",_spnr];*/

waituntil {!isnil "bis_fnc_init"};

if !(_spnr == 0) then {
for "_i" from 1 to (_spnr) do
{
_loc = [_pos,_dis,[0,360],0,[0,_dis]] call SHK_pos;
	if ((count _locPos == 0) || !(_loc in _locPos)) then {
		_locPos = _locPos + [_loc];
	};
};

if (count _locPos > 0) then {
	for "_i" from 1 to (count _locPos) do
	{
		_spawnPos = (_locPos select (floor random count _locPos));
		_locPos = _locPos - [_spawnPos];
		_name = ["OIA_InfSquad","OIA_InfSentry","OIA_InfSentry","OIA_InfTeam","OIA_InfTeam"] call BIS_fnc_selectRandom;
		sleep 0.1;
		_grp = createGroup east;
		_grp = [_spawnPos, east, (configfile >> "CfgGroups" >> "East" >> "OPF_F" >> "Infantry" >> _name)] call BIS_fnc_spawnGroup;
		_patrol = [_grp] execVM "scripts\shk_patrol.sqf";
		//DEBUG
		//[_spawnPos,"ColorRed"] call fnc_createMarker;
	}
};
};

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  

×