Results 1 to 2 of 2

Thread: Code on Compositions

  1. #1

    Lightbulb Code on Compositions

    Code:
    fSpawnChop = {
    private["_comp","_side","_heli","_nr","_h","_hlist"];
    _comp = _thisselect 0;
    _side = _thisselect 1;
    _h = nearestObjects [_comp, ["HeliH"], 100];
    _nr = random 1;
    if (_nr > 0.25) then {
    switch (_side) do {
    caseEAST: {
    _heli = [["ACE_Mi17_RU", "Mi24_V", "ACE_Mi24_V_FAB250_RU", "Ka52Black"],[12,8,6,2]] call CRB_fnc_selectRandomBias;
    _spawned = _helicreateVehicle (position_h);
    _spawnedsetPos (getPos_h);
    _spawnedsetDir (getDir_h);
    };
    caseWEST: {
    _heli = [["MH60S", "Mi17_CDF", "UH1Y", "ACE_AH1W_AGM_W"],[12,8,6,2]] call CRB_fnc_selectRandomBias;
    _spawned = _helicreateVehicleposition_h;
    _spawnedsetPos (getPos_h);
    _spawnedsetDir (getDir_h);
    };
    };
    };
    
    }; 
    
    Called:
    if (_camp == "heli_park_us1") then {[_pos, WEST] call fSpawnChop;};
    if (_camp == "heli_park_ru1") then {[_pos, EAST] call fSpawnChop;};


    so what im trying to do is detect if the spawned composition is a heli park, and if it is, spawn a random chopper there. Any ideas? Seems to not be working.

    Also, is there a solution to this? If, then statements tend to cause issues I've noticed, is there a more proficient way to check if _x in in which list?

    Example:
    Code:
     
     
    _fac = "GUE";
    if (_camp in _rucamps) then { _fac = "RU"};
    if (_camp in _inscamps) then { _fac = "INS"};
    if (_camp in _usmccamps) then { _fac = "USMC"};
    if (_camp in _cdfcamps) then { _fac = "CDF"};

  2. #2
    Code:
    _fac = switch true do {
      case (_camp in _rucamps): {"RU"};
      case (_camp in _inscamps): {"INS"};
      and so on...
    };

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •