Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Command: Modern Combat Lua Script Error

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
bobhauk
How do I cheat?
Reputation: 0

Joined: 20 Feb 2024
Posts: 1

PostPosted: Tue Feb 20, 2024 11:14 pm    Post subject: Command: Modern Combat Lua Script Error Reply with quote

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?
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites