-
Notifications
You must be signed in to change notification settings - Fork 24
Your First Custom Engines
- A text editor better than Notepad (Such as Visual Studio Code or Notepad++)
- Barebones knowledge of Lua (the ability to edit tables)
- In your Garry's Mod addons folder, create a folder with the name of your addon
- Within this folder, create the following folder structure:
lua/acf/shared/engines/
- all lua files relating to your engines will go in here - In the folder created above, create a new
.lua
file with the name of your engine type, such ascustom-v8.lua
. Keep in mind, it can NOT share the same name as any of the existing ACE engine files, which you can find inACE/lua/acf/shared/engines/
Here is an example of an engine definition, this is what would go in the file created above
ACF_DefineEngine( "6.9-V8", {
name = "6.9L Nice V8 Petrol",
desc = "A very NICE looking V8",
model = "models/engines/v8m.mdl",
sound = "acf_engines/b6_petrolsmall.wav",
category = "V8",
fuel = "Petrol",
requiresfuel = false,
enginetype = "GenericPetrol",
--torquecurve = {0.3, 0.55, 0.7, 0.85, 1, 0.9, 0.7},
weight = 100,
torque = 200,
flywheelmass = 0.1,
idlerpm = 750,
limitrpm = 6969
} )
Let's go through it line by line
- In
ACF_DefineEngine
, first we define the ID, which is generally the cylinder size and the engine type. In this case,6.9-V8
- name, desc, model, and sound are self-explanatory
- Category is what section it should appear in in the ACE menu
- Fuel type can be either
Petrol
,Diesel
,Electric
, orMultifuel
- If
requiresfuel
is true, the engine must be connected to a fuel tank to run - Engine type can be either
GenericPetrol
,GenericDiesel
,Turbine
,Wankel
,Radial
,Electric
, or your own custom type. If the engine type does not exist, it will error and not show up in-game - Torque curve is optional (can be uncommented), it defines the region where the engine produces the most torque. If it is commented or not defined, it will use a generic torque curve for the selected engine type. You can use this Starfall chip to preview what your torque curve will look like
- Weight is in kilograms, torque is in newton-meters
- Flywheel mass unit is unknown, reference other ACE engine files for comparison. This affects the resistance to rotation of the engine - a heavier flywheel will take longer to spin up, a lighter flywheel will accelerate up to high RPM faster
- IdleRPM and LimitRPM (aka redline) are self-explanatory
You can have as many of the above blocks as you need, one for reach engine you're defining in the file. It is recommended to keep engine types separated by file, for example having only V8s in your custom-v8.lua
and only V6s in custom-v6.lua
for example. If you are unsure if you're going to be conflicting with an existing file, you can just name it the same as your addon, like my-cool-engine-pack.lua
.
Now that you've created your engine definition file, launch GMod and load into a singleplayer game. Open the ACE menu, go to the engines section, and open the category you've placed your engine into. You should see every engine you defined in the definition file. Spawn them and check to make sure they don't create any errors when they're turned on. If they all work, you're ready to publish your extension.
If you want to publish your engines to the workshop for others to use, you can use gmpublisher. This is not a guide on how to create addons, so here is the short version:
- In gmpublisher, press
Publish New...
- Select an image to represent your addon on the top left
- Select the path to your custom engine addon's folder (the one containing
lua
) - Fill out the remaining fields and hit
Publish!
- Go to your steam workshop, fill out the addon description and other information, and set visibility to
Public
- ACE Official Rules
- Fixing Common Issues
- Incompatible Addons
- Console Commands List
- History Of The Project
Guns
Missiles (& Bombs)
Mobility
Special
Gameplay features
Documentation