EthanHeite 5 Posted July 11, 2023 Hey all I've been using chatGPT for awhile now but recently got more into it for scripting. I wish this would have been around years ago. I'm slowly teaching chatgpt how to do things starting with spawning things and then getting into more complicated things starting off simple stuff at first. I've actually got it to work a few times the first time on scripts and it was impressive. It can pretty much do anything for u in Arma3 as u want if u know how to ask it. My goal is to making mission editing easy with Chatgpt to make missions in minutes. What are your guy's thoughts about chatgpt in arma and scripting, have you tried it yet? 2 Share this post Link to post Share on other sites
zukov 490 Posted July 11, 2023 it works but you have to revision the entire code 1 Share this post Link to post Share on other sites
EthanHeite 5 Posted July 11, 2023 Quote it works but you have to revision the entire code Mostly correct, I'm still newbie of course dealing with scripting and ChatGPT, but if you ask chatGPT the right way you will get the right results. I'm going to keep working with chatgpt until i get the results i want, will take a lot of effort but in the end will be worth it because I will be able to make missions and scripting in minutes. Ya chatgpt is still new to the game, but it's evolution is powerful. Share this post Link to post Share on other sites
EthanHeite 5 Posted July 12, 2023 a successful script created by chatgpt: Quote // spawnEnemyAtMarker.sqf _markerPos = getMarkerPos "test"; _targetPos = getMarkerPos "target"; _enemy = createGroup east; _enemyUnit = _enemy createUnit ["O_Soldier_F", _markerPos, [], 0, "FORM"]; _enemyUnit doMove _targetPos; had an AI unit spawn at marker then moveto marker. yea this is basic stuff, but it's still impressive can do this. Obviously chatgpt will have a really hard time create advanced scripting for big complex missions and such but it is possible. It is even possible for chat gpt to get it right the 1st time everytime, it just depends on how u ask it to do something. Share this post Link to post Share on other sites
zukov 490 Posted July 12, 2023 the problem you have to positionining the units and the triggers by yourself by 3d editor and terrain Share this post Link to post Share on other sites
EthanHeite 5 Posted July 12, 2023 Quote the problem you have to positionining the units and the triggers by yourself by 3d editor and terrain Ya that's main issues i'm having with, trying to get it to understand things is the hardest part, but once chatgpt understands what u want it can output it perfectly. Sometimes it takes a paragraph or so to try to get the output, but worth it then creating part of the mission in editor u dont need to..... my goal with this whole thing is create missions on the fly. If i can get most of it done with chatgpt, that be fricken awesome hehe Update: I actually just created this script, chatgpt created it 1st time perfectly 3 tents spawned within a 50meter radius: (whoa) What I asked "sqf spawn me 3 tents at marker "test" within a 50 meter radius have the tents spawn at a random place inside the radius of the marker" What it output: Quote for "_i" from 1 to 3 do { private _position = getMarkerPos "test"; private _randomPosition = [_position, 0, 50, 0, 0, 0, 0] call BIS_fnc_findSafePos; private _tent = "Land_TentA_F" createVehicle _randomPosition; }; Update: The thing is to since OFP & Arma have been around forever at this point int terms of mission making, 80% of everything should already be made at least core wise and mostly functionality of most missions even within elements of other missions users have already made. It's perfectly acceptable to use other elements from other missions in your missions reason is why reinvent the wheel if u dont have to. Between all the mission asset generators and Zeus and other modules for the game and all elements already created within other missions and assets it should be fairly easy to make missions on the fly 1 Share this post Link to post Share on other sites
scottb613 284 Posted August 30, 2023 Hi Folks, Yep - it usually takes a little time - but if you keep feeding it your error messages - it seems to get there eventually. Script to Teleport AI Squad Members - to "unstick" them. // Define your AI squad's group _mySquad = units group player; // Change 'player' to the leader of your squad if needed // Loop through all units in the squad { _unit = _x; // Check if the unit is AI and a member of the squad if (!isPlayer _unit && _unit in _mySquad) then { // Calculate the distance between the player and the AI unit _distance = player distance _unit; // Check if the distance is greater than 75 meters if (_distance > 75) then { // Teleport the AI unit to a random location within 10 meters of the player _teleportPosition = player modelToWorld [10 * (random 2 - 1), 10 * (random 2 - 1), 0]; _unit setPos _teleportPosition; } } } forEach _mySquad; Works like a champ - all ChatGPT - on about the 3rd try - after feeding it thrown errors from previous iterations. At least it seems to get you in the ballpark - great for learning how to script - - - AND it comments the code. I use ChatGPT for Blender Python scripts as well. Regards, Scott Share this post Link to post Share on other sites
scrumpyjacks 10 Posted December 11, 2023 It's been 3 or more years since I've played Arma 3 but I have come back to continue working on a few scenarios. currently I'm trying to use ChatGPT to create a loot spawn script with the current result being Spoiler // Define a class for handling loot spawning LootSpawner = { private ["_modCivItems", "_modMilItems", "_baseCivItems", "_baseMilItems"]; // Constructor _spawner = _this + [self]; if (isServer) then { _modCivItems = []; _modMilItems = []; _baseCivItems = []; _baseMilItems = []; // Define arrays for different item types private _militaryWeapons = ["weap1", "weap2", ...]; private _civilianWeapons = ["civ_weap1", "civ_weap2", ...]; private _RHSUSAFmilitaryWeapons = ["rhs_weap1", "rhs_weap2", ...]; private _RHSUSAFcivilianWeapons = ["rhs_civ_weap1", "rhs_civ_weap2", ...]; private _RHSAFRFmilitaryWeapons = ["rhs_weap1", "rhs_weap2", ...]; private _RHSAFRFcivilianWeapons = ["rhs_civ_weap1", "rhs_civ_weap2", ...]; private _RHSGREFmilitaryWeapons = ["rhs_weap1", "rhs_weap2", ...]; private _RHSGREFcivilianWeapons = ["rhs_civ_weap1", "rhs_civ_weap2", ...]; private _RHSSAFmilitaryWeapons = ["rhs_weap1", "rhs_weap2", ...]; private _RHSSAFcivilianWeapons = ["rhs_civ_weap1", "rhs_civ_weap2", ...]; // Define other arrays for different item types and mods // Populate mod-specific arrays if (isClass (configFile >> "CfgPatches" >> "rhsusf")) then { _modMilItems = _RHSUSAFmilitaryWeapons; _modCivItems = _RHSUSAFcivilianWeapons; } else { if (isClass (configFile >> "CfgPatches" >> "rhsafrf")) then { _modMilItems = _RHSAFRFmilitaryWeapons; _modCivItems = _RHSAFRFcivilianWeapons; } else { if (isClass (configFile >> "CfgPatches" >> "rhsgref")) then { _modMilItems = _RHSGREFmilitaryWeapons; _modCivItems = _RHSGREFcivilianWeapons; } else { if (isClass (configFile >> "CfgPatches" >> "rhssaf")) then { _modMilItems = _RHSSAFmilitaryWeapons; _modCivItems = _RHSSAFcivilianWeapons; } else { _baseMilItems = _militaryWeapons; _baseCivItems = _civilianWeapons; // Add other base game arrays as needed } } } } self setVariable ["modMilItems", _modMilItems, true]; self setVariable ["modCivItems", _modCivItems, true]; self setVariable ["baseMilItems", _baseMilItems, true]; self setVariable ["baseCivItems", _baseCivItems, true]; }; // Method to spawn loot in buildings self spawnLoot = { private ["_buildingPos", "_lootType", "_randomIndex", "_spawnedItem", "_buildingType"]; _buildingCivClasses = compile preprocessFile "civilian_buildings.sqf"; _buildingMilClasses = compile preprocessFile "military_buildings.sqf"; // Loop through each building class { _buildingPos = _x select 1; // Debugging information diag_log format ["Checking building class: %1", typeName _x]; diag_log format ["Possible spawn positions: %1", _buildingPos]; // Example loot types (replace with your logic to determine loot types) _lootType = ["militaryWeapons", "civilianWeapons", ...]; // Randomly choose a position inside the building and loot type _randomIndex = floor(random(count _buildingPos)); _buildingPos = _buildingPos select _randomIndex; _randomIndex = floor(random(count _lootType)); _lootType = _lootType select _randomIndex; // Debugging information diag_log format ["Selected loot type: %1", _lootType]; diag_log format ["Selected spawn position: %1", _buildingPos]; // Check if mod-specific or base game loot should be spawned based on the building class and loaded mods _buildingType = typeName _x; if (_buildingType in _buildingMilClasses) then { if (isClass (configFile >> "CfgPatches" >> "rhsusf")) then { _spawnedItem = _spawner getVariable ["modMilItems", []] select _lootType; } else { _spawnedItem = _spawner getVariable ["baseMilItems", []] select _lootType; } } else { if (_buildingType in _buildingCivClasses) then { if (isClass (configFile >> "CfgPatches" >> "rhsusf")) then { _spawnedItem = _spawner getVariable ["modCivItems", []] select _lootType; } else { _spawnedItem = _spawner getVariable ["baseCivItems", []] select _lootType; } } } // Debugging information diag_log format ["Selected item for spawning: %1", _spawnedItem]; // Spawn the item at the selected building position // Use your own logic to spawn objects in buildings // Example: createVehicle [_spawnedItem, [_buildingPos select [0, 1, 2]], [], 0, "CAN_COLLIDE"]; // Add a marker on the player's map for debugging _markerName = format ["SpawnedItem_%1_%2", _x, time]; // Unique marker name _markerPos = _buildingPos select [0, 1, 2]; // Use the building position _markerType = "mil_dot"; _markerColor = "ColorRed"; _markerSize = 1; // Create the marker _marker = createMarker [_markerName, _markerPos]; _marker setMarkerType _markerType; _marker setMarkerColor _markerColor; _marker setMarkerSize _markerSize; } forEach (_buildingCivClasses + _buildingMilClasses); }; // Method to spawn loot around a player with a specified radius self spawnLootAroundPlayer = { private ["_player", "_radius", "_playerPos", "_lootType", "_randomIndex", "_spawnedItem"]; _player = _this select 0; _radius = _this select 1; // Get player position _playerPos = getPos _player; // Determine loot type based on your logic _lootType = ["militaryWeapons", "civilianWeapons", ...]; // Randomly choose a loot type _randomIndex = floor(random(count _lootType)); _lootType = _lootType select _randomIndex; // Debugging information diag_log format ["Selected loot type: %1", _lootType]; // Spawn the item around the player position // Example: createVehicle [_spawnedItem, [_playerPos select [0, 1] + [random _radius, random 360], 0], [], 0, "CAN_COLLIDE"]; }; // Method to set min/max number of items and positions self setSpawnLimits = { private ["_minItems", "_maxItems", "_minPositions", "_maxPositions"]; // Set your desired min/max values _minItems = 1; _maxItems = 3; _minPositions = 1; _maxPositions = 5; // Set the limits in the spawner object self setVariable ["minItems", _minItems, true]; self setVariable ["maxItems", _maxItems, true]; self setVariable ["minPositions", _minPositions, true]; self setVariable ["maxPositions", _maxPositions, true]; }; // Method to determine the chances of loot spawning in buildings self setSpawnChances = { private ["_chanceMilitary", "_chanceCivilian"]; // Set your desired chances (percentage values) _chanceMilitary = 50; // 50% chance for military loot _chanceCivilian = 75; // 75% chance for civilian loot // Set the chances in the spawner object self setVariable ["chanceMilitary", _chanceMilitary, true]; self setVariable ["chanceCivilian", _chanceCivilian, true]; }; // Method to spawn loot around all players self spawnLootAroundAllPlayers = { { _player = _x; _radius = 200; // Set your desired radius here self spawnLootAroundPlayer [_player, _radius]; // Spawn loot around each player } forEach allPlayers; }; }; // Usage example: LootSpawner call setSpawnLimits; LootSpawner call setSpawnChances; LootSpawner call spawnLoot; LootSpawner call spawnLootAroundAllPlayers; // This will automatically spawn loot around all players It has not been easy and I'm currently struggling to get ChatGPT to correct the follow section Spoiler // Check if mod-specific or base game loot should be spawned based on the building class and loaded mods _buildingType = typeName _x; if (_buildingType in _buildingMilClasses) then { if (isClass (configFile >> "CfgPatches" >> "rhsusf")) then { _spawnedItem = _spawner getVariable ["modMilItems", []] select _lootType; } else { _spawnedItem = _spawner getVariable ["baseMilItems", []] select _lootType; } } else { if (_buildingType in _buildingCivClasses) then { if (isClass (configFile >> "CfgPatches" >> "rhsusf")) then { _spawnedItem = _spawner getVariable ["modCivItems", []] select _lootType; } else { _spawnedItem = _spawner getVariable ["baseCivItems", []] select _lootType; } } } At this moment it won't correctly add the remaining RHS mods instead will just copy/paste what's already there. I have not yet checked if it works but ChatGPT has promised it will work once i fill in the arrays correctly. Share this post Link to post Share on other sites
pierremgi 4850 Posted December 11, 2023 Double pain: learning sqf commands and functions, learning chatGPT! 1 Share this post Link to post Share on other sites
Harzach 2517 Posted March 16 19 hours ago, Kathlyn said: And it's great for writing totally natural-sounding responses to forum posts! Cool! 1 1 1 Share this post Link to post Share on other sites
Northup 17 Posted March 16 It certainly helps bridge the curiosity gap that would otherwise compel some to give up, but it has way too many issues to be reliable. It invents commands that don't exist, and will then gaslight you about their existence. It has trouble understanding more of the convoluted ways Arma works under the hood. Like anything, it does a lot better if you do things in very small segments with lots of logging. It will insist your defined variable lack of capitalization is the issue, especially when it isn't. 1 Share this post Link to post Share on other sites