| bobhauk How do I cheat?
 
 ![]() Reputation: 0 
 Joined: 20 Feb 2024
 Posts: 1
 
 
 | 
			
				|  Posted: Tue Feb 20, 2024 11:14 pm    Post subject: Command: Modern Combat Lua Script Error |   |  
				| 
 |  
				| I am attempting to make a Lua script for Command: Modern Combat and using the following script: -- Define the number of units you want to create
 local numUnits = 5
 
 -- Loop to create the units
 for i = 1, numUnits do
 local unitDetails = {
 type = "AIR",          -- Type of unit (e.g., AIR, SHIP, SUB)
 unitname = "MyAirUnit" .. i,  -- Name of the unit (you can customize this)
 side = "BLUFOR",       -- Side name/GUID
 dbid = 1083,           -- Database ID of the unit
 base = "AB",           -- Base name/GUID where the unit will be hosted
 loadoutid = 11192,     -- Aircraft database loadout ID (applies to AIR)
 -- Other optional parameters:
 -- latitude = 0,       -- Latitude (not required if a base is defined)
 -- longitude = 0,      -- Longitude (not required if a base is defined)
 -- altitude = 10000,   -- Unit altitude (applies to AIR)
 -- orbit = 1,          -- Orbit index (applies to SATELLITE)
 guid = "AB" -- Optional custom GUID to override auto-generated one
 }
 
 ScreenEdit_AddUnit(unitDetails)
 end
 
 
 I get the following output and error:
 
 
 >> -- Define the number of units you want to create
 local numUnits = 5
 
 -- Loop to create the units
 for i = 1, numUnits do
 local unitDetails = {
 type = "AIR",          -- Type of unit (e.g., AIR, SHIP, SUB)
 unitname = "MyAirUnit" .. i,  -- Name of the unit (you can customize this)
 side = "BLUFOR",       -- Side name/GUID
 dbid = 1083,           -- Database ID of the unit
 base = "AB",           -- Base name/GUID where the unit will be hosted
 loadoutid = 11192,     -- Aircraft database loadout ID (applies to AIR)
 -- Other optional parameters:
 -- latitude = 0,       -- Latitude (not required if a base is defined)
 -- longitude = 0,      -- Longitude (not required if a base is defined)
 -- altitude = 10000,   -- Unit altitude (applies to AIR)
 -- orbit = 1,          -- Orbit index (applies to SATELLITE)
 guid = "AB" -- Optional custom GUID to override auto-generated one
 }
 
 ScreenEdit_AddUnit(unitDetails)
 end
 
 ERROR:  [string "Console"]:21: attempt to call a nil value (global 'ScreenEdit_AddUnit')
 
 Can someone please help me?
 |  |