Jump to content

Gacku

Member
  • Content Count

    4
  • Joined

  • Last visited

  • Medals

Posts posted by Gacku


  1. Greetings, I'm one of those people who comes up with incredibly niche ideas without having much experience in scripting, so I was hoping someone here could help me. I have a script that jams the TFAR radio, and ideally  the players' radios would go back to working correctly once the jammer is destroyed. However, I've run into a couple of problems. The first is that the players inside the jammer range can hear radio transmissions from outside of it, which isn't a huge problem so if it can't be fixed then so be it.

    The second problem is that, even though the players' radios go back to working once they are outside the range of the jamming script, they do not go back to working if the jamming entity is destroyed while they are inside of it. You can imagine how this might be an issue. Code posted below, and I greatly appreciate any help that can be given.

     

    YourFunctionName = {
    
    _unitInJammerArea = [];
    
    params ["_jammer"];
    
      while {alive _jammer} do {
    
        _unitInJammerArea = nearEntities [_jammer, ["Man"], 200];
        _allUnits = allPlayers - entities "HeadlessClient_F";
    
        _notInJammerArea = _allUnits - _unitInJammerArea;
    
        if !(count _notInJammerArea isEqualTo 0) then { 
          {
            _x setVariable ["tf_receivingDistanceMultiplicator", 1];
            _x setVariable ["tf_sendingDistanceMultiplicator", 1];
          } foreach _notInJammerArea;
        };
    
        if !(count _unitInJammerArea isEqualTo 0) then { 
          {
            _x setVariable ["tf_receivingDistanceMultiplicator", 0];
            _x setVariable ["tf_sendingDistanceMultiplicator", 0];
          } foreach _unitInJammerArea;
        };
      
      sleep 5;
      };
    
    {
      _x setVariable ["tf_receivingDistanceMultiplicator", 1];
      _x setVariable ["tf_sendingDistanceMultiplicator", 1];
    } foreach _unitInJammerArea;
    
    };

     

×