Jump to content

Nixx57

Member
  • Content Count

    21
  • Joined

  • Last visited

  • Medals

Everything posted by Nixx57

  1. Hi all I just wrote a "Generic" ambient combat script. This is my first script, and is open to the contribution. (maybe I'll create a git repository for it if it's necessary) I can also post a demo mission if you wish so. Why "Generic" ? : Because it generates vanilla units but also those of your installed mods. And it works on any mission (in theory). Introduction : This script can randomly generate any groups of any type (armoured, air, naval, infantry etc...) in an area around the players (like AmbientCombat module in A2) and create waypoints in an area of 500 meters around the players. For performance reasons, it is possible to limit the maximum number of groups easily. In short, this script is ideal for sandbox missions or test vehicles/weapons/mods elsewhere than in the virtual garage And, it work in SP and MP missions. How it work ? : - The script chosen randomly (without distinction) in the CfgGroups which group to generate. - If a "naval" type vehicle (submarine or boat) is in a group, the group spawn in the water. Others Random Features : Groups and units have : - Random skill (from 0 to 1, for each units in a group); - Random behaviour ("SAFE", "AWARE", "COMBAT", "STEALTH"); - Random formation - Yes, i love random 😁 Configurable settings: - Maximum group spawning distance - Maximum radius of waypoints around players - Maximum number of groups - Which sides would you like to spawn (BLUFOR, OPFOR, INDEPENDENT) - Interval between spawning - Show the number of active groups (in a "hint") - Disable groups that contain vehicles - Limit the size of groups - Use only specific groups (Only these groups will spawn) This is my first script, please bear with me 😅 Known Issues : - If the players are too far away from each other, some units may disappear. Possible solutions: 1) Create an instance of the script for each players, but may affect performance (lots of units). 2) Check to see if a player is within the radius of a group, but can prevent the spawning of a group near a distant player. Screenshot of spawn repartition (with default values) Credits : Thanks to "DayZ Medic" for base code in his video : EDIT 1: Add _DisableVehicles; EDIT 2: Add Limit Group Size; EDIT 3: Allow to use specific groups and waypoints area can be changed Code : Insert in init.sqf execVM "NixxGenericAC.sqf"; call bis_fnc_music; //if you want to listen cool musics :D (optional of course) NixxGenericAC.sqf : ////////////////////////////////////////////////////////////////////////////////////////////////////// // CONFIG // ////////////////////////////////////////////////////////////////////////////////////////////////////// _SpawnAreaAroundPlayers = 2000; //Maximum group spawning distance (default: 2000) _WaypointsArea = 500; //Maximum radius of waypoints around players (default: 500) _GroupsLimit = 12; //Maximum number of groups (default: 12) _SpawnBLUFOR = true; _SpawnOPFOR = true; //Which sides would you like to spawn (default: all true) _SpawnINDEPENDENT = true; _Interval = 30; //Interval between spawning (default: 30) _ShowActiveGroups = true; //Show the number of active groups (default: true) _DisableVehicles = false; //Delete groups that contain vehicles (default: false) _GroupSizeLimited = false; //Limit the size of groups (default: false) _GroupSizeMax = 4; //Maximum size of groups (require _GroupSizeLimited = true) _UseSpecificGroupBLUFOR = false; _UseSpecificGroupOPFOR = false; //Use only specific groups (Only these groups will spawn) _UseSpecificGroupINDEPENDENT = false; _SpecificGroupsBLUFOR = []; _SpecificGroupsOPFOR = []; //Only these groups (put CfgGroups) can spawn (require _UseSpecificXXXXXX = true) _SpecificGroupsINDEPENDENT = []; /* Specific Group Example: _SpecificGroupsBLUFOR = [ (configfile >> "CfgGroups" >> "West" >> "BLU_F" >> "Infantry" >> "BUS_InfSquad"), (configfile >> "CfgGroups" >> "West" >> "BLU_F" >> "Mechanized" >> "BUS_MechInfSquad"), (configfile >> "CfgGroups" >> "West" >> "BLU_F" >> "Armored" >> "BUS_TankPlatoon") ]; */ ////////////////////////////////////////////////////////////////////////////////////////////////////// // END CONFIG // ////////////////////////////////////////////////////////////////////////////////////////////////////// private _atSpawnedFnc = { _this setVariable ["isSpawned",true]; _this setBehaviour (selectRandom _Behaviour); _this setSpeedMode "NORMAL"; _this setCombatMode "RED"; _this setFormation (selectRandom _Formations); _this deleteGroupWhenEmpty true; { _randomNum = [0,1] call BIS_fnc_randomNum; _x setSkill _randomNum; } forEach units _this; }; private _RemoveVehicles = { _IndexArray = []; { _Group = _x; _Index = _ForEachIndex; { _unit = _x; _vehicle = (_unit >> "vehicle") call BIS_fnc_getCfgData; _vehicleType = (configFile >> "CfgVehicles" >> _vehicle >> "vehicleClass") call BIS_fnc_getCfgData; if (_vehicleType != "Men") then { _IndexArray pushBack _Index; diag_log format ["Group removed : %1", _this # _Index]; }; } forEach ("true" configClasses _x); } forEach _this; _IndexArrayIntersect = _IndexArray arrayIntersect _IndexArray; { _this set [_x, configNull]; } forEach _IndexArrayIntersect; _this = _this - [configNull]; diag_log _this; }; private _LimitGroupSize = { _IndexArray = []; { _Group = _x; _GroupCount = 0; { _GroupCount = _GroupCount + 1; } forEach ("true" configClasses _Group); diag_log format ["Count : %1 Group : %2",str count _Group, _Group]; _Index = _ForEachIndex; if(_GroupCount > _GroupSizeMax) then { _IndexArray pushBack _Index; diag_log format ["Group removed : %1", _this # _Index]; }; } forEach _this; { _this set [_x, configNull]; } forEach _IndexArray; _this = _this - [configNull]; diag_log _this; }; _groupsE = []; if(!_UseSpecificGroupOPFOR) then { { _faction = _x; { _type = _x; { _groupsE pushBack _x; } forEach ("true" configClasses _type); } forEach ("true" configClasses _faction); } forEach ("true" configClasses (configFile >> "CfgGroups" >> "East")); } else { _groupsE = _SpecificGroupsOPFOR; }; _groupsW = []; if(!_UseSpecificGroupBLUFOR) then { { _faction = _x; { _type = _x; { _groupsW pushBack _x; } forEach ("true" configClasses _type); } forEach ("true" configClasses _faction); } forEach ("true" configClasses (configFile >> "CfgGroups" >> "West")); } else { _groupsW = _SpecificGroupsBLUFOR; }; _groupsI = []; if(!_UseSpecificGroupINDEPENDENT) then { { _faction = _x; { _type = _x; { _groupsI pushBack _x; } forEach ("true" configClasses _type); } forEach ("true" configClasses _faction); } forEach ("true" configClasses (configFile >> "CfgGroups" >> "Indep")); } else { _groupsI = _SpecificGroupsINDEPENDENT; }; _Behaviour = [ "SAFE", "AWARE", "COMBAT", "STEALTH" ]; _Formations = [ "COLUMN", "STAG COLUMN", "WEDGE", "ECH LEFT", "ECH RIGHT", "VEE", "LINE", "FILE", "DIAMOND" ]; _Sides = []; if(_SpawnBLUFOR) then {_Sides pushBack BLUFOR}; if(_SpawnOPFOR) then {_Sides pushBack OPFOR}; if(_SpawnINDEPENDENT) then {_Sides pushBack INDEPENDENT}; if(_DisableVehicles) then {_GroupsW call _RemoveVehicles; _GroupsE call _RemoveVehicles; _GroupsI call _RemoveVehicles;}; if(_GroupSizeLimited) then {_GroupsW call _LimitGroupSize; _GroupsE call _LimitGroupSize; _GroupsI call _LimitGroupSize;}; _SpawnedGroups = 0; while {true} do { if (_SpawnedGroups < _GroupsLimit) then { _SelectedSide = selectRandom _Sides; _selectedPlayer = selectRandom allPlayers; _SpawnPos = [[[position _selectedPlayer, _SpawnAreaAroundPlayers]],["water"]] call BIS_fnc_randomPos; _SelectedGroup = nil; switch(_SelectedSide) do { case BLUFOR: { _SelectedGroup = _groupsW select (floor (random (count _groupsW))); }; case OPFOR: { _SelectedGroup = _groupsE select (floor (random (count _groupsE))); }; case INDEPENDENT: { _SelectedGroup = _groupsI select (floor (random (count _groupsI))); }; default {hint "Error : no side selected"}; }; if(!_DisableVehicles) then { { _vehicle = (_x >> "vehicle") call BIS_fnc_getCfgData; _vehicleType = (configFile >> "CfgVehicles" >> _vehicle >> "vehicleClass") call BIS_fnc_getCfgData; if (_vehicleType == "Ship" || _vehicleType == "Submarine") then { _SpawnPos = [[[position _selectedPlayer, _SpawnAreaAroundPlayers]],["ground"]] call BIS_fnc_randomPos; }; } forEach ("true" configClasses _SelectedGroup); }; _NewGroup = [_SpawnPos, _SelectedSide, _SelectedGroup] call BIS_fnc_spawnGroup; _NewGroup call _atSpawnedFnc; }; _SpawnedGroups = 0; { for "_i" from count waypoints _x - 1 to 0 step -1 do { deleteWaypoint [_x, _i]; }; _selectedPlayer = selectRandom allPlayers; _randomPos = [[[position _selectedPlayer, _WaypointsArea]],[]] call BIS_fnc_randomPos; _NewGroupWayPoint = _x addWaypoint [_randomPos, 0]; _NewGroupWayPoint setWaypointType "MOVE"; { if (_selectedPlayer distance _x > _SpawnAreaAroundPlayers) then { if(vehicle _x != _x) then { deleteVehicle objectParent _x; }; deleteVehicle _x; }; } forEach units _x; _SpawnedGroups = _SpawnedGroups + 1; } forEach (allGroups select {_x getVariable "isSpawned" && { alive _x } count units _x > 0}); if(_ShowActiveGroups) then {hint format ["Active groups = %1", _SpawnedGroups]}; sleep _Interval; };
  2. Hello everyone There you go, I just made my first mod and I want to change the way I interact with it. In short, my mod adds an action to players that opens a menu (menu that allows you to put on music and adjust the volume). And I would like to replace the action in the menu with a key press (pe :Use Action 20/User20 ). And if possible, add more (p.e : User19 = 0 fadeMusic (musicVolume + 0.1)). If I can do without the scripts file, so only the config.cpp would be cool considering the lightness of the code Unfortunately, I couldn't find any information on the wiki on how to use actions (in cpp) except for this page: inputAction/actions - Bohemia Interactive Community (bistudio.com) I thank you in advance ❤ The mod : https://steamcommunity.com/sharedfiles/filedetails/?id=2312443810 Currently my config.cpp is as follows: class CfgPatches { class Menu { units[] = {}; weapons[] = {}; requiredVersion = 0.1; requiredAddons[] = {}; }; }; class CfgVehicles { class All { class UserActions { class MusicMenu { displayName = "<t color='#FF0000'><img image='\a3\data_f_tank\images\upgradedaudio_ca.paa' size='1'/> Radio Box</t>"; displayNameDefault = "<img image='\a3\data_f_tank\images\upgradedaudio_ca.paa' size='3' />"; priority = -998; radius = 20; position = "camera"; showWindow = 0; hideOnUse = 0; onlyForPlayer = 1; condition = "this == vehicle player"; statement = "createDialog ""Menu_GUI"" "; }; }; } } #include "commonDefs.hpp" #include "dialog\MusicGUI.hpp"
  3. Hi all Need to pee during gunfight ? Or are you often disturbed? In short, you don't want to die a cowardly death? Install go_away_from_keyboard on your server ! Seriously : This script is inspired by the "Take a break" mode in Left 4 Dead, which is present in the pause menu. (in L4D, the name of the console command is go_away_from_keyboard, hence its name) Its purpose is to give control of the player to an AI if the player is AFK (after 30 or 60 seconds) or by simple menu action, or both. The player can retake control by pressing the "reload" key. There is no real way to give control to the AI while remaining the "player". With the exception of the Intro/Outro scenarios So I emulated that with a player change and a camera change. This is the beginning of a solution (functional as is) but has a drawback: If the bot (who control the player) is killed, it doesn't respawn, even after the return of the player, to overcome this, I had to "allowDamage false" (During all the time that the player will be a bot) until a viable solution. AI and mission creators may find their use in this script (to debug decision trees/FSM, for example) Credits : Thanks to tpw for basecode : Script to Check for Idle Player - ARMA 3 - MISSION EDITING & SCRIPTING - Bohemia Interactive Forums go_away_from_keyboard.sqf ////////////////////////////////////////////////////////////////////////////////////////////////////// // CONFIG // ////////////////////////////////////////////////////////////////////////////////////////////////////// //Activation Methode _ActivationByAction = true; _ActivationByIdle = true; _IdleTimeLimit = 60; ////////////////////////////////////////////////////////////////////////////////////////////////////// // END CONFIG // ////////////////////////////////////////////////////////////////////////////////////////////////////// time_to_idle = time + _IdleTimeLimit; (findDisplay 46) displayAddEventHandler ["keyDown", "_this call fnc_key"]; fnc_key = { time_to_idle = time + _IdleTimeLimit; }; fnc_idle = { _Player = _this; _Player setSkill 1; _Player allowDamage false; //the AIs does not respawn, if AI is dead, the respawn is broken (waiting for a solution) _FakeGroup = createGroup side _this; _FakePlayer = _FakeGroup createUnit ["VirtualCurator_F", position player, [], 0, "NONE"]; _FakePlayer allowDamage false; _FakePlayer attachTo [_Player, [0,0,0]]; //To avoid problems with scripts that use player position selectPlayer _FakePlayer; switchCamera _Player; _PlayerGroup = group _Player; _PlayerGroup onMapSingleClick "for '_i' from count waypoints _this - 1 to 0 step -1 do {deleteWaypoint [_this, _i];}; _this addWaypoint [_pos, 0]"; //On map click, set waypoints to yourself (move the bot) hint "Press 'Reload' button for retake control"; waitUntil{_FakePlayer attachTo [_Player, [0,0,0]];inputAction "reloadMagazine" > 0}; selectPlayer _Player; switchCamera _Player; _Player allowDamage true; deleteVehicle _FakePlayer; deleteGroup _FakeGroup; _PlayerGroup onMapSingleClick ""; }; if(_ActivationByAction) then { { _x addAction ["Go away from keyboard", {_this#1 call _this#3;}, fnc_idle]; } forEach allPlayers; }; if(_ActivationByIdle) then { while {true} do { if (time > time_to_idle) then { player call fnc_idle; time_to_idle = time + _IdleTimeLimit; }; sleep 5; }; }
  4. UPDATE : - Possibility to use specific groups - Maximum radius of waypoints around players can now be set Thank you dbun 🙂
  5. In summary, I want to keep this script as simple as possible to ensure maximum compatibility with other missions/scripts/mods while keeping good performance. Check the jandrews's post, you will find there your happiness.
  6. Yes, it's done (it was quick) Finally, this script may have a future 😅
  7. I think the old man will be James Gastovski, as it is shown in the video "memories of Malden". Well, that's what the video suggests to me, even if she is one year old
  8. Hello all I present today my first mission. Due to my knowledge limited in scripting, this mission was made in large majority with vanilla modules. Presentation: You are on the Malden Island, the 3 forces fight (indefinitely) for the control of the island and you have all the NATO's vehicles and virtual arsenal available. This mission is simply to make everything available in an atmosphere of capture of the island and especially to serve as a basis for real modders who wish to modify and improve it (And also to demonstrate that it is quite possible to do a lot with not much ) Features: -Staged at startup -Virtual Arsenal -BLUFOR Vehicle -Military Symbole -CAS Request -Transport Request -Ammo Request -Mobile Respawn -Artillery Request -Vanilla Revive System -Zeus (for Admin and Officer) -AI recruit (homemade script) -Air vehicles have a custom loadout Recently Added: -AI Recruit -USS Freedom and USS Liberty -Tanks's DLC (in base) NOTE: -There is no description file or initplayer/server, everything is included in the mission.sqm -The mission is updated regularly (AI adjustment, DLC vehicles, Air vehicles loadout…) -Description in the workshop not updated -I didn't translated the mission in english (marker) WORKSHOP LINK: https://steamcommunity.com/sharedfiles/filedetails/?id=1263824287 Thank you for giving your opinion and do not hesitate to give changes for those whose project interests, and make the mission more successful
  9. Hi all, some ideas : -Add function in virtual arsenal for use the default loadout from all units - Create a function for let the control of the player to AI temporarily, when he is AFK during mission/combat, or for AI Debug, i have this command on my server for emulate it : _noPlayer = createGroup sideLogic createUnit [ "C_VirtualCurator_F", [0,0,0], [], 0, "NONE" ]; selectPlayer _noPlayer ; switchcamera unit01 and, maybe in Tac-ops DLC, classic Warfare/CTI gamemode sorry for bad english
  10. Hello, I have the game with all its extensions, but I do not have the classic music in the game, would anyone have it a solution? thanks
  11. Hello all I have some questions and suggestions to developers (and players if you have the answer) 1) Is he expected in the future that the arsenal is equipped with predefined loadout (list of units like in the editor / Zeus, which should not be too difficult to include) rather than having to create a big list we almost never use 2) New official MPmissions / Gamemode planned ? Like classic Warfare/CTI (Already requested by the community it seems), coop, or new game mode (Zeus + players vs AI for example) And two stupid questions: 3) I think I know the answer but still raises the question : New vehicles of control mode ? (like the classic control of Arma:CWC, with the mouse to point the direction, particularly for aircraft) 4) During the game, it often happens that someone is AFK temporarily, there is a command for the AI take control of the character temporarily? (like Intro / Outro in editor) Thank you ;) P.S : Sorry if my english is bad =S
  12. Nobody has an idea? BIS never had the idea of implementing this function
  13. I look for the same thing. Simply give the control of the character to AI. And eventually be able to create her waypoints Even a simple command in the console would suit me
  14. Nixx57

    Controlled by AI

    Finally, it's a bit too hard for me. I am still a beginner who modifies existing script. You think that there is someone who would be interested in this project? There's there a heavy workload?
  15. Hello, I search the command (if it exists), to give the control of the player to ia​. Especially when some player become AFK on the server. in short, I want a "Sleep Mode", a script that the player or admin can execute. The only scripts that I found are "selectplayer" "selectnoplayer" but that's not what I'm looking. If it does not exist, is it possible to create it? ​thank you P.S : sorry for bad english ​ ​
  16. Nixx57

    Controlled by AI

    Thank you very much, I'll try it
  17. Nixx57

    Controlled by AI

    Yes, being a beginner in scripting it would help me a lot thank you, I'm not even sure of success
  18. Hi all, sorry, I cannot start a new topic, so i post here: I search the command (if it exists), to give the control of the player to ia​. Especially when some player become AFK on the server. in short, I want a "Sleep Mode", a script that the player or admin can execute. I searched in the list of commands in vain ​thank you in advance ​
  19. too, BIS will he go through it and give us hope? (sorry for my bad English)
  20. I would also like to know what game mode like others present on arma 2 He will return in a future update? EDIT : I especially expect the return of the ambiant combat module and SecOps
×