Jump to content


  • Content Count

  • Joined

  • Last visited

  • Medals

Community Reputation

23 Excellent


About jakkob4682

  • Rank
    Staff Sergeant

Recent Profile Visitors

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

  1. i want to count how many times a function has been fired using a global variable, then when that condition is met I need to call another function. Do I need to set a variable to true when the count is equal to the set amount or can I use waitUntil{myVariable = _myVariable}? myVariable = 0; while{true} do { if(_params call my_fnc)then { myVariable = myVariable + 1; }; waitUntil{myVariable == 3}; _params call new_fnc; }; true is that how I should I write it?
  2. never seen hash marks used with the _x variable. What does that do? Nevermind, after looking it up I see. Just a lot of new scripting commands that I'm becoming aware of. Thanks Pierre
  3. So this is what I'm using right now and it seems to be working fine. @pierrmgi Its because if I am trying to be less redundant so I don 't have to type the params for the spawnGroup function repeatedly. Again, thanks for the advice/tips
  4. I'm just spawning them in the BI function so, private _grp = createGroup [east, true]; //spawn units etc. private _grp = _params call BIS_fnc_spawnGroup? could I use missionNameSpace as well? I'm trying to figure how I'd reference each group separately since one is going to be defending and one is patrolling I can't call the defend/patrol functions inside the same loop can I?
  5. So I'll share what I have so far. Be brutally honest with me if there's something I'm not doing/should(n't) be doing. It's incomplete currently. What I'm trying to do is create a defensive group and patrol group for each position in an array. The groups are going to be spawned in the same function. The patrol group is going to be a qrf group. So the question is how do I create unique group names inside a for-from loop. As always thanks for any advice/tips/criticism. Code is in the spoiler. It's incomplete atm.
  6. params ["_center"]; _towns = nearestLocations [getPos _center,["nameCity","nameVillage","nameLocal"],10000]; _markerArray = []; _buildingArray = []; _grp = grpNull; _randomTown = { params ["_list"]; _idx = selectRandom _list; _pos = locationPosition _idx; _mrk = createMarker [text _idx,_pos]; _mrk setMarkerShape "Ellipse"; _mrk setMarkerSize size _idx; _mrk setMarkerColor "ColorRed"; _mrk }; _randomBuilding = { params ["_pos"]; _buildings = nearestObjects [_pos,["House","Building"],300]; _building = selectRandom _buildings; _buildingPos = getPosASL _building; _mrk = createMarker [str(_buildingPos),_buildingPos]; _mrk setMarkerShape "Ellipse"; _mrk setMarkerSize [10,10]; _mrk setMarkerColor "ColorBlue"; _buildingPos }; RydHQ_obj1 = [_towns] call _randomTown; RydHQ_Obj2 = [_towns] call _randomTown; RydHQ_Obj3 = [_towns] call _randomTown; RydHQ_Obj4 = [_towns] call _randomTown; {_markerArray pushBack _x}forEach [RydHQ_Obj2,RydHQ_Obj3,RydHQ_Obj4,RydHQ_obj1]; for "_i" from 1 to 5 do { { _buildingPos = [getMarkerPos _x] call _randomBuilding; _buildingArray pushBack _buildingPos; }forEach [RydHQ_Obj2,RydHQ_Obj3,RydHQ_Obj4,RydHQ_obj1]; }; {_grp = [_x,east,(configfile >> "CfgGroups" >> "East" >> "CUP_O_RU" >> "Infantry_Ratnik_Winter" >> "InfSentry")] call BIS_fnc_spawnGroup}forEach _buildingArray; {[_grp,_x,300,5,[],true] call lambs_wp_fnc_taskPatrol}forEach _buildingArray; true groups spawn as planned but can't figure out how to get the patrol function to fire for each group
  7. So I have a function that creates a trigger dynamically, whats the best way to pass a local variable to the trigger? params ["_pos"]; _a = createTriggger ["EmptyDetector",_pos]; //settTriggerArea, activation, etc _buildings = nearestObjects [_pos,["House","Building"],350]; _building = _buildings select (count _buildings - 1); _bPos = getPosASL _builidng; how do I pass _bPos to a function within the triggerStatements?
  8. should I do this in the load waypoint or in a separate line?
  9. waitUntil{{_x in _veh} count units _grp == count units _grp}; _lz = (getPos player) findEmptyPosition [10,50,(typeOf _veh)]; hint format ["%1",str _lz]; _pad = "Land_HelipadEmpty_F" createVehicle _lz; _wp = _vGrp addWaypoint [_lz,50,1]; _wp setWaypointType "MOVE"; _wp setWaypointStatements ["true",""]; waitUntil{_veh distance _lz < 200}; {_x action ["eject",_veh]}forEach units _grp; {unassignVehicle _x}forEach units _grp; {[_x] orderGetIn false}forEach units _grp; _veh land "LAND"; this is working now, I abandoned the waypoint system
  10. No error in the .rpt but the waypoints aren't working for the infantry group thats spawned. If I go about it using assignAsCargo and orderGetIn it works fine but then I have an issue with the group not ejecting out of the vehicle. params ["_center","_radius"]; _LZArea = nearestLocations [_center,["FlatArea"],_radius]; _LZ_Zone = _LZArea select 0; _LZ_Pos = locationPosition _LZ_Zone; _LZ_Site = [_LZ_Pos,sideEmpty,(configfile >> "CfgGroups" >> "Empty" >> "Military" >> "HeliportsSmall" >> "SquareLZ")] call BIS_fnc_spawnGroup; _veh = "CUP_B_CH53E_USMC" createVehicle _LZ_Pos; createVehicleCrew _veh; _infGroups = [west,"CUP_B_USMC","Infantry_DES",[2,8]] call f_randomGrp; _infType = selectRandom _infGroups; _pos = (getPos _veh) findEmptyPosition [25,50,(typeof _veh)]; _grp = [_pos,west,(configFile>>"CfgGroups">>"WEST">>"CUP_B_USMC">>"Infantry_DES">>_infType)] call BIS_fnc_spawnGroup; _hWP = (group _veh) addWaypoint [getPos _veh,1,0]; _hWP setWaypointType "LOAD"; _hWp setWaypointStatements ["true",""]; _cargoWP = _grp addWaypoint [getPos _veh,10,0]; _cargoWP setWaypointType "GETIN"; _cargoWP setWaypointStatements ["true",""]; [(group _veh),0] synchronizeWaypoint [[_grp,0]]; [_veh,_grp] next function _qrf = [getPos player,3000] call f_spawnHeli; _veh = _qrf select 0; _grp = _qrf select 1; waitUntil{{_x in _veh} count units _grp == count units _grp}; _lz = (getPos player) findEmptyPosition [25,75,(typeOf _veh)]; _pad = "Land_HelipadEmpty_F" createVehicle _lz; _wp2 = (group _veh) addWaypoint [getPos _pad,25,1]; _wp2 setWaypointType "TR UNLOAD"; _wp2 setWaypointStatements ["true",""]; _wp1 = _grp addWaypoint [getPos _pad,10,1]; _wp1 setWaypointType "GETOUT"; _wp1 setWaypointStatements ["true",""]; [(group _veh),1] synchronizeWaypoint [[_grp,1]]; true again if I don't use the waypoint system and use assignAsCargo and orderGetIn and then use action "eject" in this function they don't eject
  11. jakkob4682

    Waypoint Question

    I want to be able to use the waypoint to find any enemies within the waypoint radius sort them by type and prioritize them by most dangerous/importance. i.e. attack heli moves to position when they reach the area it creates a list of enemy units within the waypoint radius sorted by order of danger/importance and targets them by priority.' i know theres probably already a function/script for this but I'm trying to create my own and want to understand how it's done.
  12. do waypoints operate in the same manner as triggers using list? i.e. can I use count thisList with a waypoint? Or do I need use a separate function to get enemy units within the waypoint radius?
  13. I have a three parent folders that contain a handful of functions, what's considered best practices for initializing each category of functions? i.e. I have an ambient functions folder that contains a few functions, I have a support folder with a few functions, and I have another folder that has misc functions. How do I go about initializing these? Should I put them all in one primary folder and then preprocess them from them that way? or preprocess separately?
  14. jakkob4682

    dynamic waypoints

    _f_randomLoc = { params ["_startingPos","_filter","_range"]; _array = nearestLocations [_startingPos,_filter,_range]; _randomLoc = selectRandom _array; _pos = locationPosition _randomLoc; _pos }; _a1 = []; _a2 = []; _a3 = []; _rPos1 = [getPos player,["nameVillage"],3000] call _f_randomLoc; _rPos2 = [_rPos1,["nameVillage"],1500] call _f_randomLoc; _rPos3 = [_rPos2,["nameVillage"],1500] call _f_randomLoc; {_a1 pushBack _x}forEach [_rPos1,_rPos2,_rPos3]; _hill1 = [_rPos3,["Hill"],3000] call _f_randomLoc; _hill2 = [_hill1,["Hill"],3000] call _f_randomLoc; {_a2 pushBack _x}forEach [_hill1,_hill2]; _Sp1 = [_hill2,["Hill"],3000] call _f_randomLoc; _Sp2 = [_Sp1,["Hill"],3000] call _f_randomLoc; {_a3 pushBack _x}forEach [_Sp1,_Sp2]; {_subset1 pushBack _x}forEach [_a1,_a2,_a3]; _checkpoints = []; _f_getCP = { params ["_pos","_range"]; _roads = _pos nearRoads 750; _road = selectRandom _roads; _cp = getPosASL _road; _cp }; _cp1 = [_rPos1,750] call _f_getCP; _cp2 = [_rPos2,750] call _f_getCP; _cp3 = [_rPos3,750] call _f_getCP; {_checkpoints pushBack _x}forEach [_cp1,_cp2,_cp3]; _f_addWP = { params ["_grp","_dest"]; _waypoints = waypoints _grp; _count = count _waypoints; _addWP = (_count + 1); _wp = _grp addWaypoint [_dest,250,_addWP]; _wp setWaypointCombatMode "YELLOW"; _wp setWaypointSpeed "Limited"; _wp setWaypointBehaviour "SAFE"; _wp setWaypointType "SAD"; _wp setWaypointTimeout [15,30,45]; _wp setWaypointStatements ["true",""]; _wp }; _patrolPos1 = selectRandom _a1; _patrolPos2 = selectRandom _a2; _patrolPos3 = selectRandom _a3; _patrolPos4 = selectRandom _checkpoints; _wpPool = [_patrolPos1,_patrolPos2,_patrolPos3,_patrolPos4]; _nGrp = [(selectRandom _wpPool),west,(configFile>>"CfgGroups">>"WEST">>"rhs_faction_usmc_d">>"Infantry">>_nInfType)] call BIS_fnc_spawnGroup; for "_i" from 1 to (count _wpPool) do { _wp = [_nGrp,(selectRandom _wpPool)] call _f_addWP; }; ??
  15. how would I add random waypoints from an array of positions so each one is random? Do I need to create each one separately or can I just use a for from loop?