Jump to content

RoryRothon

Member
  • Content Count

    56
  • Joined

  • Last visited

  • Medals

Community Reputation

8 Neutral

About RoryRothon

  • Rank
    Lance Corporal

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. RoryRothon

    Group ID and Hunt

    This might be of help too. I have compiled an array of groups from cfgGroups that works with sidID for the above function.. RAZ_fnc_infantryConfigs = [ [], [], [] ]; _allConfigGrpSides = ("true" configClasses (configFile >> "CfgGroups") apply {configname _x}); { _cfgGrpSide = _x; _allcfgGrpFactions = ("true" configClasses (configFile >> "CfgGroups" >> _cfgGrpSide) apply {configname _x}); { _cfgGrpFaction = _x; _allcfgGrpCategories = ("true" configClasses (configFile >> "CfgGroups" >> _cfgGrpSide >> _cfgGrpFaction) apply {configname _x}); { _cfgGrpType = _x; _allcfgGrpCategories = ("true" configClasses (configFile >> "CfgGroups" >> _cfgGrpSide >> _cfgGrpFaction >> _cfgGrpType) apply {configname _x}); _eastConfigs = "getNumber( _x >> 'side' ) isEqualTo 0"configClasses( configFile >> "CfgGroups" >> _cfgGrpSide >> _cfgGrpFaction >> _cfgGrpType ); _westConfigs = "getNumber( _x >> 'side' ) isEqualTo 1"configClasses( configFile >> "CfgGroups" >> _cfgGrpSide >> _cfgGrpFaction >> _cfgGrpType ); _indepConfigs = "getNumber( _x >> 'side' ) isEqualTo 2"configClasses( configFile >> "CfgGroups" >> _cfgGrpSide >> _cfgGrpFaction >> _cfgGrpType ); RAZ_fnc_infantryConfigs select 0 append _eastConfigs; RAZ_fnc_infantryConfigs select 1 append _westConfigs; RAZ_fnc_infantryConfigs select 2 append _indepConfigs; } forEach _allcfgGrpCategories; } forEach _allcfgGrpFactions; } forEach _allConfigGrpSides;
  2. RoryRothon

    Group ID and Hunt

    I'm working on something similar. Ive thrown up my initServer.sqf code that you can look at and pull apart if it helps :) RAZ_fnc_spawnHuntingInfantry = { params [ "_unit", [ "_side", EAST ] ]; _sideID = _side call BIS_fnc_sideID; _faction = East; if ( _sideID == 0 ) then { _faction = _faction }; if ( _sideID == 1 ) then { _faction = West }; if ( _sideID == 2 ) then { _faction = Independent }; _pos = getPosATL _unit; _huntingGroups = _unit getVariable [ "RAZ_fnc_isBeingHunted", 0 ]; _huntingGroups = _huntingGroups + 1; _unit setVariable [ "RAZ_fnc_isBeingHunted", _huntingGroups, true ]; _spawnPos = _pos getPos [ 600, random 360 ]; _spawnPos = [ _spawnPos, 1, 1000, 1, 0, 45, 0 ] call BIS_fnc_findSafePos; _grp = [ _spawnPos, _faction, ( selectRandom (RAZ_fnc_infantryConfigs select _sideID) ) ] call BIS_fnc_spawnGroup; { _x setUnitAbility 0.1; _x setskill ["aimingAccuracy",0.01]; _x setskill ["aimingShake",0.9]; _x setskill ["aimingSpeed",0.01]; _x setskill ["Endurance",0.5]; _x setskill ["spotDistance",0.5]; _x setskill ["spotTime",0.5]; _x setskill ["courage",0.1]; _x setskill ["reloadSpeed",0.1]; if (side _x == east) then { _x unassignItem "NVGoggles_OPFOR"; _x removeItem "NVGoggles_OPFOR"; }; if (side _x == Independent) then { _x unassignItem "NVGoggles_INDEP"; _x removeItem "NVGoggles_INDEP"; }; _x removePrimaryWeaponItem "acc_pointer_IR"; _x addPrimaryWeaponItem "acc_flashlight"; _x enableGunLights "forceOn"; } forEach units _grp; { gm addCuratorEditableObjects [ [_x], true ]; } forEach units _grp; _searchWp = [ getPos _unit, random 500, random 360 ] call BIS_fnc_relPos; _wp = _grp addWaypoint [_searchWp, 0]; [_grp, 1] setWaypointType "SAD"; [_grp, 1] setWaypointSpeed "NORMAL"; while { ( { alive _x } count units _grp ) >= 1 } do { _timer = time + 10; if ( alive _unit ) then { _unit = _unit }; if ( !alive _unit ) then { _unit setVariable [ "RAZ_fnc_isBeingHunted", _huntingGroups, false ]; sleep 2; _unit = selectRandom ( allPlayers select { alive _x } ); while { ( count ( waypoints _grp ) ) > 0 } do { deleteWaypoint ( ( waypoints _grp ) select 0 ); }; _searchWp = [ getPos _unit, random 600, random 360 ] call BIS_fnc_relPos; _wp = _grp addWaypoint [ _searchWp, 0 ]; [ _grp, 1 ] setWaypointType "SAD"; [ _grp, 1 ] setWaypointType "NORMAL"; }; waitUntil { sleep 120; position _unit distance _spawnpos > 30 OR time > _timer OR ({alive _x} count units _grp) isEqualTo 0 }; deleteWaypoint [_grp, 1]; _searchWp = [ getPos _unit, random 300, random 360 ] call BIS_fnc_relPos; _wp = _grp addWaypoint [_searchWp, 1]; [_grp, 1] setWaypointType "SAD"; [_grp, 1] setWaypointSpeed "NORMAL"; }; sleep 1; _huntingGroups = _unit getVariable ["RAZ_fnc_isBeingHunted",0]; _huntingGroups = _huntingGroups - 1; _unit setVariable ["RAZ_fnc_isBeingHunted",_huntingGroups,true]; }; _spawningEnemies = [] spawn { _players = []; _spawnHunters = true; format [ "Operation Missdrop By [BZ] Pte R.Rothon" ] remoteExec ["systemChat"]; format [ "System Initialized" ] remoteExec ["systemChat"]; waitUntil {time > 0}; while { _spawnHunters } do { waitUntil { sleep 3; (count (allplayers - switchableUnits) > 0) }; _players = (allplayers - switchableUnits) select {(_x getVariable ["RAZ_fnc_isBeingHunted",0]) isEqualTo 0}; _players apply { _hunt = [_x,East] spawn RAZ_fnc_spawnHuntingInfantry; _hunt = [_x,Independent] spawn RAZ_fnc_spawnHuntingInfantry; }; }; }; // END GAME SCRIPTING ------------------------------------------------------------------------------------------------ _endGameTimer = 600; waitUntil { time > _endGameTimer && count (allPlayers select {group _x isEqualTo group (allPlayers select 0)}) isEqualTo count allPlayers; }; format ["All soldiers found. Receiving intel on extraction point, ETA 10 mins!"] remoteExec ["hint"]; sleep 600; // SPAWN EXTRACTION CHOPPER
  3. Hi. I currently have a variable check and assign for all players on the dedi, example below: _huntingGroups = _unit getVariable [ "RAZ_fnc_isBeingHunted", 0 ]; _huntingGroups = _huntingGroups + 1; _unit setVariable [ "RAZ_fnc_isBeingHunted", _huntingGroups, true ]; _players = (allplayers - switchableUnits) select {(_x getVariable ["RAZ_fnc_isBeingHunted",0]) isEqualTo 0}; _players apply { _hunt = [_x,east] spawn RAZ_fnc_spawnHuntingInfantry; _hunt = [_x,independent] spawn RAZ_fnc_spawnHuntingInfantry; }; Would it be possible to select only half of the current players? And a maximum number of players is the count is odd? cheers :)
  4. All fixed! Still some little tweaks to make though. My script spawns (per player) 1 chopper, 1 vehicle and 2 fire teams to hunt down the player whilst also fighting eachother. Thanks for your help! Just need to ties it all together now with my loot and end game scripts :) #include "scripts\hunting\huntingArrays.sqf"; mapCenter = [ worldSize / 2, worldSize / 2, 0 ]; RAZ_fnc_spawnHuntingInfantry = { params [ "_unit", [ "_side", EAST ] ]; _sideID = _side call BIS_fnc_sideID; _faction = East; if ( _sideID == 0 ) then { _faction = _faction }; if ( _sideID == 1 ) then { _faction = West }; if ( _sideID == 2 ) then { _faction = Independent }; _pos = getPosATL _unit; _huntingGroups = _unit getVariable [ "RAZ_fnc_isBeingHunted", 0 ]; _huntingGroups = _huntingGroups + 1; _unit setVariable [ "RAZ_fnc_isBeingHunted", _huntingGroups, true ]; _spawnPos = _pos getPos [ 600, random 360 ]; _spawnPos = [ _spawnPos, 1, 10, 1, 0, 45, 0 ] call BIS_fnc_findSafePos; _grp = [ _spawnPos, _faction, ( selectRandom (RAZ_fnc_infantryConfigs select _sideID) ) ] call BIS_fnc_spawnGroup; { _x setUnitAbility 0.1; _x setskill ["aimingAccuracy",0.05]; _x setskill ["aimingShake",0.9]; _x setskill ["aimingSpeed",0.1]; _x setskill ["Endurance",0.1]; _x setskill ["spotDistance",0.5]; _x setskill ["spotTime",0.5]; _x setskill ["courage",0.1]; _x setskill ["reloadSpeed",0.1]; } forEach units _grp; { gm addCuratorEditableObjects [ [_x], true ]; } forEach units _grp; _searchWp = [ getPos _unit, random 500, random 360 ] call BIS_fnc_relPos; _wp = _grp addWaypoint [_searchWp, 0]; [_grp, 1] setWaypointType "SAD"; [_grp, 1] setWaypointSpeed "NORMAL"; _grp setFormation "LINE"; while { ( { alive _x } count units _grp ) >= 1 } do { _timer = time + 10; if ( alive _unit ) then { _unit = _unit }; if ( !alive _unit ) then { _unit setVariable [ "RAZ_fnc_isBeingHunted", _huntingGroups, false ]; sleep 2; _unit = selectRandom ( allPlayers select { alive _x } ); while { ( count ( waypoints _grp ) ) > 0 } do { deleteWaypoint ( ( waypoints _grp ) select 0 ); }; _searchWp = [ getPos _unit, random 500, random 360 ] call BIS_fnc_relPos; _wp = _grp addWaypoint [ _searchWp, 0 ]; [ _grp, 1 ] setWaypointType "SAD"; [ _grp, 1 ] setWaypointType "NORMAL"; _grp setFormation "LINE"; }; waitUntil { sleep 120; position _unit distance _spawnpos > 30 OR time > _timer OR ({alive _x} count units _grp) isEqualTo 0 }; deleteWaypoint [_grp, 1]; _searchWp = [ getPos _unit, random 300, random 360 ] call BIS_fnc_relPos; _wp = _grp addWaypoint [_searchWp, 1]; [_grp, 1] setWaypointType "SAD"; [_grp, 1] setWaypointSpeed "NORMAL"; _grp setFormation "LINE"; }; sleep 1; _huntingGroups = _unit getVariable ["RAZ_fnc_isBeingHunted",0]; _huntingGroups = _huntingGroups - 1; _unit setVariable ["RAZ_fnc_isBeingHunted",_huntingGroups,true]; }; RAZ_fnc_spawnHuntingVehicle = { params ["_unit"]; _huntingVehicles = _unit getVariable [ "RAZ_fnc_isBeingHuntedByVehicle", 0 ]; _huntingVehicles = _huntingVehicles + 1; _unit setVariable [ "RAZ_fnc_isBeingHuntedByVehicle", _huntingVehicles, true ]; _randomSide = selectRandom[0,2]; _faction = east; if ( _randomSide == 0 ) then { _faction = east } else { _faction = independent }; _pos = getPosATL _unit; _spawnPos = _pos getPos [ 1500, random 360 ]; _spawnPos = [ _spawnPos, 1, 50, 1, 0, 35, 0 ] call BIS_fnc_findSafePos; _patrolVehicle = [ _spawnPos, 180, ( selectRandom (RAZ_fnc_vehicleConfigs select _randomSide) ), _faction ] call bis_fnc_spawnvehicle; _veh = _patrolVehicle select 0; _crew = _patrolVehicle select 2; { gm addCuratorEditableObjects [ [_x], true ]; } forEach units _crew; gm addCuratorEditableObjects [ [ _veh ], true ]; while { ( { alive _x } count units _crew ) >= 1 AND alive _veh } do { if ( !alive _unit ) then { _unit setVariable [ "RAZ_fnc_isBeingHuntedByVehicle", _huntingVehicles, false ]; _unit = selectRandom ( allPlayers select { alive _x } ); while { ( count ( waypoints _grp ) ) > 0 } do { deleteWaypoint ( ( waypoints _grp ) select 0 ); }; _searchWp = [ getPos _unit, random 1000, random 360 ] call BIS_fnc_relPos; _wp = _grp addWaypoint [ _searchWp, 0 ]; [ _grp, 1 ] setWaypointType "SAD"; [ _grp, 1 ] setWaypointType "NORMAL"; }; waitUntil { (count (allplayers - switchableUnits) > 0) }; _unit = selectRandom ( allPlayers select { alive _x } ); _timer = time + 180; while { ( count ( waypoints _crew ) ) > 0 } do { deleteWaypoint ( ( waypoints _crew ) select 0 ); }; _searchWp = [ getPos _unit, random 1000, random 360 ] call BIS_fnc_relPos; _wp = _crew addWaypoint [_searchWp, 0]; [_crew, 0] setWaypointType "SAD"; [_crew, 0] setWaypointSpeed "NORMAL"; waituntil { time > _timer }; }; waitUntil { ( { alive _x } count units _crew ) isEqualTo 0 OR !alive _veh }; while { ( count ( waypoints _crew ) ) > 0 } do { deleteWaypoint ( ( waypoints _crew ) select 0 ); }; sleep 300; _huntingVehicles = _unit getVariable ["RAZ_fnc_isBeingHuntedByVehicle",0]; _huntingVehicles = _huntingVehicles - 1; _unit setVariable ["RAZ_fnc_isBeingHuntedByVehicle",_huntingVehicles,true]; }; RAZ_fnc_spawnHuntingAir = { params ["_unit"]; waitUntil { time > 60 }; _huntingAir = _unit getVariable [ "RAZ_fnc_isBeingHuntedByAir", 0 ]; _huntingAir = _huntingAir + 1; _unit setVariable [ "RAZ_fnc_isBeingHuntedByAir", _huntingAir, true ]; _randomSide = selectRandom[0,2]; _faction = east; if ( _randomSide == 0 ) then { _faction = east } else { _faction = independent }; _spawnPos = mapCenter getPos [ random worldSize / 2, random 360 ]; _spawnPos = [ _spawnPos, 1, random worldSize / 2, 10, 0, 35, 0 ] call BIS_fnc_findSafePos; _patrolVehicle = [ _spawnPos, 180, ( selectRandom (RAZ_fnc_airVehicleConfigs select _randomSide) ), _faction ] call bis_fnc_spawnvehicle; _veh = _patrolVehicle select 0; _crew = _patrolVehicle select 2; _searchLight = [_veh] execVM "AL_searchlight\al_search_light_ini.sqf"; { gm addCuratorEditableObjects [ [_x], true ]; } forEach units _crew; gm addCuratorEditableObjects [ [ _veh ], true ]; while { ( { alive _x } count units _crew ) >= 1 AND alive _veh } do { if ( !alive _unit ) then { _unit setVariable [ "RAZ_fnc_isBeingHuntedByAir", _huntingAir, false ]; _unit = selectRandom ( allPlayers select { alive _x } ); while { ( count ( waypoints _grp ) ) > 0 } do { deleteWaypoint ( ( waypoints _grp ) select 0 ); }; _searchWp = [ getPos _unit, random 1000, random 360 ] call BIS_fnc_relPos; _wp = _grp addWaypoint [ _searchWp, 0 ]; [ _grp, 1 ] setWaypointType "SAD"; [ _grp, 1 ] setWaypointType "NORMAL"; }; waitUntil { (count (allplayers - switchableUnits) > 0) }; _unit = selectRandom ( allPlayers select { alive _x } ); _timer = time + 60; while { ( count ( waypoints _crew ) ) > 0 } do { deleteWaypoint ( ( waypoints _crew ) select 0 ); }; _searchWp = [ getPos _unit, random 1000, random 360 ] call BIS_fnc_relPos; _wp = _crew addWaypoint [_searchWp, 0]; [_crew, 0] setWaypointType "SAD"; [_crew, 0] setWaypointSpeed "NORMAL"; waituntil { time > _timer }; }; waitUntil { ( { alive _x } count units _crew ) isEqualTo 0 OR !alive _veh }; while { ( count ( waypoints _crew ) ) > 0 } do { deleteWaypoint ( ( waypoints _crew ) select 0 ); }; sleep 300; _huntingAir = _unit getVariable ["RAZ_fnc_isBeingHuntedByAir",0]; _huntingAir = _huntingAir - 1; _unit setVariable ["RAZ_fnc_isBeingHuntedByAir",_huntingAir,true]; }; _spawningEnemies = [] spawn { _players = []; _vehiclePlayers = []; _spawnHunters = true; if ( debugScript ) then { format [ "Operation Missdrop System Initialized" ] remoteExec ["systemChat"]; }; waitUntil {time > 0}; while { _spawnHunters } do { waitUntil { sleep 3; (count (allplayers - switchableUnits) > 0) }; _players = (allplayers - switchableUnits) select {(_x getVariable ["RAZ_fnc_isBeingHunted",0]) isEqualTo 0}; _vehiclePlayers = (allplayers - switchableUnits) select {(_x getVariable ["RAZ_fnc_isBeingHuntedByVehicle",0]) isEqualTo 0}; _airPlayers = (allplayers - switchableUnits) select {(_x getVariable ["RAZ_fnc_isBeingHuntedByAir",0]) isEqualTo 0}; _players apply { _hunt = [_x,east] spawn RAZ_fnc_spawnHuntingInfantry; _hunt = [_x,independent] spawn RAZ_fnc_spawnHuntingInfantry; }; _vehiclePlayers apply { _hunt = [_x] spawn RAZ_fnc_spawnHuntingVehicle; }; _vehiclePlayers apply { _hunt = [_x] spawn RAZ_fnc_spawnHuntingAir; }; }; }; ///////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////// // END GAME SCRIPTING --------------------------------------------------------------- ///////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////// _endGameTimer = 600; waitUntil { time > _endGameTimer && count (allPlayers select {group _x isEqualTo group (allPlayers select 0)}) isEqualTo count allPlayers; }; format ["All soldiers found. Receiving intel on extraction point, ETA 10 mins!"] remoteExec ["hint"]; sleep 600;
  5. *Untested... 0 = [ "<t color='#FF0000'>AmmoboxInit</t>", [ this, true ] ] spawn BIS_fnc_arsenal;
  6. Hi, i am trying to get this working but keep getting a undefined variable error for _crew. Below is the function i am creating, i wonder if someone would be kind enough to point out something i may have overlooked? Error line has been marked at ( waitUntil ) Kind regards Rory RAZ_fnc_spawnHuntingVehicle = { waitUntil { time > 0 }; params [ "_unit" ]; _pos = getPosATL _unit; _huntingVehicles = _unit getVariable [ "RAZ_fnc_isBeingHuntedByVehicle", 0 ]; _huntingVehicles = _huntingVehicles + 1; _unit setVariable [ "RAZ_fnc_isBeingHuntedByVehicle", _huntingVehicles, true ]; _spawnPos = _pos getPos [ 3000, random 360 ]; _spawnPos = [ _spawnPos, 1, 50, 1, 0, 35, 0 ] call BIS_fnc_findSafePos; _randomArray = selectRandom[0,2]; if ( _randomArray == 0 ) then { _faction = east } else { _faction = independent }; _patrolVehicle = [ _spawnPos, 180, ( selectRandom (RAZ_fnc_vehicleConfigs select _randomArray) ), _faction ] call Bis_fnc_spawnvehicle; _veh = _patrolVehicle select 0; _crew = _patrolVehicle select 2; { gm addCuratorEditableObjects [ [_x], true ]; } forEach units _crew; gm addCuratorEditableObjects [ [ _veh ], true ]; { _x setSkill 0.25; } forEach units _crew; while { ( { alive _x } count units _crew ) >= 1 AND alive _veh } do { if ( !alive _unit ) then { _unit setVariable [ "RAZ_fnc_isBeingHuntedByVehicle", _huntingVehicles, false ]; _unit = selectRandom ( allPlayers select { alive _x } ); }; _searchWp = [ getPos _unit, random 1000, random 360 ] call BIS_fnc_relPos; _wp = _crew addWaypoint [_searchWp, 0]; [_crew, 1] setWaypointType "SAD"; [_crew, 1] setWaypointSpeed "NORMAL"; _timer = time + 60; waitUntil { time > _timer OR ({alive _x} count units _crew) isEqualTo 0 OR !alive _veh }; deleteWaypoint [_crew, 1]; }; waitUntil { ( { alive _x } count units _crew ) isEqualTo 0 OR !alive _veh }; <<<<<< ERROR! _huntingVehicles = _unit getVariable ["RAZ_fnc_isBeingHuntedByVehicle",0]; _huntingVehicles = _huntingVehicles - 1; _unit setVariable ["RAZ_fnc_isBeingHuntedByVehicle",_huntingVehicles,true]; _waitTime = time + 10; waitUntil { time > _waitTime }; }; _spawningEnemies = [] spawn { _players = []; _vehiclePlayers = []; _spawnHunters = true; waitUntil {time > 0}; while { _spawnHunters } do { waitUntil { sleep 3; (count (allplayers - switchableUnits) > 0) }; _players = (allplayers - switchableUnits) select {(_x getVariable ["RAZ_fnc_isBeingHunted",0]) isEqualTo 0}; _vehiclePlayers = (allplayers - switchableUnits) select {(_x getVariable ["RAZ_fnc_isBeingHuntedByVehicle",0]) isEqualTo 0}; _players apply { _hunt = [_x,east] spawn RAZ_fnc_spawnHuntingInfantry; _hunt = [_x,independent] spawn RAZ_fnc_spawnHuntingInfantry; }; _vehiclePlayers apply { _hunt = [_x] spawn RAZ_fnc_spawnHuntingVehicle; }; }; };
  7. RoryRothon

    Random Loot Script

    I figured as much. I currently have initPlayerLocal running the building checks locally and once returned true then fire remoteExec to server for all clients. Im still learning sqf but getting better as the days roll by. Thanks for you help :)
  8. RoryRothon

    Random Loot Script

    Coming back to this script after working on something else. I would like to set this up for multiplayer... This code will be run on the dedi server and i was just wondering if Player is referenced on dedi? I have a feeling it is not. Would it be advisable to wrap this up with: _players = allPlayers - switchableUnits; { // Loot code }forEach _players; Kind regards Rory
  9. RoryRothon

    Get objectID of players Map (MP)

    Just to expand a little: Scenario: Player 1 marks their map Markers are saved to that map only. User then places map on the ground and player 2 picks map up. Player 2 now sees the markers saved to player one's map. Player 1 picks up player two's map and only see'e markers created by player two. Rather than saving markers locally, we would like to be able to save markers to individual maps. You can only see markers created by another player by picking up their map....
  10. Is it at all possible to get the objectID of a players map from their inventory? We are wanting to save array of markers to the map object so that each map has a different set of markers that are user created. Any help or a point in the right direction would be greatly appreciated... Kind regards Rory
  11. Let me explain it simply. I would like to pause my code until either: _veh is destroyed or immobilised OR the crew of _veh have left the vehicle OR crew of _veh are dead. Using waitUntil Does that explain it a bit better? Kind regards Rory
  12. Sorry for being a pain, but how would one call the function within my vehicle spawn / hunt script? _spawnEastGroundVehicle = [] spawn { waitUntil { time > 10 }; while { spawnVehiclePatrols } do { _spawnPos = mapCenter getPos [ random worldSize / 2, random 360 ]; _spawnPos = [ _spawnPos, 1, random worldSize / 2, 10, 0, 35, 0 ] call BIS_fnc_findSafePos; _eastPatrolVehicle = [ _spawnPos, 180, (selectRandom (RAZ_fnc_groundPatrolVehiclesEast)), East ] call bis_fnc_spawnvehicle; _veh = _eastPatrolVehicle select 0; _crew = _eastPatrolVehicle select 2; _veh setPilotLight true; { gm addCuratorEditableObjects [ [_x], true ]; } forEach units _crew; gm addCuratorEditableObjects [ [ _veh ], true ]; while { alive _veh } do { sleep 2; waitUntil { (count (allplayers - switchableUnits) > 0) }; _unit = selectRandom ( allPlayers select { alive _x } ); if ( alive _unit ) then { _unit = _unit; sleep 2; }; if ( !alive _unit ) then { sleep 2; waitUntil { (count (allplayers - switchableUnits) > 0) }; _unit = selectRandom ( allPlayers select { alive _x } ); }; deleteWaypoint [ _crew, 0 ]; _wp = _crew addWaypoint [ position _unit, 0 ]; if ( debugScript ) then { format ["East vehicle has switched target to %1", name _unit] remoteExec ["systemChat"]; }; [_crew, 0] setWaypointType "SAD"; [_crew, 0] setWaypointSpeed "NORMAL"; sleep 10; }; waitUntil { !alive _veh }; if ( debugScript ) then { format ["East vehicle has been destroyed, or all crew members are dead!"] remoteExec ["systemChat"]; }; deleteWaypoint [_crew, 0]; { deleteVehicle _x } forEach units _crew; deleteGroup _crew; sleep 300; }; }; And one would assume i can use the function on various instances of the above script? Kind regards Rory
  13. lol Grumpy i swear your stalking me! The BIS forums should knight you! Thanks again buddy, i shall give it a whirl!
  14. Just to point out, my commented code was used without the waitUntil above it.....
  15. Hey there. I am working on a custom coded mission called "Operation Missdrop" where players have jumped out of a struck airframe and are scattered across the map. All the while, players have East and Guer hunting them down which includes vehicles... Although i have everything working great, i have hit an issue regarding vehicles and crews.. _eastPatrolVehicle = [ _spawnPos, 180, (selectRandom (RAZ_fnc_groundPatrolVehiclesEast)), East ] call bis_fnc_spawnvehicle; _veh = _eastPatrolVehicle select 0; _crew = _eastPatrolVehicle select 2; Currently i have a waituntil holding the script until the _veh is destroyed. I want to create a check that checks if the vehicle is destroyed or all crew members are dead... You can see my attempted commented below haha waitUntil { !alive _veh }; //waitUntil { ({!alive _x;} forEach crew _veh;) or (!alive _veh) }; if ( debugScript ) then { format ["East vehicle has been destroyed, or all crew members are dead!"] remoteExec ["systemChat"]; }; deleteWaypoint [_crew, 0]; { deleteVehicle _x } forEach units _crew; deleteGroup _crew; sleep 300; So to clarify: Check to see if either the vehicle is destroyed or all crew are dead if all crew are dead, do nothing to the vehicle and leave it on the map If vehicle empty but crew are alive, do nothing and wait until the crew or vehicle are dead I hope this makes sense lol Kind regards Rory
×