Jump to content

Floof

Member
  • Content Count

    23
  • Joined

  • Last visited

  • Medals

Posts posted by Floof


  1. Depends on what you want, if you just want random locations you can use BIS_fnc_randomPos. If i would make this i'd probably make a list of cities/towns and select one randomly, then select a random road to spawn a pick-up point on. Then you can filter different cities based on distance so you can't drive 100m and finish the mission quick. Also if you want to go with the random approach, select a location with randomPos and use getPos to set the drop-off point, this way you can set the min distance between the spawn/drop points.


  2. Sorry for taking a long time to respond. To answer your question i think we should use a global variable for incoming targets. However i have no idea how to seperate them. Say we have 3 C-RAMs in a triangle. How do they know which target to engage? You could store xyz positions of projectiles, but i think this would be slow. My idea was originally to scan for projectiles within range (say theres 5 crams in 1km, they all use the same central point for scanning). This would make the system more realistic by using a central point, a virtual "radar" (even though we have way higher transfer-speeds IRL), this would be great for MILSIMs due to seperate human operated groups, wouldn't work for AI as well. In my opinion it would be great to have radar groups to detect incoming missiles, almost like it works IRL (even tho irl they're more automated (and boring)). If you have other ideas let me know, and since you're clearly interested in this script idea feel free to add me on steam.

    • Like 1

  3. Don't think there's a way other than making an addon and increasing its range. You could fake it by creating a mortar and firing it, wait a while based on distance and see the round come down. I still don't know if you would hear the mortar fire at extreme ranges, might be worth a shot. You could customize the virtual module to fake a launch at range, i still don't think you'd be able to see/hear it tho. So faking is the only way i see, unless you're willing to make an addon.

    • Like 1

  4. Didn't really work on this for a while, came up with a new version that works for now. I think this is how it should've looked like from the start, works better too. Last version was a bunch of ideas mashed into one script that barely worked. I have some free time now so i guess it would be a good idea to just finish this project. Also works with Zeus now, i'll try to get some ideas on how to improve performance with many C-RAMs in one area, maybe add some targeting system so all of them don't shoot at a single target. We'll see. And @kirumy half of the script didn't make sense anyways, better to rewrite it. Chance variable was supposed to be a ~0.001% chance to miss the target, wasn't implemented. Createvehicle for targeting was a bad idea from the start, i still have no idea how to get zeroing to work, suggestions welcome.

    • Like 4

  5. nObj = nearestObjects[casPos, ["sarheli0","sarheli1","sarheli"]];
    
    casSpawn assignAsCargo nObj select 0;
    
    [casSpawn] orderGetIn true;

    In the future remember that nearestObject returns a single type, doesn't support arrays. nearestObjects returns an array so use that, should work. wiki.

    Also for future reference its recommended to add a radius to nObj's nearestObjects, so that the engine doesn't have to scan a 15km and lag everyone for no reason if the vehicles are far away.

    • Like 1

  6. Was away for a while but FSG_PRAET_OFFSET is used as a detection cone basically, if you fire towards the praetorian and the missile is going towards the praet in a 50 degree radius it will be shot down. This is needed so the praets don't shoot down your own mortars etc. I made a picture so you understand:

    580d72b910eb47a36ae4a1fb1d38cc6b.png

    Updating the script this weekend.

    • Like 2

  7. Don't worry it's not dying, just got done fixing the targeting for the moment. I'm still trying to get somewhat accurate target lead & zeroing to work properly. Here's how it looks now:

    Gonna post an update later this evening. (It's 3 pm here)

    edit: Script seems to be working pretty good now, if the cram shoots you, you are too close. Apparently the Praetorian engages hostile vehicles. (delete the part that enables auto-targeting if you don't want this)

    • Like 2

  8. Back at it again trying to get the Mk21 Centurions to work, but for now this is happening:

    • Radar works properly now
    • Praetorians switch to using their own radar incase main is destroyed/not in use
    • Somewhat working target prioritization (Only when main radar is on)
    • Now doesn't drop down to 15 fps with multiple Praetorians on the map

    Going to try and get the centurions working for the next update.

    • Like 1
    • Thanks 2

  9. Fixed a bunch of minor bugs, it works like this now:

    • Main radar that scans the skies (optional)
    • Autoinit on every praetorian
    • Mk21 Centurion is very buggy and not included for the time being
    • About a 90% improvement in performance with multiple CRAMs
    • Now ready for mission implementation. (This means you can implement it now and update later without changing settings)

    More to come soon, had to fix the broken mess here.

    • Like 3

  10. Made a c-ram script for my mission and decided to post it here, feel free to use as you wish. (Wip)

     

    Place into init.sqf:

    call compile preprocessFileLineNumbers "scripts\C-RAM\C-RAM.sqf";
    _null = execVM"scripts\C-RAM\cram_init.sqf";

     

    scripts\C-RAM\C-RAM.sqf

    if(isServer)then{
    
      FSG_fnc_addCram = {
        params["_cram","_range"];
        _null = [_cram,_range]spawn{
          private["_cram","_range","_incoming","_target","_targetTime"];
          _cram = _this select 0;
          _range = _this select 1;
          while{alive _cram}do{
            _incoming = _cram nearObjects["ShellBase",_range];
            _incoming = _incoming + (_cram nearObjects["MissileBase",_range]);
            _incoming = _incoming + (_cram nearObjects["RocketBase",_range]);
    
            if(count _incoming > 0)then{
              _target = _incoming select 0;
              _fromTarget = _target getDir _cram;
              _dirTarget = direction _target;
              if(_dirTarget < _fromTarget + 25 && _dirTarget > _fromTarget - 25 && ((getPos _target) select 2) > 20 && alive _target)then{
                _targetTime = time + 5;
                while{alive _cram && alive _target && _targetTime > time}do{
                  _cram doWatch _target;
                  if((_cram weaponDirection (currentWeapon _cram)) select 2 > 0.15)then{
                    _cram fireAtTarget[_target,(currentWeapon _cram)];
                  };
                };
              };
              if(alive _target && alive _cram && _target distance _cram < FSG_CRAMDIS && _target distance _cram > 40 && (getPos _target) select 2 > 20)then{
                _null = [_target,_cram]spawn{
                  private["_target","_cram","_expPos","_exp"];
                  _target = _this select 0;
                  _cram = _this select 1;
                  _expPos = getPos _target;
                  deleteVehicle _target;
                  sleep 1;
                  _exp = "helicopterexplosmall" createVehicle _expPos;
                };
              };
            };
            if(count _incoming == 0)then{
              sleep 1;
            };
          };
        };
      };
    };

    scripts\C-RAM\cram_init.sqf

    if(isServer)then{
    
    FSG_DEBUG = TRUE; //Show debug info
    
    FSG_CURATORS = []; //Add game masters here
    
    FSG_CRAMDIS = 2000; //Distance to scan for projectiles
    
    {
      if(_x isKindOf "B_AAA_System_01_F")then{
        if((side _x) == West)then{
          [_x,FSG_CRAMDIS]call FSG_fnc_addCram;
        };
      };
    } forEach vehicles;
    
    {
      _x addEventHandler["CuratorObjectPlaced",{
        _obj = _this select 1;
        if(_obj isKindOf "B_AAA_System_01_F")then{
          [_obj, FSG_CRAMDIS]call FSG_fnc_addCram;
        };
      }];
    }forEach FSG_CURATORS;
    
    };

     

    SAMs (Mk21 Centurion) are not yet included.

    • Like 12
    • Thanks 4
×