Jump to content

Blitzen88

Member
  • Content Count

    253
  • Joined

  • Last visited

  • Medals

Everything posted by Blitzen88

  1. I'm trying to figure out how to pass local variables via a series of addactions scripts. I know I can pass them as _arguments but I cant figure out the syntax/what I'm doing wrong. Here is the Spawn's Main Menu: Here is the Control Script which is exec'd after a selection is made on the main menu script:
  2. How the process works, is you move through a variety of menus before selecting which unit/vehicle/squad to spawn For instance: Main Menu (units, Squads, Vehicles) --> "Control Type" (join player, ai controlled, etc.) --> Camo selection --> Pick which unit/vehicle/squad to spawn. The string(s) of "units", "vehicles" etc. is used by the spawn script to add spawn selections based upon input (ie addaction for a list of squads, etc.) Thats why Im trying to pass strings. Other scripts use if (_Variable isEqualto "Units") then {addaction for units}. I dont want to use global variables because I might want to have multiple spawn points/scripts.
  3. I'm modifying Nixx57's Ambient Combat Script but I'm having some difficulties getting consistent group spawning. The script stops spawning if the number of spawned groups is no longer less than the group limit (_SpawnedGroups < _GroupsLimit). However, it doesnt seem to be very reliable. I'm also having problems exec'ing the UPS script for some reason...? Here is what I got: /*========================================================================================== Arma III - Test Created by Nixx57 Edited by Blitzen =========================================================================================== * test https://forums.bohemia.net/forums/topic/231643-release-generic-ambient-combat-first-script/ * [2000, 8, "RHS", True, True, False, False, "UPS_Test", 20] execVM "Scripts\Testing\AI_AmbientCombat_Edits.sqf" ===========================================================================================*/ //Define Input Variables _SpawnAreaAroundPlayers = _this select 0; _GroupsLimit = _this select 1; _ModType = _this select 2; _SpawnBLUFOR = _this select 3; _SpawnOPFOR = _this select 4; _SpawnINDEPENDENT = _this select 5; _DisableVehicles = _this select 6; _UPSMarkerName = _this select 7; _SleepDelay = _this select 8; //Define Additional Variables _GroupsWest = []; _GroupsEast = []; _GroupsIndependent = []; _Sides = []; _SpawnedGroups = 0; _SelectedSide = []; _SelectedGroup = []; _NewGroup = []; _VehicleCheck = []; _GroupTracker = []; //Define Group Arrays based off of ModType Input Switch (_ModType) do { case "Vanilla": { _GroupsWest = [ ["B_Soldier_SL_F", "B_Soldier_F", "B_soldier_LAT_F", "B_soldier_M_F", "B_Soldier_TL_F", "B_soldier_AR_F", "B_Soldier_A_F", "B_medic_F"], ["B_Soldier_SL_F", "B_soldier_AR_F", "B_Soldier_GL_F", "B_soldier_M_F", "B_soldier_AT_F", "B_soldier_AAT_F", "B_Soldier_A_F", "B_medic_F"], ["B_APC_Wheeled_01_cannon_F", "B_Soldier_SL_F", "B_Soldier_TL_F", "B_Soldier_F", "B_soldier_LAT_F", "B_soldier_M_F", "B_soldier_AR_F", "B_Soldier_A_F", "B_medic_F"], ["APC_Wheeled_01_atgm_base_lxWS", "B_Soldier_SL_F", "B_Soldier_TL_F", "B_Soldier_F", "B_soldier_LAT_F", "B_soldier_M_F", "B_soldier_AR_F", "B_Soldier_A_F", "B_medic_F"] ]; _GroupsEast = [ ["O_Soldier_SL_F", "O_Soldier_F", "O_Soldier_LAT_F", "O_soldier_M_F", "O_Soldier_TL_F", "O_Soldier_AR_F", "O_Soldier_A_F", "O_medic_F"], ["O_Soldier_SL_F", "O_Soldier_AR_F", "O_Soldier_GL_F", "O_soldier_M_F", "O_Soldier_AT_F", "O_Soldier_AAT_F", "O_Soldier_A_F", "O_medic_F"], ["O_APC_Wheeled_02_rcws_v2_F", "O_Soldier_SL_F", "O_Soldier_TL_F", "O_Soldier_F", "O_Soldier_LAT_F", "O_soldier_M_F", "O_Soldier_AR_F", "O_Soldier_A_F", "O_medic_F"], ["O_APC_Tracked_02_cannon_F", "O_Soldier_SL_F", "O_Soldier_TL_F", "O_Soldier_F", "O_Soldier_LAT_F", "O_soldier_M_F", "O_Soldier_AR_F", "O_Soldier_A_F", "O_medic_F"] ]; _GroupsIndependent = [ ["I_Soldier_SL_F", "I_soldier_F", "I_Soldier_LAT_F", "I_Soldier_M_F", "I_Soldier_TL_F", "I_Soldier_AR_F", "I_Soldier_A_F", "I_medic_F"], ["I_Soldier_SL_F", "I_Soldier_AR_F", "I_Soldier_GL_F", "I_Soldier_M_F", "I_Soldier_AT_F", "I_Soldier_AAT_F", "I_Soldier_A_F", "I_medic_F"], ["I_APC_Wheeled_03_cannon_F", "I_Soldier_SL_F", "I_Soldier_TL_F", "I_soldier_F", "I_Soldier_LAT_F", "I_Soldier_M_F", "I_Soldier_AR_F", "I_Soldier_A_F", "I_medic_F"], ["I_APC_tracked_03_cannon_F", "I_Soldier_SL_F", "I_Soldier_TL_F", "I_soldier_F", "I_Soldier_LAT_F", "I_Soldier_M_F", "I_Soldier_AR_F", "I_Soldier_A_F", "I_medic_F"] ]; }; case "RHS": { _GroupsWest = [ ["B_Soldier_SL_F", "B_Soldier_F", "B_soldier_LAT_F", "B_soldier_M_F", "B_Soldier_TL_F", "B_soldier_AR_F", "B_Soldier_A_F", "B_medic_F"], ["B_Soldier_SL_F", "B_soldier_AR_F", "B_Soldier_GL_F", "B_soldier_M_F", "B_soldier_AT_F", "B_soldier_AAT_F", "B_Soldier_A_F", "B_medic_F"], ["rhsusf_stryker_m1126_m2_wd", "B_Soldier_SL_F", "B_Soldier_TL_F", "B_Soldier_F", "B_soldier_LAT_F", "B_soldier_M_F", "B_soldier_AR_F", "B_Soldier_A_F", "B_medic_F"], ["rhsusf_stryker_m1126_mk19_wd", "B_Soldier_SL_F", "B_Soldier_TL_F", "B_Soldier_F", "B_soldier_LAT_F", "B_soldier_M_F", "B_soldier_AR_F", "B_Soldier_A_F", "B_medic_F"], ["RHS_M2A3_wd", "B_Soldier_SL_F", "B_Soldier_TL_F", "B_Soldier_F", "B_soldier_LAT_F", "B_soldier_M_F", "B_soldier_AR_F", "B_Soldier_A_F", "B_medic_F"] ]; _GroupsEast = [ ["O_Soldier_SL_F", "O_Soldier_F", "O_Soldier_LAT_F", "O_soldier_M_F", "O_Soldier_TL_F", "O_Soldier_AR_F", "O_Soldier_A_F", "O_medic_F"], ["O_Soldier_SL_F", "O_Soldier_AR_F", "O_Soldier_GL_F", "O_soldier_M_F", "O_Soldier_AT_F", "O_Soldier_AAT_F", "O_Soldier_A_F", "O_medic_F"], ["rhs_btr80a_msv", "O_Soldier_SL_F", "O_Soldier_TL_F", "O_Soldier_F", "O_Soldier_LAT_F", "O_soldier_M_F", "O_Soldier_AR_F", "O_Soldier_A_F", "O_medic_F"], ["rhs_bmp2d_msv", "O_Soldier_SL_F", "O_Soldier_TL_F", "O_Soldier_F", "O_Soldier_LAT_F", "O_soldier_M_F", "O_Soldier_AR_F", "O_Soldier_A_F", "O_medic_F"], ["rhs_bmp3m_msv", "O_Soldier_SL_F", "O_Soldier_TL_F", "O_Soldier_F", "O_Soldier_LAT_F", "O_soldier_M_F", "O_Soldier_AR_F", "O_Soldier_A_F", "O_medic_F"] ]; _GroupsIndependent = []; // Independent units are not yet supported for RHS but have been included here for completness }; }; //Some RHS vehicles can hold 8 passengers, some can hold 6 - need to make an array _SixPassengers = [ "RHS_M2A3_wd", "rhs_bmp2d_msv", "rhs_bmp3m_msv" ]; //Create UPS Marker _UPSMarker = createMarker [_UPSMarkerName, getpos Player]; _UPSMarker setMarkerShapeLocal "ELLIPSE"; _UPSMarker setMarkerSizeLocal [_SpawnAreaAroundPlayers, _SpawnAreaAroundPlayers]; _UPSMarker setMarkerAlpha 0; //Apply selected Side(s) to Sides Array if(_SpawnBLUFOR) then {_Sides pushBack West}; if(_SpawnOPFOR) then {_Sides pushBack East}; if(_SpawnINDEPENDENT) then {_Sides pushBack Independent}; //Start Loop while {true} do { // Spawn "Check" if (_SpawnedGroups < _GroupsLimit) then { //Select a Side _SelectedSide = selectRandom _Sides; //Select a group from the selected side Switch (_SelectedSide) do { case West: { _SelectedGroup = selectRandom _GroupsWest; }; case East: { _SelectedGroup = selectRandom _GroupsEast; }; case Independent: { _SelectedGroup = selectRandom _GroupsIndependent; }; }; //Find a spawn position _SpawnPos = [Player, (_SpawnAreaAroundPlayers - 200), _SpawnAreaAroundPlayers, 3, 0, 10, 0] call Bis_fnc_findSafePos; //Spawn a group _NewGroup = [_SpawnPos, _SelectedSide, _SelectedGroup] call BIS_fnc_spawnGroup; //Give time for the new group to initialize Sleep 2; //Add new group to group tracking array _SpawnedGroups = _SpawnedGroups + 1; _GroupTracker = _GroupTracker + [_NewGroup]; //Set group parameters _NewGroup setBehaviour "AWARE"; _NewGroup setSpeedMode "NORMAL"; _NewGroup setCombatMode "RED"; _NewGroup setFormation "WEDGE"; _NewGroup deleteGroupWhenEmpty true; //See if the group has a vehicle _VehicleCheck = [_NewGroup, true] call Bis_Fnc_groupVehicles; //Delete the vehicle if vehicles are disabled (based on input) if ((_DisableVehicles) && (count _VehicleCheck > 0)) then { { deletevehicle _x} foreach _VehicleCheck; }; //Delete squad members if the vehicle can only hold 6 passengers { if (_x in _SixPassengers) then { {deletevehicle _x} foreach [(units _NewGroup select 6), (units _NewGroup select 7)]; }; }foreach _VehicleCheck; //Exec UPS Script [(leader _NewGroup), _UPSMarkerName, "NoSlow", "NoFollow"] execVM "Scripts\AI\AI_UrbanPatrolScript.sqf"; //Apply loadout script based on input Switch (_ModType) do { case "Vanilla": {[_NewGroup] execVM "Scripts\Loadouts\Vanilla\Loadout_Default.sqf"}; case "RHS": {[_NewGroup] execVM "Scripts\Loadouts\RHS\Loadout_RHS_Default.sqf"}; }; }; //Delete Groups Check { if ((leader _x distance player) > _SpawnAreaAroundPlayers && {alive _x} count units _x > 0) then { { if (vehicle _x != _x) then { deletevehicle (objectParent _x)}; deletevehicle _x; }foreach units _x; _SpawnedGroups = _SpawnedGroups - 1; }; }foreach _GroupTracker; //_SpawnedGroups = count _GroupTracker; //Move UPSMarker _UPSMarker setMarkerPos Player; sleep _SleepDelay; };
  4. I’ve defined “custom” (ie RHS and vanilla) groups via my description.ext file. Is there a way I can spawn those groups via Bis_fnc_spawngroup? Based off of my structure, would this be the correct syntax: configfile >> "CfgGroups" >> "West" >> "NATO_RHS" >> "Infantry" >> "NATO_RHS_RifleSquad" I don’t know if “configfile” needs to be concluded…? Description.ext: Nato
  5. Im trying to brainstorm a spawn script but I’m running into some issues when it comes to locating a spawn position. I’m trying to accomplish two things: 1) find a “safe” spawn position (ie don’t spawn tanks on top of a building) via BIS_fnc_findSafePos and 2) make sure the player does not see the spawn positions via checkvisibility. However, I don’t know how to structure the script so it will continue to search for a spawn position if it cant find one on the initial search. This is what I’m thinking:
  6. How do you modify a Spawn AI Module's Expression Field via a Script? Particularly, how do you modify it while retaining the existing input? For instance: Call with: [SpawnModule] execVM ScriptPath _SpawnModule = _this select 0; _Expression = ?? Get variable ?? _NewExpression = _Expression + (New Stuff) Thanks
  7. Thank you, thats what I was looking for!
  8. Thanks for the reply. I already use that for scripts which are called from the expression field. Im trying to figure out if you can change the script with another script.
  9. How can I pull and use a unit's classname in the title of an addaction? For instance: { _Object addaction ["How do I add the classname here", {[_this select 0] execVM "Scripts\Blah.sqf"}]; } foreach units group1;
  10. How would you do it if you were pulling from an array? For instance: _array = [ Vehicle1 Vehicle2 Vehicle3 ]; { _Object addaction ["How do I add the name here", {[_this select 0] execVM "Scripts\Blah.sqf"}]; } foreach _array;
  11. Greetings, I use Zenophon's Garrison Script to garrison buildings with AI. Its my favorite garrison script for a number of reasons. However, the script runs some sort of check to place an AI solider directly in front of a window - this way the AI unit can have a full field of view. Although this is ideal for most scenarios, sometimes I like to "fortify" a house by blocking all of the windows. This way, a player has to clear the house of AI as opposed to shooting them through the window. However, when I do this, Zenophon's script ignores/fails to place units in the building because their view is blocked. I'm trying to add a parameter to turn the view checking on/off but I cant figure it out. Here is a version of the script: Many years ago I reached out to Zenophon regarding this issue and he tried to help me fix this issue. Here is what he said: However, I cant figure out how to implement his suggestions - when I add a true/false check with the original conditions the script doesnt seem to work. I would reach out to him again but he seems inactive now. Any help would be appreciated
  12. Think I figured it out - nevermind
  13. Got an AI hunt (ie stalk) script that I made and Im having some trouble re-execing it after a While loop has completed. Can anyone tell/show me how to make it loop without re-execing it? I feel like re-execing it is bad practice. Here it is (look at the very bottom):
  14. Isnt that the same as re-execing it if you just re-call it?
  15. Greetings, The command addGroupIcon adds an icon to a group’s leader. The type of icon that is used is based off of the input. Is there anyway to automatically select/use the correct icon based off of the type of group? For instance, infantry groups get infantry icons, armored groups get armored icons, etc?
  16. Probably going to take this route. I found this post which describes how MARTA classifies groups….probably gonna take the same approach.
  17. I play missions using the Military Symbols module (aka Marta). For those who are unaware, the module creates/places symbols over identified enemy groups. However, the module has a problem : once an enemy group has been identified, its marker will not be removed until that group has been destroyed. Although the module has commands to tweak its settings (ie “duration”), they dont work. However, would it be possibe to add a “Map” mission eventhandler which hides “unknown” groups when the map is opened? For example: However I cant get it to work.
  18. Blitzen88

    Fixing Marta with Knowsabout

    Can anyone tell me why this doesnt work: But yet this works: Im confused.
  19. Blitzen88

    Fixing Marta with Knowsabout

    That has some interesting info but that user wanted to hide all enemy groups. I dont want to hide ALL enemy groups - I want to hide groups which have been previously identified and the player’s side should no longer know about (ie no longer in sight, far away).
  20. Greetings, Im trying to figure out how to create an AI unit via an addaction (which I've figured out) BUT to also have an addaction where a created unit will join the player. This is what I have: /*========================================================================================== Arma III - AI Unit "Purchase" Created by Blitzen =========================================================================================== * Spawn AI units to refill/replace dead units * This script will change the type of unit based upon the player's side * Requires named Flags: FlagWest, FlagEast, FlagAAF * Call with: [this] execVM "Scripts\UnitRecruitment\Recruitment_Unit.sqf" ===========================================================================================*/ _Flag = _this select 0; _Flag allowDamage false; //West //--------------------------------------- if (side Player isEqualTo West) then { _FlagWest = _this select 0; _FlagWest setObjectTexture [ 1, "a3\data_f\flags\flag_nato_co.paa"]; _FlagWest addAction ["Spawn Squad Leader", {"B_Soldier_SL_F" createUnit [getpos FlagWest, CreateGroup West];}]; // Squad Leader _FlagWest addAction ["Spawn Team Leader", {"B_Soldier_TL_F" createUnit [getpos FlagWest, CreateGroup West];}]; // Team Leader _FlagWest addAction ["Spawn Rifleman", {"B_Soldier_F" createUnit [getpos FlagWest, CreateGroup West];}]; // Rifleman _FlagWest addAction ["Spawn Rifleman AT", {"B_Soldier_LAT_F" createUnit [getpos FlagWest, CreateGroup West];}]; // Rifleman AT _FlagWest addAction ["Spawn Grenadier", {"B_Soldier_GL_F" createUnit [getpos FlagWest, CreateGroup West];}]; // Grenadier _FlagWest addAction ["Spawn AutoRifleman", {"B_Soldier_AR_F" createUnit [getpos FlagWest, CreateGroup West];}]; // AutoRifleman _FlagWest addAction ["Spawn Asst. AutoRifleman", {"B_Soldier_AAR_F" createUnit [getpos FlagWest, CreateGroup West];}]; // Asst. AutoRifleman _FlagWest addAction ["Spawn Heavy Gunner", {"B_HeavyGunner_F" createUnit [getpos FlagWest, CreateGroup West];}]; // Heavy Gunner _FlagWest addAction ["Spawn Marksman", {"B_soldier_M_F" createUnit [getpos FlagWest, CreateGroup West];}]; // Marksman _FlagWest addAction ["Spawn Sharpshooter", {"B_Sharpshooter_F" createUnit [getpos FlagWest, CreateGroup West];}]; // Sharpshooter _FlagWest addAction ["Spawn Ammobearer", {"B_Soldier_A_F" createUnit [getpos FlagWest, CreateGroup West];}]; // Ammobearer _FlagWest addAction ["Spawn Medic", {"B_medic_F" createUnit [getpos FlagWest, CreateGroup West];}]; // Medic _FlagWest addAction ["Spawn Missle Specialist", {"B_Soldier_AT_F" createUnit [getpos FlagWest, CreateGroup West];}]; // Missle Specialist _FlagWest addAction ["Spawn Asst. Missle Specialist", {"B_Soldier_AAT_F" createUnit [getpos FlagWest, CreateGroup West];}]; // Asst. Missle Specialist _FlagWest addAction ["Spawn Asst. Gunner", {"B_support_AMG_F" createUnit [getpos FlagWest, CreateGroup West];}]; // Asst. Gunner _FlagWest addAction ["Spawn Gunner (HMG)", {"B_support_MG_F" createUnit [getpos FlagWest, CreateGroup West];}]; // Gunner (HMG) _FlagWest addAction ["Spawn Gunner (GMG)", {"B_support_GMG_F" createUnit [getpos FlagWest, CreateGroup West];}]; // Gunner (GMG) }; How could I create basically the same thing but have the unit join the player? Would the same syntax work with groups and vehicles? Thank you
  21. Having some issues with an AI Hunt/Stalk script that I created. The script uses the BIS_fnc_groupvehicles function to determine if the stalking group has a vehicle. However, I’m getting an error related to this function but I don’t know what I am doing wrong. The error I’m getting is: Steam Screenshot of Error (Bottom of Screen) Script:
  22. Having some issues with a loadout script I use in combination with the Vanilla Spawn AI Module. The script redresses and re-equips units with RHS equipment (in this case M16s) once they spawn. However, the script seems to create duplicate/multiple backpacks for units - the unused backpack is left to sit on the ground. The script is run in singleplayer. How can I fix this? Loadout Script: Edit: Changed how the script was called and that fixed the issue.
×