Jump to content

RoryRothon

Member
  • Content Count

    56
  • Joined

  • Last visited

  • Medals

Posts posted by RoryRothon


  1. Hi (again), i have setup a loop to add alive players into an array and remove dead.

    Want i'm struggling to grasp, is how i can in-fact access variables from further down in my sqf file?

    I'm trying to learn SQF, and i am really enjoying it! But this is confusing the hell out of me lol

     

    As always, i am extremely grateful of any and all help..

    Kind regards

    Rory...

     

    This is what i have setup:

    _loopCheck = [] spawn {
    
    	_displayResults = true;
    
    	while { _displayResults } do {
    
    		_alivePlayers = [];
    
    		{
    
    			if ( alive _x && isPlayer _x ) then { _alivePlayers = _alivePlayers + [_x] };
    			if ( !alive _x && isPlayer _x ) then { _alivePlayers = _alivePlayers - [_x]; };
    
    		} forEach allPlayers - switchableUnits;
    
    		_aliveCount = count _alivePlayers;
    
    		sleep 2;
    
    	};
    
    };

     


  2. Ive been messing around and for the life of me i cannot get this working lol

    My mission starts with all players split up.

    Once they find each other, they join the same group (Using ACE3).

    I want to run a check to see if all alive players are in the same group, and if so return a true value that i can use to fire the creation of a rendezvous point & trigger.

    Then i need to check that the whole group (of alive players in the same group) are within the trigger area to trigger mission complete....

     

    Any advice would be greatly appreciated...

    Kind regards

    Rory


  3. Right.

    I have fixed the issue with spawning only INDEP (my mistake, i removed the WEST config array as not needed, but putting it back works).

    I have also made a check on _sideID as follows:

     

    systemchat format ["SideID: %1", _sideID]; //<< Debug to grab _sideID
    
    _faction = Nil;
    if ( _sideID == 0 ) then { _faction = East };
    if ( _sideID == 1 ) then { _faction = West };
    if ( _sideID == 2 ) then { _faction = Independent };
    
    _grp = [_spawnPos, _faction, (selectRandom ( CFC_fnc_groupTemplates select _sideID ) ) ] call BIS_fnc_spawnGroup;

    This will now change the faction depending on the _sideID so all is working.

    However, when 1 group is dead, the code loops and spawns in 2 more groups (1x INDEP & 1x OPFOR) thus giving me 3 groups hunting a player when i need a maximum of 2 per player.


  4. 43 minutes ago, Grumpy Old Man said:

    You could easily add the possibility to spawn multiple sides, just change the groupTemplate array to this:

    
    TAG_fnc_groupTemplates = [
    
    	[
    	//east configs here
    	],
    
    	[
    	//west configs here
    	],
    
    	[
    	//indep configs here
    	configfile >> "CfgGroups" >> "Indep" >> "CUP_I_PMC_ION" >> "Infantry" >> "CUP_I_PMC_ION_Field_Security_Patrol",
    	configfile >> "CfgGroups" >> "Indep" >> "CUP_I_PMC_ION" >> "Infantry" >> "CUP_I_PMC_ION_Field_Security_Team",
    	configfile >> "CfgGroups" >> "Indep" >> "CUP_I_PMC_ION" >> "Infantry" >> "CUP_I_PMC_ION_Field_Support_Team",
    	configfile >> "CfgGroups" >> "Indep" >> "CUP_I_PMC_ION" >> "Infantry" >> "CUP_I_PMC_ION_Security_Detail",
    	configfile >> "CfgGroups" >> "Indep" >> "CUP_I_PMC_ION" >> "Infantry" >> "CUP_I_PMC_ION_Security_Specialists",
    	configfile >> "CfgGroups" >> "Indep" >> "CUP_I_PMC_ION" >> "Infantry" >> "CUP_I_PMC_ION_VIP_Bodyguard"
    	]
    
    ];

    Add east and west side group configs as seen in the comments.

    Then replace the spawn group function with this:

    
    TAG_fnc_spawnHostileGroups = {
    
    	params ["_unit",["_side",independent]];//side will default to indep
    
    	_debug = false;
    	_sideID = _side call BIS_fnc_sideID;
    
    	_pos = getPosATL _unit;
    	_unit setVariable ["TAG_fnc_isBeingHunted",true,true];
    
    	_spawnPos = _pos getPos [200, random 360];
    	_spawnPos = [_spawnPos, 1, 150, 3, 0, 20, 0] call BIS_fnc_findSafePos;
    
    	if (_debug) then {systemchat format ["Spawning enemies to hunt %1!",name _unit]};
    
    	_grp = [ _spawnPos, INDEPENDENT, ( selectRandom (TAG_fnc_groupTemplates select _sideID) ) ] call BIS_fnc_spawnGroup;
    
    	_grp deleteGroupWhenEmpty true;//handles group deletion automatically
    
    	{
    		_x setskill 0.25;
    
    	} forEach units _grp;
    
    	_wp = _grp addWaypoint [position _unit, 0];
    	[_grp, 1] setWaypointType "SAD";
    	[_grp, 1] setWaypointSpeed "FULL";
    
    	{
    
    		_youCanNameThisWhateverthefuckyouwantItDoesntHaveToBeNullAllTheTimeForCryingOutLoud = [_x] execVM "AL_searchlight\al_search_light_ini.sqf"
    
    	} forEach units _grp;
    
    	while {({alive _x} count units _grp) >= 1} do {
    
    		//sleep 90;//this sleep is bad since it can cause an unwanted delay between spawning groups, the delay will be handled later
    		_timer = time + 10;
    		waituntil {
    
    			sleep 1;
    			position _unit distance _spawnpos > 30 OR time > _timer OR ({alive _x} count units _grp) isEqualTo 0
    
    		};
    
    		deleteWaypoint [_grp, 1];
    		_wp = _grp addWaypoint [position _unit, 1];
    		[_grp, 1] setWaypointType "SAD";
    		[_grp, 1] setWaypointSpeed "FULL";
    
    	};
    
    	if (_debug) then {systemchat format ["All units hunting %1 died!",name _unit]};
    
    	//wait 1 second to allow spawning of new groups to hunt the player, adjust this to your liking
    	sleep 1;
    	_unit setVariable ["TAG_fnc_isBeingHunted",false,true];
    
    };

    Notice the additional input parameter.

    You now call it like this:

    
    _hunt = [_x,east] spawn TAG_fnc_spawnHostileGroups;

    If no side input parameter is given it will default to independent.

    Note that you need to modify the group templates or it won't work.

    To round it up your spawn loop will look like this to spawn one independend and one east group hunting the player:

    
    
    _spawningEnemies = [] spawn {
    
    	_debug = false;
    	_players = [];
    	TAG_fnc_spawnEnemies = true;
    
    	if (_debug) then {systemchat "System Initialized"};
    
    	//wait until the mission is running
    	waitUntil {time > 0};
    
    	if (_debug) then {systemchat "Mission Running"};
    
    	while {TAG_fnc_spawnEnemies} do {
    
    		if (_debug) then {systemchat "Loop Running"};
    
    		//wait until there's players on the server
    		waitUntil {
    
    			if (_debug) then {systemchat "Waiting for players..."};
    			sleep 3;
    			 (count (allplayers - switchableUnits) > 0)
    
    		};
    
    		if (_debug) then {systemchat "Players detected!"};
    
    		//will only select players that are not currently hunted
    		_players = (allplayers - switchableUnits) select {!(_x getVariable ["TAG_fnc_isBeingHunted",false])};
    
    		_players apply {
    
    			_hunt = [_x,independent] spawn TAG_fnc_spawnHostileGroups;
    			_hunt = [_x,east] spawn TAG_fnc_spawnHostileGroups;
    
    		};
    
    	};
    
    };

     

    Cheers

     

    This is throwing me an error stating:

    Error Params: type string, expected array.

    But thanks for your help thus far again.

    This is also helping me to understand a little better.


  5. 38 minutes ago, Grumpy Old Man said:

     

    Take a closer look at your code and how it is executed.

    You define _players array which will never change once it's being defined.

    Now you check for _players to hold more than zero players, due to the nature that _players remains static this will never change and you'll never leave the waitUntil loop.

    The next if then statement is nonsensical too, since it will basically exit the entire spawn when false but due to the above you'll never make it that far.

    The if isNull _player check doesn't make sense, since allPlayers will never hold null objects.

     

    The for "_i" from 0 to 999999 loop will run for the first player inside the _players array only, not simultaneously for multiple players.

    You also don't need to delete waypoints from groups before deleting the group. Waypoints get deleted with the group.

     

    Perfect example of being in over your head, heh.

     

    Try to make small portions of the script work, if this succeeds try to figure out how to either break it up into smaller functions for better readability or improve readability in the first place.

    I broke up your snippet into multiple smaller portions, enhanced it to hold a separate group spawning function and only spawn hostile groups if the player currently isn't being already chased by one (if that's your intention).

    Also added comments and removed the redundant else {} statement.

     

    Feel free to ask if you got further questions:

    
    
    //do this in initserver.sqf or wherever you call the script, no need to do this every time you spawn a group
    TAG_fnc_groupTemplates = [
    
    	configfile >> "CfgGroups" >> "Indep" >> "CUP_I_PMC_ION" >> "Infantry" >> "CUP_I_PMC_ION_Field_Security_Patrol",
    	configfile >> "CfgGroups" >> "Indep" >> "CUP_I_PMC_ION" >> "Infantry" >> "CUP_I_PMC_ION_Field_Security_Team",
    	configfile >> "CfgGroups" >> "Indep" >> "CUP_I_PMC_ION" >> "Infantry" >> "CUP_I_PMC_ION_Field_Support_Team",
    	configfile >> "CfgGroups" >> "Indep" >> "CUP_I_PMC_ION" >> "Infantry" >> "CUP_I_PMC_ION_Security_Detail",
    	configfile >> "CfgGroups" >> "Indep" >> "CUP_I_PMC_ION" >> "Infantry" >> "CUP_I_PMC_ION_Security_Specialists",
    	configfile >> "CfgGroups" >> "Indep" >> "CUP_I_PMC_ION" >> "Infantry" >> "CUP_I_PMC_ION_VIP_Bodyguard"
    
    ];
    
    
    //do this in initserver.sqf or wherever you call the script
    TAG_fnc_spawnHostileGroups = {
    
    	params ["_unit"];
    	_debug = false;
    
    	_pos = getPosATL _unit;
    	_unit setVariable ["TAG_fnc_isBeingHunted",true,true];
    
    	_spawnPos = _pos getPos [200, random 360];
    	_spawnPos = [_spawnPos, 1, 150, 3, 0, 20, 0] call BIS_fnc_findSafePos;
    
    	if (_debug) then {systemchat format ["Spawning enemies to hunt %1!",name _unit]};
    
    	_grp = [ _spawnPos, INDEPENDENT, ( selectRandom TAG_fnc_groupTemplates ) ] call BIS_fnc_spawnGroup;
    
    	_grp deleteGroupWhenEmpty true;//handles group deletion automatically
    
    	{
    		_x setskill 0.25;
    
    	} forEach units _grp;
    
    	_wp = _grp addWaypoint [position _unit, 0];
    	[_grp, 1] setWaypointType "SAD";
    	[_grp, 1] setWaypointSpeed "FULL";
    
    	{
    
    		_youCanNameThisWhateverthefuckyouwantItDoesntHaveToBeNullAllTheTimeForCryingOutLoud = [_x] execVM "AL_searchlight\al_search_light_ini.sqf"
    
    	} forEach units _grp;
    
    	while {({alive _x} count units _grp) >= 1} do {
    
    		//sleep 90;//this sleep is bad since it can cause an unwanted delay between spawning groups, the delay will be handled later
    		_timer = time + 10;
    		waituntil {
    
    			sleep 1;
    			position _unit distance _spawnpos > 30 OR time > _timer OR ({alive _x} count units _grp) isEqualTo 0
    
    		};
    
    		deleteWaypoint [_grp, 1];
    		_wp = _grp addWaypoint [position _unit, 1];
    		[_grp, 1] setWaypointType "SAD";
    		[_grp, 1] setWaypointSpeed "FULL";
    
    	};
    
    	if (_debug) then {systemchat format ["All units hunting %1 died!",name _unit]};
    
    	//wait 1 second to allow spawning of new groups to hunt the player, adjust this to your liking
    	sleep 1;
    	_unit setVariable ["TAG_fnc_isBeingHunted",false,true];
    
    };
    
    
    _spawningEnemies = [] spawn {
    
    	_debug = false;
    	_players = [];
    	TAG_fnc_spawnEnemies = true;
    
    	if (_debug) then {systemchat "System Initialized"};
    
    	//wait until the mission is running
    	waitUntil {time > 0};
    
    	if (_debug) then {systemchat "Mission Running"};
    
    	while {TAG_fnc_spawnEnemies} do {
    
    		if (_debug) then {systemchat "Loop Running"};
    
    		//wait until there's players on the server
    		waitUntil {
    
    			if (_debug) then {systemchat "Waiting for players..."};
    			sleep 3;
    			 (count (allplayers - switchableUnits) > 0)
    
    		};
    
    		if (_debug) then {systemchat "Players detected!"};
    
    		//will only select players that are not currently hunted
    		_players = (allplayers - switchableUnits) select {!(_x getVariable ["TAG_fnc_isBeingHunted",false])};
    
    		_players apply {_hunt = [_x] spawn TAG_fnc_spawnHostileGroups};
    
    	};
    
    };

     

    Cheers

     

     

    That works nicely in testing locally.

    My plan is to spawn 1 green and 1 red group to hunt down players.
    Is there a semantic way to add in a red group too or would i need to replicate this with edits?

    • Like 1

  6. 1 minute ago, xjoker_ said:

    what do you mean by "broken" ? 

    Errors in rpt ? No errors but working partially ? No errors but not working at all ? 

    By the way you should put the variable "_islamicState " out of your foreach as it should always have the same value

     

    I have no errors, works superbly on my LAN hosted session, but on my dedicated server the enemy do not spawn.

    I have vehicles and choppers spawning fine, but im trying to spawn an enemy squad for each player that moves towards them....

    Im getting quite frustrated with it lol


  7. This is what i have thus far, and it is still broken :(

    Trying to learn dedi scripting is fun but hard lol

    all wrapped in:

     

    if (isServer) then {
    //here
    };

     

    0 = [] spawn {
    
    	_players = playableUnits + switchableUnits;
    
    	waitUntil { count _players > 0 };
    
    	if ( count _players > 0 ) then {
    
    		{
    
    			_player = _x;
    
    			if (!isNull _player) then {
    
    				_pos = getPosATL _player;
    
    				for '_i' from 0 to 999999 do {
    
    					_islamicState = [
    						configfile >> "CfgGroups" >> "Indep" >> "CUP_I_PMC_ION" >> "Infantry" >> "CUP_I_PMC_ION_Field_Security_Patrol",
    						configfile >> "CfgGroups" >> "Indep" >> "CUP_I_PMC_ION" >> "Infantry" >> "CUP_I_PMC_ION_Field_Security_Team",
    						configfile >> "CfgGroups" >> "Indep" >> "CUP_I_PMC_ION" >> "Infantry" >> "CUP_I_PMC_ION_Field_Support_Team",
    						configfile >> "CfgGroups" >> "Indep" >> "CUP_I_PMC_ION" >> "Infantry" >> "CUP_I_PMC_ION_Security_Detail",
    						configfile >> "CfgGroups" >> "Indep" >> "CUP_I_PMC_ION" >> "Infantry" >> "CUP_I_PMC_ION_Security_Specialists",
    						configfile >> "CfgGroups" >> "Indep" >> "CUP_I_PMC_ION" >> "Infantry" >> "CUP_I_PMC_ION_VIP_Bodyguard"
    					];
    
    					_spawnPos = [_pos, 200, (RANDOM 360)] call BIS_fnc_relPos;
    					_spawnPos = [_spawnPos, 1, 150, 3, 0, 20, 0] call BIS_fnc_findSafePos;
    					_grp = [ _spawnPos, INDEPENDENT, ( selectRandom _islamicState ) ] call BIS_fnc_spawnGroup;
    					{ _x setskill 0.25; } forEach units _grp;
    					_wp = _grp addWaypoint [position _player, 0];
    					[_grp, 1] setWaypointType "SAD";
    					[_grp, 1] setWaypointSpeed "FULL";
    
    					{ null = [_x] execVM "AL_searchlight\al_search_light_ini.sqf" } forEach units _grp;
    
    					while {({alive _x} count units _grp) > 1} do {
    
    						sleep 90;
    						deleteWaypoint [_grp, 1];
    						_wp = _grp addWaypoint [position _player, 1];
    						[_grp, 1] setWaypointType "SAD";
    						[_grp, 1] setWaypointSpeed "FULL";
    
    					};
    
    					waitUntil {({alive _x} count units _grp) < 1};
    					deleteWaypoint [_grp, 1];
    					deleteGroup _grp;
    
    				};
    
    			};
    
    		} forEach _players;
    
    	}
    
    	else {};
    
    };

     


  8. I currently have this.

    It works fine on my local system under lan hosted session but when i upload it to my dedi, it does not....

    Can someone see any mistakes ive made?

    And yes i have done the server check in my sqf :)

     

    {
    
    		// Starting spawning RED units
    		0 = [] spawn {
    
    			for '_i' from 0 to 999999 do {
    
    				_islamicState = [
    					configfile >> "CfgGroups" >> "east" >> "LOP_ISTS_OPF" >> "Infantry" >> "LOP_ISTS_OPF_AT_section",
    					configfile >> "CfgGroups" >> "east" >> "LOP_ISTS_OPF" >> "Infantry" >> "LOP_ISTS_OPF_Fireteam",
    					configfile >> "CfgGroups" >> "east" >> "LOP_ISTS_OPF" >> "Infantry" >> "LOP_ISTS_OPF_InfSupTeam",
    					configfile >> "CfgGroups" >> "east" >> "LOP_ISTS_OPF" >> "Infantry" >> "LOP_ISTS_OPF_Patrol_section",
    					configfile >> "CfgGroups" >> "east" >> "LOP_ISTS_OPF" >> "Infantry" >> "LOP_ISTS_OPF_Rifle_squad",
    					configfile >> "CfgGroups" >> "east" >> "LOP_ISTS_OPF" >> "Infantry" >> "LOP_ISTS_OPF_Support_section"
    				];
    
    				_spawnPos = [player, 500, (RANDOM 360)] call BIS_fnc_relPos;
    				_spawnPos = [_spawnPos, 1, 150, 3, 0, 20, 0] call BIS_fnc_findSafePos;
    				_grp = [ _spawnPos, EAST, ( selectRandom _islamicState ) ] call BIS_fnc_spawnGroup;
    				{ _x setskill 0.25; } forEach units _grp;
    				_wp = _grp addWaypoint [position player, 0];
    				[_grp, 1] setWaypointType "SAD";
    				[_grp, 1] setWaypointSpeed "FULL";
    				{ null = [_x] execVM "AL_searchlight\al_search_light_ini.sqf" } forEach units _grp;
    
    				while {({alive _x} count units _grp) > 1} do {  
    					sleep 120;
    					deleteWaypoint [_grp, 1];
    					_wp = _grp addWaypoint [position player, 1];
    					[_grp, 1] setWaypointType "SAD";
    					[_grp, 1] setWaypointSpeed "FULL";
    				}; 
    
    				waitUntil {({alive _x} count units _grp) < 1};
    				deleteWaypoint [_grp, 1];
    				deleteGroup _grp;
    
    			};
    
    		};
    
    	} forEach playableUnits;

     


  9. I'm currently working on the same kind of thing:

    I am creating a custom module that uses the UPSMON built in spawn function (using randoms & unit array).

    No static marker, instead a marker is placed on the position of the module @ 2000m square.

    When all units in the squad are dead, the marker then deletes...

     

    Next i'm working on marker position update every 60 seconds on the squad leaders position...

     

    ["[CFC] Takistan Locals","INFANTRY", {
    
    	_markerPrefix = floor random 999999;
    	_patrolMarker = createMarker ["patrolMarker" + (str _markerPrefix), _this select 0];
    	_patrolMarker setMarkerAlpha 0;
    	_patrolMarker setMarkerShape "RECTANGLE";
    	_patrolMarker setMarkerSize [2000, 2000];
    
    	_grp = [_this select 0,INDEPENDENT,[
    	"CUP_I_TK_GUE_Soldier_AA",
    	"CUP_I_TK_GUE_Soldier_AR",
    	"CUP_I_TK_GUE_Guerilla_Medic",
    	"CUP_I_TK_GUE_Demo",
    	"CUP_I_TK_GUE_Soldier",
    	"CUP_I_TK_GUE_Soldier_AK_47S",
    	"CUP_I_TK_GUE_Soldier_HAT",
    	"CUP_I_TK_GUE_Guerilla_Enfield",
    	"CUP_I_TK_GUE_Soldier_GL",
    	"CUP_I_TK_GUE_Soldier_M16A2",
    	"CUP_I_TK_GUE_Soldier_AAT",
    	"CUP_I_TK_GUE_Soldier_AT",
    	"CUP_I_TK_GUE_Sniper",
    	"CUP_I_TK_GUE_Mechanic",
    	"CUP_I_TK_GUE_Soldier_MG",
    	"CUP_I_TK_GUE_Soldier_TL",
    	"CUP_I_TK_GUE_Commander"
    	],[2,4],2,[_patrolMarker,"SPAWNED","CARELESS","DELETE:",80,"NOVEH","COLUMN","LIMITED"]] call UPSMON_CreateGroup;
    
    	{_X addCuratorEditableObjects [units _grp,true];} forEach AllCurators;
    
    	while {true} do {
    		if ( { alive _x } count (units _grp) < 1) then { deleteMarker _patrolMarker; };
    	};
    
    }] call Ares_fnc_RegisterCustomModule;

     


  10. After practicing a bit with 3DS MAX i now feel confident enough to take the plunge and design my first Arma3 model.

    I plan on building a simple modern house and would like to know of any standard dimensions for arma3 buidlings.

     

    Looking for things like:

     

    Wall thickness

    Door width & height

    Steps height & depth etc...

    Typical dimensions of current buildings within the game.

    (off subject, but road width would be a nice one to know)

     

    And is there any vanilla textures i can use with my model to make it not look out of place within arma?

     

    Any info or a point in the right direction would be awesome!

    Regards

     

     


  11. 4 hours ago, killzone_kid said:


    Max gradient of 45 is almost a vertical wall. If you want position with incline 45 degrees or less, max gradient will be about 1 not 45. You might as well use 0 instead of 45 to speed up the command as result would be almost identical only faster.

    All explained here: https://community.bistudio.com/wiki/BIS_fnc_findSafePos

     Yea i know, i was just playing and testing and never reset from 45 lol

    Thanks for the heads up though :)


  12. An of you gurus out there know whether, and if so, how i could turn this into a loop for each player on the server rather than naming each element and referencing it?

    Although this works, just wondering if there is a cleaner way of doing it?

     

    _p1StartPos =[getMarkerpos "Spawn", 1, 900, 3, 0, 45, 0] call BIS_fnc_findSafePos;
    player1 setPos _p1StartPos;
    
    _p2StartPos =[getMarkerpos "Spawn", 1, 900, 3, 0, 45, 0] call BIS_fnc_findSafePos;
    player2 setPos _p2StartPos;
    
    _p3StartPos =[getMarkerpos "Spawn", 1, 900, 3, 0, 45, 0] call BIS_fnc_findSafePos;
    player3 setPos _p3StartPos;
    
    _p4StartPos =[getMarkerpos "Spawn", 1, 900, 3, 0, 45, 0] call BIS_fnc_findSafePos;
    player4 setPos _p4StartPos;
    
    _p5StartPos =[getMarkerpos "Spawn", 1, 900, 3, 0, 45, 0] call BIS_fnc_findSafePos;
    player5 setPos _p5StartPos;
    
    _p6StartPos =[getMarkerpos "Spawn", 1, 900, 3, 0, 45, 0] call BIS_fnc_findSafePos;
    player6 setPos _p6StartPos;
    
    _p7StartPos =[getMarkerpos "Spawn", 1, 900, 3, 0, 45, 0] call BIS_fnc_findSafePos;
    player7 setPos _p7StartPos;
    
    _p8StartPos =[getMarkerpos "Spawn", 1, 900, 3, 0, 45, 0] call BIS_fnc_findSafePos;
    player8 setPos _p8StartPos;
    
    _p9StartPos =[getMarkerpos "Spawn", 1, 900, 3, 0, 45, 0] call BIS_fnc_findSafePos;
    player9 setPos _p9StartPos;

    Regards


  13. 1 minute ago, Grumpy Old Man said:

    Do you want the smaller group to join the bigger group? Or generally join player groups together if they're within 10m of each other?

     

    Cheers

     

    Just to join any 2 groups that get close to eachother.

    The first objective is to find all fellow players with a trigger to check all players are grouped before firing the next task, if that makes sense lol

    So i'm not fussed about smaller group joining bigger, but simply having 2 groups regardless of size merge into 1.

     

    1) Player group player

    2) player join player group

    3) group merge group

    4) Final - group with all players in.

     

    Regards


  14. Although players now join a group if they are are ungrouped, i now have the issue of 2 groups getting less than 10m away from each other.

    For the life of me i cant seem to find out how to get 2 groups merged to one.

    Is there a way i can do the same check as above but for groups?

    Anyone in the know care to share their thoughts?

     

    Regards

    Rory


  15. Grumpy Old Man - You are a legend!

    Ive gotten over my blonde moment and got it working lol

    Here is what i have:

     

    _loop = [] spawn {
    		
    	_isInGroup = {
    
    		params ["_unit"];
    		count units group _unit > 1
    
    	};
    
    	MyPlayerAutojoin = true;
    
    	while {MyPlayerAutojoin} do {
    
    		{
    
    			if ( player call _isInGroup AND !(_x call _isInGroup) AND player distance _x <= 10) then {
    
    				[_x] join group player;
    				
    			} else { 
    
    				if ( !(player call _isInGroup) AND !(_x call _isInGroup) AND player distance _x <= 10) then {
    
    				[_x] join group player;
    				
    			}
    
    			} forEach (allPlayers - [player]);
    
    		} forEach (allPlayers - [player]);
    
    		sleep 1;
    
    	};
    
    };

    Tested with 2 un-grouped players, and 1 grouped / 1 un-grouped and all seems to work :)

    Thanks again, this will certainly be used on a lot of my future mission devs :)

     

    thanks and regards

    Rory

    • Like 1

  16. After tinkering with it, i have noticed that the coded checks for 1 player in a group, and 1 thats not....

    It does not check for both not in group.

     

    Ive used an else statement for testing:

     

    		{ if (player call _isInGroup AND !(_x call _isInGroup) AND player distance _x <= 10) then {
    			[_x] join group player;
    		} else { [_x] join player; }
    		} forEach (allPlayers - [player]);

    And this seems to work (ignore the lack of checks), but loops over and over and i i get is "2 JOIN GROUP" over and over lol

    The foundations are good, i'll just need to play around with it :)

     

    Thanks for the help !


  17. Would i need to put this into a while true loop?

    This is my code thus far:

     

    // Center Map Coordinates = [1000,1000]
    // Map size = 2000 x 2000
    // 900 x 900 marker size
    // Chopper Class = (B_Heli_Transport_01_camo_F)
    
    // ** NEED TO GET CLASS NAME FOR RYANS ZOMBIES ANTI VIRUS EQUIPMENT !!
    
    if (!isServer) exitWith {};
    
    // Central marker creation
    //========================
    centerMarker = createMarker ["Spawn", [1000,1000]];
    
    // Chopper spawn into safe position
    //=================================
    chopperSafePos = [getMarkerpos "Spawn", 1, 900, 3, 0, 40, 0] call BIS_fnc_findSafePos;
    chopper = "B_Heli_Transport_01_camo_F" createVehicle (chopperSafePos);
    
    // include arrays
    //===============
    #include "vehicleArray.sqf"
    #include "itemArray.sqf"
    
    // 10 Random vehicles around map
    //==============================
    for '_i' from 1 to 10 do {
    	_randomVehicle = selectRandom _randomVehiclearray;
    	_SafePos = [getMarkerpos "Spawn", 1, 800, 10, 0, 40, 0] call BIS_fnc_findSafePos;
    	_veh = _randomVehicle createVehicle (_SafePos);
    	_veh setDir (RANDOM 360);
    
    	// Remove eveything from the vehicle
    	//==================================
    	clearItemCargoGlobal _veh;
    	clearWeaponCargoGlobal _veh;
    	clearMagazineCargoGlobal _veh;
    
    	// Place 5 random items into the vehicle
    	//======================================
    	for '_i' from 1 to 5 do { _veh addItemCargoGlobal [selectRandom _randomItemsArray, 1]; };
    
    	// A bit of ammo to help them along the poor buggers
    	//==================================================
    	_veh addItemCargoGlobal ["30Rnd_65x39_caseless_mag_Tracer", 10];
    
    	// Damage vehicles and light them up
    	//==================================
    	_veh setFuel 0;
    	_veh setDamage 0.8;
    	player action["lightOn",_veh];
    };
    
    // Make players join group when they are close to eachother
    //=========================================================
    while { true } do {
    	_isInGroup = { params ["_unit"]; count units group _unit > 1 };
    	{ if (player call _isInGroup AND !(_x call _isInGroup) AND player distance _x <= 10) then { [_x] join group player; } } forEach (allPlayers - [player]);
    };
    
    // DEBUG TESTING PURPOSES -----------------
    //waitUntil {getPos chopper select 2 > 15};
    //"end1" call BIS_fnc_endMission;
    //-----------------------------------------

    Regards

    Rory

×