Jump to content

Robustcolor

Member
  • Content Count

    209
  • Joined

  • Last visited

  • Medals

Community Reputation

16 Good

1 Follower

About Robustcolor

  • Rank
    Staff Sergeant

Recent Profile Visitors

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

  1. How does lineIntersects work? Does it care for fog or smokes? If two units can see each other do i have to use !(LineIntersects) with a ! infront And only (lineIntersects without ! if they can't see eachother, or am i doing something wrong here? if !(lineIntersects [eyePos test1, eyepos test2, test1,test2]) then { hint "Test1 and Test2 see eachother" }; if (lineIntersects [eyePos test1, eyepos test2, test1,test2]) then { hint "Test1 and Test2 don't see eachother" };
  2. Robustcolor

    Selecting all units from an array.

    Thanks @pierremgi, this is how i did now. _groupDistances = []; { _unit = _x; _groupDistances append (allPlayers select {_x distance2d _unit < 150} apply {[_x distanceSqr _unit, _unit, _x]}); _groupDistances sort true; _target = _groupDistances #0#2; _unit doMove _target; } forEach (allUnits select {side _x isEqualTo EAST}); Question, will the code _unit doTarget _target; only execute on those units <150 or closer or will it still execute it on allUnits side EAST in this forEach?
  3. Robustcolor

    Selecting all units from an array.

    @pierremgi Sorry, made the first post abit hasty. _groupDistances = []; { _unit = _x; _groupDistances append (allPlayers select {alive _x} apply {[_x distanceSqr _unit, _unit, _x]}) } count (allUnits select {side _x isEqualTo EAST); _groupDistances sort true; RESULT: _groupDistances = [[136517,O Alpha 1-1:6,Player1],[174721,O Alpha 1-1:5,Player2],[195925,O Alpha 1-2:1,Player3]]; Usually i use _playertarget = _groupDistances #0#2; Gives me in this case the first one, [Player1] Is it possible to select all those units in each [] that are not players and use them in a context of { _x dosomething } count
  4. Hi, this variable below is an array including [positions,units,players] from using apply + sort command and it refreshes with new units,positions and players from time to time. i usually select either the unit or the player by doing _playertarget = _groupDistances #0#2; But the question is, if i would like to select all the units not the players or the positions inside this array, how do i do that? since _playertarget = _groupDistances #0#2 only gives me one object, in this case the player. _groupDistances = [[136517,O Alpha 1-1:6,Player1],[174721,O Alpha 1-1:5,Player2],[195925,O Alpha 1-2:1,Player3]]; I would like to do something like { _x doMove "somehwere"; } count "the units from array";
  5. Thanks, i could try that command. Do you know how to proper use a lineintersect command? Maybe something like this? (allPlayers findIf {lineIntersects [eyePos _x,eyePos (AGLToASL _markerpos) vectorAdd [0,0,1.5]], objectParent _x]});
  6. This code below seems to be almost working, but if two players is inside the radius it keeps locking only one of them even if one is further away. Suggestions? _pos = getMarkerpos "Marker1"; _group = [_pos, EAST, 7 ] call BIS_fnc_spawnGroup; _units = units _enemyGroup; _markerpos = getMarkerpos "Marker1"; private _playerDistances = (allPlayers select {(_x distance2d _markerpos < 800) && {alive _x}}) apply { private _plyr = _x; private _groupDistances = _units apply {[_x distanceSqr _plyr,_x]}; _groupDistances sort true; [_groupDistances#0#1, _x, _groupDistances] }; if !(_playerDistances isEqualTo []) then { _playerDistances sort true; _target = _playerDistances #0#1; { if (_x knowsAbout _target > 0) then { _x doTarget _target; }} count _units; }; I did try something like this below but it only select the last unit in each squad. _pos = getMarkerpos "Marker1"; _group = [_pos, EAST, 7 ] call BIS_fnc_spawnGroup; _units = units _group; { _unit = _x; _nearplyrs = (allPlayers select {(_x distance2d _unit < 800) && {(lifestate _x != "DEAD-RESPAWN")}} apply {[_x distanceSqr _unit, _x]}) } forEach _units; if !(_nearplyrs isEqualTo []) then { _nearplyrs sort true; _target = _nearplyrs #0#1; { if (_x knowsAbout _target > 0) then { _x doTarget _target; } count _units; };
  7. Robustcolor

    NearestTerrainObjects

    Thanks @gc8
  8. Could somebody help on how to spawn something near these bushes using NearestTerrainObjects and not spawning twice on same pos. _allBushes = nearestTerrainObjects [player, [Bush], 250, false]; for "_i" from 1 to 5 do _pos = selectRandom _allBushes _grp = createGroup east; _unit = _grp createUnit ["C_man_p_beggar_F", [0,0,0], [], 0, "FORM"]; _unit setPos _pos; };
  9. Robustcolor

    Call sqf?

    How would you call this with an addAction from an editor placed object in a MP environment?
  10. Robustcolor

    moving marker in server

    This is great. Question, if i do this _mk setMarkerTextLocal name _x; forEach (allPlayers); is this the correct way if i would like to add it on every player when executing this in initPlayerlocal.sqf.
  11. Hm, can't seem to get it to work. _group = [getMarkerpos "respawn_east", EAST, 7 ] call BIS_fnc_spawnGroup; _destination = (getMarkerPos "Marker1"); private ["_group","_destination"]; while {true} do { uiSleep 5; if ((count (waypoints _group)) == 0) then { _group move _destination; }; }; Never executes the code.
  12. Related question, instead of UnitReady, maybe we could count the waypoint/s of the group using the doMove or move command and if waypoints == 0 execute something. if (count (waypoints _group) == 0) then { _group move _destination; or _group doMove _destination; };
  13. What does the extra curly brackets do inside this deleteVehicle _x code? Does Lazy evaluation work outside a if then? (allGroups select {side _x == EAST and {leader _x distance getMarkerpos "_marker"<60}});
  14. Robustcolor

    SelectRandom issue

    Thanks @gc8 and @pierremgi. It works now. What is the reason for isEqualTo not working when using selectRandom inside this variable but isNil does? So i understand it for further scripting 🙂 private _player = selectRandom (allPlayers select {(_x distance2d _markerpos < 450) && (lifestate _x != "Incapacitated")}); if (!(isNil _player)) then { }; and here isEqualTo is working. _players = allPlayers select {(_x distance2d _markerpos < 450) && (lifestate _x != "Incapacitated")}); if !(_players isEqualTo []) then { _player = selectRandom _players; };
×