Jump to content

Blitzen88

Member
  • Content Count

    105
  • Joined

  • Last visited

  • Medals

Everything posted by Blitzen88

  1. Im trying to use Beerkan's AI Skill Script to set AI skill levels. The script seems to run fine for the first interation but seems to run into issues when the script loops. This is what Im using: ConfigUnits = { _unit = _this select 0; _unit AllowFleeing 0; _unit AllowCrewInImmobile True; _unit setSkill ["aimingAccuracy", 0.4 + (random 0.25)]; _unit setSkill ["aimingShake", 0.25 + (random 0.25)]; _unit setSkill ["aimingSpeed", 0.75 + (random 0.25)]; _unit setSkill ["commanding", 1 + (random 0.15)]; _unit setSkill ["courage", 1 + (random 0.15)]; _unit setSkill ["general", 0.75 + (random 0.25)]; _unit setSkill ["reloadSpeed", 0.8 + (random 0.05)]; _unit setSkill ["spotDistance", 1 + (random 0.20)]; _unit setSkill ["spotTime", 0.75+ (random 0.25)]; }; // Now save this array of units for later use _CheckedUnits = allUnits; // We now have all Units that started on the map with configured with our new settings. // We can now set up a loop to monitor for anything new being created (3 minute second loop) while {true} do { _NewUnits = []; // this variable will contain any new units that were not included on a previous loop _NewUnits = allUnits - _CheckedUnits; // Remove checked Units from the updated Unit array to create a list of new Units if (count _NewUnits > 0) then // Now only do the following if there are new units found. {[_x] spawn ConfigUnits} forEach _NewUnits; composeText [parsetext format["<t size='1.5' align='left' color='#ffffff'>There are <t color='#00ff00'>%1 <t color='#ffffff'>new units found and <t color='#ff0000'>%2 <t color='#ffffff'>Checked Units",count _NewUnits,count _CheckedUnits]] remoteExec ["hint"];// Debug _CheckedUnits append _NewUnits; sleep 20; }; Im getting the following error: Undefined variable in expression: _unit _unit = _this select 0; #_unit AllowFleeing 0; Anyone have any ideas?
  2. I tested the mission out and it appears to work. I have no idea what I am doing differently.
  3. Has anyone had any trouble getting this script to work with buildings on Livonia?
  4. What error are you getting.
  5. If you look back a few pages Dread gVe an example of how to addaction to a unit. My understanding was to have the unit execute a script which adds the addaction
  6. For whatever reason my SpawnAI Module does not spawn units with all of their gear; they spawn in with their uniform, vest, backpack, and weapon but do not have first aidkits, weapon scopes, etc. I made a script to fix the issue: /*========================================================================================== Arma III Attachment(s) Fix Created by Blitzen Updated: 7/22/2019 =========================================================================================== * AI infantry units that are spawned by the AI Spawn Module are, for whatever reason, stripped of their weapon scopes and attachments * This script re-applys weapon scopes and lasers back to units depending upon the units class * Call with: _this execVM "Scripts\SpawnAI_AttachmentsFix.sqf" ===========================================================================================*/ params[ "_group", "_module", "_groupData" ]; //Define Unit Types (Case Sensitive!) _SquadLeader = ["O_Soldier_SL_F", "B_Soldier_SL_F", "I_Soldier_SL_F"]; _RiflemanAT = ["O_Soldier_LAT_F", "B_Soldier_LAT_F", "I_Soldier_LAT_F"]; _TeamLeader = ["O_Soldier_TL_F", "B_Soldier_TL_F", "I_Soldier_TL_F"]; _Ammobearer = ["O_Soldier_A_F", "B_Soldier_A_F", "I_Soldier_A_F"]; _Rifleman = ["O_Soldier_F", "B_Soldier_F", "I_Soldier_F"]; _Marksman = ["O_soldier_M_F", "B_soldier_M_F", "I_Soldier_M_F"]; _Autorifleman = ["O_Soldier_AR_F", "B_Soldier_AR_F", "I_Soldier_AR_F"]; _Medic = ["O_medic_F", "B_medic_F", "I_medic_F"]; _Grenadier = ["O_Soldier_GL_F", "B_Soldier_GL_F", "I_Soldier_GL_F"]; _MissleSpecialist = ["O_Soldier_AT_F", "B_Soldier_AT_F", "I_Soldier_AT_F"]; _AsstMissleSpecialist = ["O_Soldier_AAT_F", "B_Soldier_AAT_F", "I_Soldier_AAT_F"]; _HeavyGunner = ["O_HeavyGunner_F", "B_HeavyGunner_F"]; _AsstAutorifleman = ["O_Soldier_AAR_F", "B_Soldier_AAR_F", "I_Soldier_AAR_F"]; _Sharpshooter = ["O_Sharpshooter_F", "B_Sharpshooter_F", "I_Sharpshooter_F"]; //START { _x params[ "_unit" ]; _unitType = typeOf _unit; //East //--------------------------------------- if ( side _group isEqualTo East ) then { if (_unitType in _SquadLeader) then {[_unit, configfile >> "CfgVehicles" >> "O_Soldier_SL_F"] call BIS_fnc_loadinventory;}; if (_unitType in _RiflemanAT) then {[_unit, configfile >> "CfgVehicles" >> "O_Soldier_LAT_F"] call BIS_fnc_loadinventory;}; if (_unitType in _TeamLeader) then {[_unit, configfile >> "CfgVehicles" >> "O_Soldier_TL_F"] call BIS_fnc_loadinventory;}; if (_unitType in _Ammobearer) then {[_unit, configfile >> "CfgVehicles" >> "O_Soldier_A_F"] call BIS_fnc_loadinventory;}; if (_unitType in _Rifleman) then {[_unit, configfile >> "CfgVehicles" >> "O_Soldier_F"] call BIS_fnc_loadinventory;}; if (_unitType in _Marksman) then {[_unit, configfile >> "CfgVehicles" >> "O_soldier_M_F"] call BIS_fnc_loadinventory;}; if (_unitType in _Autorifleman) then {[_unit, configfile >> "CfgVehicles" >> "O_Soldier_AR_F"] call BIS_fnc_loadinventory;}; if (_unitType in _Medic) then {[_unit, configfile >> "CfgVehicles" >> "O_medic_F"] call BIS_fnc_loadinventory;}; if (_unitType in _Grenadier) then {[_unit, configfile >> "CfgVehicles" >> "O_Soldier_GL_F"] call BIS_fnc_loadinventory;}; if (_unitType in _MissleSpecialist) then {[_unit, configfile >> "CfgVehicles" >> "O_Soldier_AT_F"] call BIS_fnc_loadinventory;}; if (_unitType in _AsstMissleSpecialist) then {[_unit, configfile >> "CfgVehicles" >> "O_Soldier_AAT_F"] call BIS_fnc_loadinventory;}; if (_unitType in _HeavyGunner) then {[_unit, configfile >> "CfgVehicles" >> "O_HeavyGunner_F"] call BIS_fnc_loadinventory;}; if (_unitType in _AsstAutorifleman) then {[_unit, configfile >> "CfgVehicles" >> "O_Soldier_AAR_F"] call BIS_fnc_loadinventory;}; if (_unitType in _Sharpshooter) then {[_unit, configfile >> "CfgVehicles" >> "O_Sharpshooter_F"] call BIS_fnc_loadinventory;}; //_unit linkItem "NVGoggles_OPFOR"; }; //West //--------------------------------------- if ( side _group isEqualTo West ) then { if (_unitType in _SquadLeader) then {[_unit, configfile >> "CfgVehicles" >> "B_Soldier_SL_F"] call BIS_fnc_loadinventory;}; if (_unitType in _RiflemanAT) then {[_unit, configfile >> "CfgVehicles" >> "B_Soldier_LAT_F"] call BIS_fnc_loadinventory;}; if (_unitType in _TeamLeader) then {[_unit, configfile >> "CfgVehicles" >> "B_Soldier_TL_F"] call BIS_fnc_loadinventory;}; if (_unitType in _Ammobearer) then {[_unit, configfile >> "CfgVehicles" >> "B_Soldier_A_F"] call BIS_fnc_loadinventory;}; if (_unitType in _Rifleman) then {[_unit, configfile >> "CfgVehicles" >> "B_Soldier_F"] call BIS_fnc_loadinventory;}; if (_unitType in _Marksman) then {[_unit, configfile >> "CfgVehicles" >> "B_soldier_M_F"] call BIS_fnc_loadinventory;}; if (_unitType in _Autorifleman) then {[_unit, configfile >> "CfgVehicles" >> "B_Soldier_AR_F"] call BIS_fnc_loadinventory;}; if (_unitType in _Medic) then {[_unit, configfile >> "CfgVehicles" >> "B_medic_F"] call BIS_fnc_loadinventory;}; if (_unitType in _Grenadier) then {[_unit, configfile >> "CfgVehicles" >> "B_Soldier_GL_F"] call BIS_fnc_loadinventory;}; if (_unitType in _MissleSpecialist) then {[_unit, configfile >> "CfgVehicles" >> "B_Soldier_AT_F"] call BIS_fnc_loadinventory;}; if (_unitType in _AsstMissleSpecialist) then {[_unit, configfile >> "CfgVehicles" >> "B_Soldier_AAT_F"] call BIS_fnc_loadinventory;}; if (_unitType in _HeavyGunner) then {[_unit, configfile >> "CfgVehicles" >> "B_HeavyGunner_F"] call BIS_fnc_loadinventory;}; if (_unitType in _AsstAutorifleman) then {[_unit, configfile >> "CfgVehicles" >> "B_Soldier_AAR_F"] call BIS_fnc_loadinventory;}; if (_unitType in _Sharpshooter) then {[_unit, configfile >> "CfgVehicles" >> "B_Sharpshooter_F"] call BIS_fnc_loadinventory;}; //_unit linkItem "NVGoggles"; }; //Independent //--------------------------------------- if ( side _group isEqualTo Independent ) then { if (_unitType in _SquadLeader) then {[_unit, configfile >> "CfgVehicles" >> "I_Soldier_SL_F"] call BIS_fnc_loadinventory;}; if (_unitType in _RiflemanAT) then {[_unit, configfile >> "CfgVehicles" >> "I_Soldier_LAT_F"] call BIS_fnc_loadinventory;}; if (_unitType in _TeamLeader) then {[_unit, configfile >> "CfgVehicles" >> "I_Soldier_TL_F"] call BIS_fnc_loadinventory;}; if (_unitType in _Ammobearer) then {[_unit, configfile >> "CfgVehicles" >> "I_Soldier_A_F"] call BIS_fnc_loadinventory;}; if (_unitType in _Rifleman) then {[_unit, configfile >> "CfgVehicles" >> "I_Soldier_F"] call BIS_fnc_loadinventory;}; if (_unitType in _Marksman) then {[_unit, configfile >> "CfgVehicles" >> "I_soldier_M_F"] call BIS_fnc_loadinventory;}; if (_unitType in _Autorifleman) then {[_unit, configfile >> "CfgVehicles" >> "I_Soldier_AR_F"] call BIS_fnc_loadinventory;}; if (_unitType in _Medic) then {[_unit, configfile >> "CfgVehicles" >> "I_medic_F"] call BIS_fnc_loadinventory;}; if (_unitType in _Grenadier) then {[_unit, configfile >> "CfgVehicles" >> "I_Soldier_GL_F"] call BIS_fnc_loadinventory;}; if (_unitType in _MissleSpecialist) then {[_unit, configfile >> "CfgVehicles" >> "I_Soldier_AT_F"] call BIS_fnc_loadinventory;}; if (_unitType in _AsstMissleSpecialist) then {[_unit, configfile >> "CfgVehicles" >> "I_Soldier_AAT_F"] call BIS_fnc_loadinventory;}; if (_unitType in _AsstAutorifleman) then {[_unit, configfile >> "CfgVehicles" >> "I_Soldier_AAR_F"] call BIS_fnc_loadinventory;}; if (_unitType in _Sharpshooter) then {[_unit, configfile >> "CfgVehicles" >> "I_Sharpshooter_F"] call BIS_fnc_loadinventory;}; //_unit linkItem "NVGoggles_Indep"; }; Sleep 2; }forEach units _group; //END Note that the _unit linkitem NVgoggles lines were commented out whenever I tested the script.
  7. I was able to run it real quick and it seems to work well with units that placed down at the start of the mission but not as well with units that spawn after the mission starts. Some of the spawned units have their NVG's removed but other units (within the same squad) do not have their NVGs removed. I observed the units through what should have been multiple loops and the NVGs were never removed. I didnt get any errors. **EDIT** My guess is that this issue relates to how the unit is equipped upon spawning. It seems there is a delay between when the unit spawns and when it receives its gear. The unit spawns in, gets HMD_Checked true'd, and then receives its gear...?
  8. @Larrow Thank you for your help! Every time you post something I learn of new commands and ways of doing things that I didnt know about before
  9. Wow, thats a lot of scripting. My feeble mind was able to pick up on the redressing part of the script but then blew a fuse. Im trying to utilize the frame work of your script to give/remove night vision goggles to units of a particular side. The thought is to change how the script is called via the init file to easily change who has access to night vision, ie: [true, true, false] execvm script Where each true/false input corresponds to a side. I need the script to loop because I use a lot of spawning in my missions.
  10. All of that got it work perfectly! Is there anyway you could show me how to take the framework of that script and apply it to equiping/removing a unit's nightvision goggles? I have tried and tried but I dont know what I am doing wrong. This is what I got: //Define Variables _NVGWest = _this select 0; _NVGEast = _this select 1; _NVGIndep = _this select 2; // Now save this array of units for later use _CheckedUnits = []; // We now have all Units that started on the map with configured with our new settings. // We can now set up a loop to monitor for anything new being created (3 minute second loop) While {True} do { _NewUnits = allUnits - _CheckedUnits; // Remove checked Units from the updated Unit array to create a list of new Units if (count _NewUnits > 0) then { // Now only do the following if there are new units found. If (_NVGWest) then { {If ((side _x) == West) then {_x AddItem "NVGoggles"; _x AssignItem "NVGoggles";}}forEach allunits; } Else {_x UnAssignItem "NVGoggles"; _x RemoveItem "NVGoggles";}forEach allunits; If (_NVGEast) then { {If ((side _x) == East) then {_x AddItem "NVGoggles_Opfor"; _x AssignItem "NVGoggles_Opfor";}}forEach allunits; } Else {_x UnAssignItem "NVGoggles_Opfor"; _x RemoveItem "NVGoggles_Opfor";}forEach allunits; If (_NVGIndep) then { {If ((side _x) == Independent) then {_x AddItem "NVGoggles_Indep"; _x AssignItem "NVGoggles_Indep";}}forEach allunits; } Else {_x UnAssignItem "NVGoggles_Indep"; _x RemoveItem "NVGoggles_Indep";}forEach allunits }; composeText [parsetext format["<t size='1.5' align='left' color='#ffffff'>There are <t color='#00ff00'>%1 <t color='#ffffff'>new units found and <t color='#ff0000'>%2 <t color='#ffffff'>Checked Units",count _NewUnits,count _CheckedUnits]] remoteExec ["hint"];// Debug _CheckedUnits append _NewUnits; sleep 15; };
  11. Still trying to figure out what I am doing wrong
  12. I have modified my description.ext file to add an init eventhandler to the CAManBase: class Extended_Init_Eventhandlers { class CAManBase { init = "_this execVM 'Scripts\AISkillSettings.sqf';"; }; }; That code snippet executes my AI skill script whenever the unit is spawned. The relevant part of the script is: { _x AllowFleeing 0; _x AllowCrewInImmobile True; _x setSkill ["aimingAccuracy", 0.5 + (random 0.25)]; _x setSkill ["aimingShake", 0.25 + (random 0.25)]; _x setSkill ["aimingSpeed", 0.75 + (random 0.25)]; _x setSkill ["commanding", 1 + (random 0.15)]; _x setSkill ["courage", 1 + (random 0.15)]; _x setSkill ["general", 0.75 + (random 0.25)]; _x setSkill ["reloadSpeed", 0.8 + (random 0.05)]; _x setSkill ["spotDistance", 1 + (random 0.20)]; _x setSkill ["spotTime", 0.75+ (random 0.25)]; } forEach allUnits; Is there anyway to change this script from applying to all units to just applying to the individual unit that has spawned? I have tried "this" and "_this" instead of "foreach allunits" but it I always get errors when I mess around with it. Thanks
  13. That seems to work. Thank you!
  14. I’ve tried “_this” and it didnt work...?
  15. Can someone explain to me how to “modify” the vanilla ak-12 and ak-12u to accept modded suppressors such as the ones included in the EricJ and RH mods? All of the scopes and rail attachments (lasers, etc) work on the Ak-12. None of those work on the Ak-12u. Can anyone tell me how to get it to work?
  16. You guys are amazing lol. I assumed there would be an update to CBA at some point.
  17. Im making a mission where Nato and Csat start at their base and then proceed to capture a handful of sectors. New spawn points are unlocked depending upon who controls a sector. However, as more and more sectors are captured, more and more spawn points are available for the AI to spawn at. This leads to AI spawning at positions that are not always near the frontline. Is there anyway to force AI to spawn at spawn points that are closest to the nearest enemy controlled sector?
  18. Im trying to create a basic weapon swap script for units that are spawned via the AI Spawn Module. I was hoping I could pull this off by executing a script via the module’s expression field. I tried searching and found some examples but I cant pull it off myself. Can someone tell/show me how to call the script and apply it to the spawned group? Thank you so much!!
  19. Vanilla Units. Only thing I can think of that might mess it up would be the Advanced AI Command mod. However, that mod doesnt cause any issues with weapon attachments when units are spawned via script. Edit I forgot to add that I blacklisted alot of group types. Im not 100% sure but I think units used to spawn with attachments before the blacklist was applied.
  20. How would I implement an approach like this: _unit = ??? _possibleScopes = [ "optic_Arco" ,"optic_Hamr" ,"optic_Holosight" ,"optic_Aco" ]; _randomScope = selectRandom [_possibleScopes]; _unit addPrimaryWeaponItem _RandomScope}; I know its probably full of errors but hopefully it gets my point/approach across...? Thank you so much for your help by the way. I appreciate it! Im also learning too!
  21. From my understanding, thats going to cause issues: 1) The spawned units will copy that loadout and there will be no diversity for scopes. I wanted to define a list of scopes and then have a random selection of the available scopes. That way there is a certain degree of uniqueness in a unit’s loadout. 2) For the Ak12’s, all units will copy the reference unit’s loadout. I do not want machinegunners to have Ak12’s; only riflemen and grenadiers
  22. Two things: 1) For whatever reason, units that are spawned by the AI Spawn Module are stripped of their weapon attachments (scopes and IR lasers). I want to have each unit exec a script that adds those attachments. 2) Sometimes I like to have CSAT use Ak12s. I want a script to remove their current weapon and add an Ak12. I have a general idea how to write/setup the script but I dont know how to call it/apply it.
  23. How would you call a script from the expression field? What would you put there to exec a script for each group member and how would you define the group member in the script?
  24. Thats a great; I just need to know how to call it, etc. Im a moron
×