Jump to content

Blitzen88

Member
  • Content Count

    129
  • Joined

  • Last visited

  • Medals

Community Reputation

11 Good

About Blitzen88

  • Rank
    Sergeant

Recent Profile Visitors

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

  1. This is the approach I was considering. Define a global variable in the loadout function script and then check for that variable in the loadout scripts.
  2. It would be for singleplayer
  3. Greetings, I use two sets of scripts to apply different equipment/guns/loadouts to AI groups. One script is a "loadout functions" script which creates functions which are used by other scripts which actually apply the loadout to the AI. This "loadout function" script is automatically run via the Init. Usually this works just fine but I have errors occur when an AI group execs a loadout script via its unit init box; I assume this is because unit init boxes exec before the init file. Is there a way to build in a check to the loadout scripts to see if a the loadout function script has run? Something like this: If ( loadoutFunctions.sqs has run ) then { (Do nothing) } else { exec LoadoutFunctions};
  4. How could you change that so the trigger's location is used instead of the player? Also, can you automatically get the diameter from the trigger instead of a manual input?
  5. Essentially title... Looking for a way to disable damage for buildings that are within a trigger's area. I can find examples of how to do this for target a specific building but not for all buildings within a trigger. Is this even possible? Thanks for the help
  6. I've been tweaking with an AI Artillery script that I cobbled together. It is intended to be used in a sector control type of mission. The script selects the closest enemy or neutral sector, scans for targets, and then, if enemys are within range, fires at them. Although artillery units already have a degree of randomness in their salvo, is there a way to increase the randomness a bit? I would like to add a bit of randomness to the actual target position. Here is what I got: /*========================================================================================== Arma III AI Artillery =========================================================================================== * Parameters: - Unit: Unit which will act as Artillery. - Side: Side of the Artillery Unit - Invincible: Whether the Artilley Unit should be invincible or not (True for Invincible) - Round Count: How many rounds will be fire per volley - Scan Distance: Distance from the selected sector that the Artillery Unit will scan for targets - Minimum Sleep Time: Minimum amount of time the Artillery Unit will wait before it scans again for targets - Maximum Sleep Time: Maximum amount of time the Artillery Unit will wait before it scans again for targets * Call with: [This, WEST, True, 10, 1000, 300, 600] execVM "Scripts\AI_Artillery.sqf" ===========================================================================================*/ //Define Variables _ArtilleryUnit = _this select 0; _Side = _this select 1; _Invincible = _this select 2; _NumberofRounds = _this select 3; _ScanDistance = _this select 4; _SleepMin = _this select 5; _SleepMax = _this select 6; //Need to have a sleep command to give the sectors a moment to initialize Sleep 5; //Need to make the Artillery Unit Invincible (based off of input) if (_Invincible) then { _ArtilleryUnit allowDamage false; } else { _ArtilleryUnit allowDamage true; }; //Make sure the ArtilleryUnit has ammo _ArtilleryUnit setVehicleAmmo 1; //Stop the ArtilleryUnit and empty its fuel so the ArtilleryUnit does not try to immediately move again after stopping _ArtilleryUnit setVelocity [0, 0, 0]; _ArtilleryUnit setfuel 0; Switch (_Side) do { //West Artillery Unit //---------------------------------------------------- case WEST : { EnemySide1 = East; // Have to use a Global Variable (I dont know why) EnemySide2 = East; // Have to use a Global Variable (I dont know why) FriendlySide = West; // Have to use a Global Variable (I dont know why) }; //East Artillery Unit //---------------------------------------------------- case EAST : { EnemySide1 = West; // Have to use a Global Variable (I dont know why) EnemySide2 = Resistance; // Have to use a Global Variable (I dont know why) FriendlySide = East; // Have to use a Global Variable (I dont know why) }; //Resistance Artillery Unit //---------------------------------------------------- case RESISTANCE : { EnemySide1 = East; // Have to use a Global Variable (I dont know why) EnemySide2 = East; // Have to use a Global Variable (I dont know why) FriendlySide = Resistance; // Have to use a Global Variable (I dont know why) }; }; //Find the Closest Neutral or Enemy Sector _sectors = +BIS_fnc_moduleSector_sectors apply{ [ _x distanceSqr _ArtilleryUnit, _x ] }; _sectors sort true; _index = _sectors findIf { _x params[ "", "_sector" ]; _sectorOwner = _sector getVariable [ "owner", sideUnknown ]; _sectorOwner isEqualTo sideUnknown || _sectorOwner isEqualTo EnemySide1 || _sectorOwner isEqualTo EnemySide1 }; //If the Artillery Unit's side controls all the sectors at once then _index will return as -1. Need to account for that in the script if (_index < 0) then { _Sectors sort false; // Sort in descending order (farthest sector to closest sector) _index = _sectors findIf { _x params[ "", "_sector" ]; _sectorOwner = _sector getVariable[ "owner", sideUnknown ]; // Include Friendly sectors in the sort since the Artillery Unit's side owns them all _sectorOwner isEqualTo FriendlySide }; TargetedSector = getPos ( _sectors select _index select 1 ); // Have to use a Global Variable (I dont know why) } else { TargetedSector = getpos ( _sectors select _index select 1 ); // If the Artillery Unit' side does not own all of the sectors then target the closest neutral/Enemy sector }; //Save the Targeted Sector to avoid errors with the point changing mid target/scan _SavedTargetedSector = TargetedSector; //Scan for infantry groups near the targeted sector _nearestEnemies = []; _nearestMen = nearestObjects [_SavedTargetedSector, ["Man"], _ScanDistance]; { if ( (side _x getFriend (side _ArtilleryUnit)) < 0.6 && {side _x != CIVILIAN} ) then { _nearestEnemies = _nearestEnemies + [_x]; }; } forEach _nearestMen; //If a target is found then open fire. If a target is not found then loop through the script if (count _nearestEnemies > 0) then { _Enemy = _nearestEnemies call bis_fnc_selectRandom; _ArtilleryAmmo = getArtilleryAmmo [_ArtilleryUnit] select 0; _ArtilleryETA = _ArtilleryUnit getArtilleryETA [getPosATL _Enemy, _ArtilleryAmmo]; _InRange = (getPosATL _Enemy) inRangeOfArtillery [[_ArtilleryUnit], _ArtilleryAmmo]; if (_ArtilleryETA > 0 AND _InRange) then { _ArtilleryUnit commandArtilleryFire [getPosATL _Enemy, _ArtilleryAmmo, _NumberofRounds]; // How can I add a bit of randomness (ie 25 meters left/right of the intended target) }; //Give the Artillery Unit Fuel since it is done firing _ArtilleryUnit setfuel 1; //Start the Cycle Sleep _SleepMin + (random _SleepMax); [_ArtilleryUnit, _Side, _Invincible, _NumberofRounds, _ScanDistance, _SleepMin, _SleepMax] execVM "Scripts\AI_Artillery.sqf"; } else { //Give the Artillery Unit Fuel since there are no targets in range _ArtilleryUnit setfuel 1; //Start the Cycle Sleep _SleepMin + (random _SleepMax); [_ArtilleryUnit, _Side, _Invincible, _NumberofRounds, _ScanDistance, _SleepMin, _SleepMax] execVM "Scripts\AI_Artillery.sqf"; }; This is the actual fire command: _ArtilleryUnit commandArtilleryFire [getPosATL _Enemy, _ArtilleryAmmo, _NumberofRounds]; How can I add a bit of randomness (ie 10-25 meters to the left/right/front/back) to the target position?
  7. Blitzen88

    ARMA 3 Addon Request Thread

    Any addons that just (ie no guns, other stuff) add laser & light combinations with the laser mounted on the top rail?
  8. Blitzen88

    EricJ Release thread

    Gotcha. Thanks for the reply!
  9. Blitzen88

    EricJ Release thread

    This might be an unusual request but is there a variant of this mod that adds the attachments (laser & flashlight combos, scopes, etc) but not the weapons? I like using vanilla weapons with a variety of attachments.
  10. I was able to test it this morning and it does return an error when the friendly side holds all of the sectors at once. How can I fix/account for that in the script? I cant exit the script if that condition is met because units are being spawned by the Spawn AI module and then the script is executing. Stopping the script from running wont stop the units from spawning. I would like for the helicopter to still fly off to a sector...I will start looking into that today.
  11. I will definitely try out those suggestions but I dont think its a syntax issue. Like I said, the script works 98% of the time. If it was an issue like that then I would think the script would mess up more often. I was thinking it might be related to a scenario where one side controls all the sectors at once. I think the script “filters” out friendly sectors and only selects uncaptured or enemy sectors. If the friendly side controls all the sectors then there is no where to go. Havent been able to test that yet though
  12. Greetings everyone, When I first got into Arma @Larrow helped me by writing a script (thread link) which would move a marker to the closest enemy or uncaptured sector. After fooling around for awhile I took that script snippet and mashed it together with Iceman77's Helicopter reinforcement script to create a helicopter reinforcement script that is compatible with Arma's Spawn AI and AI Sector Tactics Modules. The script, using the Spawn AI Module's expression field, takes spawned AI, places them in a spawned helicopter, drops them off near a sector and then returns back to base. The script uses the script from @Larrow's script to pick the closest enemy or uncaptured sector. Although it works 98% of the time I sometimes get an error that derails the script. Here is the script: /*========================================================================================== Arma III Helicopter Transport - CSAT =========================================================================================== * Creates a helicopter which transports infantry to the nearest neutral or enemy sector * The helicopter's spawn position and return location is the same position as the spawn module * Call with: _this execVM "Scripts\SpawnAI_HelicopterTransport_CSAT.sqf" ===========================================================================================*/ //Define Variables params[ "_group", "_module", "_groupData" ]; //Create Helicopter Group and Helicopter _heloCrew = createGroup East; _helo = [getPos _module, getDir _module, "O_Heli_Light_02_F", EAST] call BIS_FNC_spawnVehicle; //Assign the crew to the Helicopter group & assign cargo to the Helicopter {[_x] joinSilent _heloCrew;} forEach crew (_helo select 0); {_x assignAsCargo (_helo select 0); _x moveInCargo (_helo select 0);} forEach units _group; //Find the Closest Neutral or Enemy Sector _sectors = +BIS_fnc_moduleSector_sectors apply{ [ _x distanceSqr _module, _x ] }; _sectors sort true; _index = _sectors findIf { _x params[ "", "_sector" ]; _sectorOwner = _sector getVariable[ "owner", sideUnknown ]; _sectorOwner isEqualTo sideUnknown || _sectorOwner isEqualTo West }; //Find a flat position around the LZ marker & create an HPad there. _flatPos = [getPos ( _sectors select _index select 1 ), 0, 550, 10, 0, 0.3, 0] call BIS_fnc_findSafePos; _hPad = createVehicle ["Land_HelipadEmpty_F", _flatPos, [], 0, "NONE"]; //Give the helicopter an unload waypoint onto the hpad _heloWp = _heloCrew addWaypoint [_hPad, 0]; _heloWp setWaypointType "TR UNLOAD"; _heloWp setWaypointBehaviour "CARELESS"; _heloWp setWaypointCombatMode "BLUE"; _heloWp setWaypointSpeed "FULL"; _heloWp setWaypointStatements ["true", "(vehicle this) LAND 'LAND';"]; //Wait until the helicopter is touching the ground before ejecting the cargo WaitUntil {isTouchingGround (_helo select 0) || {!canMove (_helo select 0)}}; //Eject the Infantry {unAssignVehicle _x; _x action ["eject", vehicle _x]; sleep 0.5;} forEach units _group; //Eject the cargo //Wait Until the infantry group is no longer in the helicopter before assigning a new WP to the helicopter WaitUntil {{!alive _x || !(_x in (_helo select 0))} count (units _group) == count (units _group)}; //Delete the helipad {deletevehicle _hPad}; _heloWp = _heloCrew addWaypoint [getpos _module, 0]; _heloWp setWaypointType "MOVE"; _heloWp setWaypointBehaviour "AWARE"; _heloWp setWaypointCombatMode "BLUE"; _heloWp setWaypointSpeed "FULL"; _heloWp setWaypointStatements ["true", "{deleteVehicle _x;} forEach crew (vehicle this) + [vehicle this];"]; //End The error that I get has something to do with the sector selection process. Here is a picture of the error I get. Error: _flatPos = [getPos ( _sectors #select _index select 1 ), 0, 550, 10, 0, 0.3, 0] call BIS_fnc_findSafePos; Error Zero Divisor Anyone have any ideas how to fix this?
  13. I got it to work if anyone wants to check it out. /*========================================================================================== Arma III AI NightVision Settings =========================================================================================== * Applies or removes nightvision goggles to all units of a particular side based upon the settings defined in Init * Runs on initialization and will apply nightvision settings to units placed by the mission maker at the start of the mission * Script loops in intervarls to account for units spawned after the start of the mission * Captive units (setcaptive true) will not be effected by this script * Call with: Called via Init.sqf ===========================================================================================*/ //Define Variables/Input Selection _EastNVG = _this select 0; _WestNVG = _this select 1; _IndependentNVG = _this select 2; _LaserSetting = _this select 3; _Time = _this select 4; //START While {True} do { //Create Arrays _AllEastUnits = []; _AllWestUnits = []; _AllIndependentUnits = []; //"Filter" Units into their respective Arrays {If ((side _x) == East) then {_AllEastUnits pushBack _x}} forEach allUnits; {If ((side _x) == West) then {_AllWestUnits pushBack _x}} forEach allUnits; {If ((side _x) == Independent) then {_AllIndependentUnits pushBack _x}} forEach allUnits; //East //--------------------------------------- if (_EastNVG) then { {_x linkitem "NVGoggles_Opfor"; _x action ["nvGoggles", _x]; _x EnableIRLasers _LaserSetting} foreach _AllEastUnits; } else { {_x unlinkItem hmd _x; _x EnableIRLasers False} foreach _AllEastUnits; }; //West //--------------------------------------- if (_WestNVG) then { {_x linkitem "NVGoggles"; _x action ["nvGoggles", _x]; _x EnableIRLasers _LaserSetting} foreach _AllWestUnits; } else { {_x unlinkItem hmd _x; _x EnableIRLasers False} foreach _AllWestUnits; }; //Independent //--------------------------------------- if (_IndependentNVG) then { {_x linkitem "NVGoggles_Opfor"; _x action ["nvGoggles", _x]; _x EnableIRLasers _LaserSetting} foreach _AllIndependentUnits; } else { {_x unlinkItem hmd _x; _x EnableIRLasers False} foreach _AllIndependentUnits; }; Systemchat "AI NVG Settings Loaded"; Sleep _Time; //END };
  14. I know this is a heavily discussed issue but I can't piece it together despite searching and trying for several hours. Im trying to setup a script which will remove or add NVG goggles to each side based upon how the script is called via init. The idea is to setup an easy and fast way to quickly configure NVG settings for each side. This is what I have but I cant get it to work: /*========================================================================================== Arma III AI NightVision Settings ===========================================================================================*/ // 1) East NVG Setting - "True" to Add NVGs for all East Units, "False" to Remove NVGs for all East Units // 2) West NVG Setting - "True" to Add NVGs for all West Units, "False" to Remove NVGs for all West Units // 3) Independent NVG Setting - "True" to Add NVGs for all Independent Units, "False" to Remove NVGs for all Independent Units // 4) IR Laser Setting - "True" to enable IR Lasers for all units equipped with NVGs, "False" to disable IR Lasers for all units with NVGs // 5) Amount of time (in seconds) that will pass before the script loops _EastNVG = _this select 0; _WestNVG = _this select 1; _AAFNVG = _this select 2; _IRLaser = _this select 3; _Time = _this select 4; if (_EastNVG) then { { if ((side _x) == East) then { _x linkitem "NV_Goggles_Opfor"; _x action ["nvGoggles", _x]; _x EnableIRLasers _LaserSetting; }; } forEach allUnits; } else { { if ((side _x) == East) then { _x unlinkItem hmd _x; _x EnableIRLasers False; }; } forEach allUnits; }; Systemchat "AI NightVision Settings Loaded"; sleep _time; [] execvm Script.sqf My goal is do something like that for each side (East, West, Indep). If the input from init is "True" then the unit is given NVGs and they can operate their IR laser. If the setting is set to "False" then the NVGs are removed and their IR laser is turned off. The script is not complete but I cant get it to work for one side so I havent attempted to make it work for all the other sides.
  15. I tried it out and it works...Im still trying to wrap my head around why/how it works 😆 Thank you for your help!
×