Informations for Developers
Developers
This part onwards is designed for developers, mainly those who create vehicles or anyone interested in learning more about how Smart Vehicle works.
You'll have to make changes to vehicles to make them work with Smart Vehicle but once you've got the hang of it, it shouldn't be too difficult.
How it works
We experimented lots around vehicle movement, especially fire trucks and you may have seen the popular single player mod that has achieved this, by moving vehicle parts. (Vehicle Gadgets +). We weren't able to achieve this method in FiveM, due to it utilising memory editing, something we currently don't have access to within the FiveM project and native functions.
Therefore, we've had to find another solution and whilst this might not be perfect, it's the best we have achieved right now.
Our solution uses props and although it sounds easy, configuring it is actually quite complex. This documentation will show you how to easily split your vehicle down into parts and then export them as props. Most vehicle developers already know how to do this, but the documentation is important if you want to know how to then create a vehicle data file to give to a customer, should you wish to sell vehicles that are compatible.
Developer copy
As a vehicle developer, you may be eligible to a free limited, development copy of the resource, This will avoid you having to purchase the resource in order to simply setup your vehicles with the resource, to sell to customers.
Your customers however will still need to purchase one copy of the resource, which only needs to be done once and can work with as many vehicles as possible. It is a small price to pay for customers in comparison to the cost of some vehicles, which can be almost double the price of this resource, so we've kept it affordable as we recognise it is something additional that your customers will need to purchase.
Software
You can use any software that you like, however we recommend using ZMod. 3DSMax also works however and you may find it easier.
Our support team aren't familiar with any of these softwares currently, but we are looking to have a designated person to provide assistance with this after release of the resource. You should join our Discord for more information on this.
Ladder Props - ZModeler3
This documentation is only intended for developers with prior knowledge of ZModeler3, including material setup, dummy placement and other skills. This documentation is not designed to teach you how to use ZMod and you should not treat it as such.
This documentation was created by H.Ash, part of Alien Modding.
The vehicle featured in this documentation is the one included in the resource.
This documentation assumes you know how to make a custom .ytyp using PropsEditor or AddonProps editor. If not, please follow the tutorials that come with those programs. It also assumes that you will be using embedded textures and know how to set these up in ZMod. Alternatively, you should know how to setup a .ytd (texture dictionary).
Ladder_seat: Firstly, import your first ladder model into ZMod, splitting by materials. Ideally, this is the area where the control seat is, that spins around. The turntable.
Set up your materials accordingly, I used the normal_spec shader mostly, but also some of the decal materials too. The choice is yours. These are coming out of ZMod as a .ydr prop files, so you cannot use vehicle shaders. See below for the available material shaders that you can use with props.
Then, attach all the material meshes that are in the hierarchy into one mesh, using the Attach tool. Create a new dummy with the dummy helper tool a the top. This should spawn in the middle of the viewport. Name it “ladder_seat” You then need to move the mesh so that the newly created dummy is where it will rotate from (i.e. the centre of the turntable mesh) See picture below.
Having done this, drag the mesh into the dummy in the hierarchy (not compounding it), so that the mesh is the child of the dummy. Compound the mesh to L0, not to the dummy, by toggling on L0, then Convert to Compound, and then the padlock symbol. This will make your mesh name (which should be “.mesh”) in the hierarchy appear bold. Your hierarchy should look like this:
Following this, right click on the mesh in the hierarchy, go to Axes, then “Reset to Parent”. This will move the axes to where the parent dummy is, and therefore specify where the rotation point will be. (The mesh will rotate around this point). This is crucial and may require testing in game to ascertain the exact point. Use Menyoo to spawn in your prop and rotate it to see if it rotates around where it should.
When doing the collisions for this ladder piece, they do not need to be nail on accurate, but just a rough mock up of the mesh, much like how a chassis collision looks when making vehicles. Set your collision mesh to Default Material and Convert to Compound much like how you did with L0, only this time use COL instead. The collision mesh needs to be named “.[COL]”. This applies to all ladder pieces.
Export as a .ydr, noting down the bbmin, bbmax, bbcentre and bsradius values, so that you can plug these into a YTYP creator later on, so that you can actually spawn these props in.
Ladder_base: This is the ladder piece that moves up and down, and has all the other ladder pieces within it.
Make a new ZMod file.
Import your first ladder piece’s mesh, splitting by materials, and set up your materials accordingly in the browser, as set out in the beginning of this documentation.
Again, spawn in a new dummy using the dummy helper, and name it “ladder_base”. Attach your material meshes together and place the one mesh you are left with as a child of the ladder_base dummy. Convert to Compound L0.
This time, you are going to want to move the mesh so that the ladder_base dummy is where it rotates up/down from. See below for the dummy placement of the released ladder’s piece:
Again, reset the mesh’s axes to parent, and export as a .ydr, noting down the values so you can accurately create the YTYP later.
For the collision, make a mesh that lines up with the base and sides of the ladder piece. This will allow you to walk on it in game if you so wish to do so. Picture below.
Ladder_outer Ladder_middle Ladder_inner (And any more extending pieces):
These are the ladder pieces that actually move, and sit within the ladder_base piece when the vehicle is not extended/in use.
The process for setting all these three is the same. You will still need a new ZMod file for each, as you are creating them as individual props.
Import the mesh, set up materials as before. Create your new dummy, start with “ladder_outer”. This is the first extending piece, the second biggest ladder piece after ladder_base. The script is written so that this is the last piece to move. Place the mesh in the centre of the viewport, with the bottom edge lining up with the x axis in ZMod. This does not need to be perfect. Having attached all the material meshes together, and placed “.mesh” as a child of “ladder_outer”, Reset the Axes to Parent, and export, again noting bb values.
Repeat this for all extending ladder pieces. The vehicle released with the script has three extending pieces, but the config file allows for as many as you need.
For the collisions, make a mesh that lines up with the base and sides of the ladder pieces. See the picture above in the ladder_base section.
Export each individually as .ydrs. If you are making a “stick” ladder, this is your ZMod experience complete.
Ladder_end_piece:
This is the ladder piece that folds down at the end of a turntable ladder. I realise that not all aerials have these, especially not in the USA. If you are making an Aerial Ladder Platform/Hydraulic Platform (ALP/HP), it is likely you will need this piece. If you are making a Turntable Ladder (TL), such as the one released with the SmartLadder script, you may need this. It is the small piece on the end, attached to “ladder_inner” (the smallest extending piece), and is the piece that the cage/bucket attaches to.
The ladder that is released with the script is a Metz L32A XS, commonly used in Europe. This ladder_end_piece on the real-life model, and with the script, does not extend, but rather rotates up/down, a little bit like ladder_base. This allows the vehicle to be able to reach over roof gables, and below grade.
For an better way of explaining it, go and try it in game with the released model, using the arrow keys to control it.
Import your model of this (if required), set up materials etc, the dummy etc.
Move the mesh so that the dummy is where the piece rotates from. This may not be the end of the mesh, as is the case with this one. Try and find a video of your ladder working in real life to ascertain where this needs to be.
Reset Axes to Parent
Follow all steps written before when it comes to creating collisions for this, as well as child/parent setups and exporting.
Ladder_cage: The cage (or bucket) is where the player can be attached to using /entercage in game. It rotates, so again, positioning the mesh so that the dummy is in the right place is crucial.
Import your mesh, setup materials as applicable. Spawn in your dummy, name it “ladder_cage”.
Attach all material meshes and rename to .mesh, and move it so that the dummy you just created is the point where the cage roates around. Picture below of the setup for the released ladder:
It is in the bottom corner as that is where it attaches to the ladder_end_piece mesh, and therefore the rotation point.
Place the .mesh as a child of the ladder_cage dummy in the hierarchy if you haven’t already, and reset the .mesh’s Axes to Parent.
Create a collision that is a hollow box, with no top or back. Here is what the released ladder’s looks like:
It has no back piece so that the player can walk in and out of it should they wish to do so in game.
Outriggers: These are the pieces that extend outwards from the truck to enable stability. Controlled by PageUp with the script.
Whilst most trucks have many, you only need one outrigger mesh (presuming they are all the same), as the script will duplicate them once you set the offset points in game. (Read the other parts of the documentation about setting your config for this detail).
Import your mesh, set up your materials, spawn a dummy, call it “outrigger”. Attach all material meshes, rename to .mesh as before, and move it so that the dummy is roughly in the centre of the mesh. It should look something not too dissimilar to this:
Note, the feet that often extend downwards of the outriggers are a separate prop. More on that below.
Make your collision mesh, roughly the same shape as the .mesh. Compound and so on. Same as before.
Outrigger feet: These are the small plates that extend downwards from the outriggers, once the outrigger has extended outwards.
Once again, import your mesh, set up your materials, spawn in the dummy, name it “foot”. Attach material meshes together, and rename to .mesh. Place this mesh in the centre of the viewport, Reset to Parent and so on. All as before.
Collision file should be the rough shape again. Here is what the released ladder’s outrigger feet look like in ZMod:
Export as .ydr, noting bb values.
Conclusion: That is it, that is instructions for how to make the props you need for the script. You do not need to make all of them, as we realise not all aerials have the same pieces doing the same thing. Important things to remember:
Split by materials when importing (this is the easiest way)
Props have to be one mesh, and cannot exceed 64k polys
You can only use prop materials, not weapon nor vehicle ones.
Once attached, you must name the mesh “.mesh” and the collision “.[COL]”
The parent dummy must be where the mesh is expected to rotate from. This is crucially important for ladder_seat, ladder_base, ladder_end_piece and ladder_cage.
The .mesh must be a child of the “ladder_x” dummy.
You must remember to do “Reset to Parent” for the axes of the .mesh, so that the mesh actually rotates around the “ladder_x” dummy.
The .[COL] must be in the same place as the .mesh
Remember to save individual props as individual .z3d files, this gives you the easiest way of editing them should they need it.
Remember to add “.ydr” onto the end of the name when exporting, otherwise ZMod will export as a “.yft”
After all this is done, this is roughly what your folder should look like:
YTYP Creation: As these are all custom/addon props, you will need to create a .ytyp file, which tells the game that these props exist and what they are called, as well as other values.
We recommend using this software to create YTYP files: https://www.gta5-mods.com/tools/addonprops
If you have any further queries with this, reach out to us and we may be able to assist. Additionally, a quick google produces several guides on YTYP creation. Don't forget to add it as a data_file declaration in your fxmanifest.lua and also as a file {} in the manifest file.
Good luck, and enjoy using this script to its full potential!
Getting offset & rotation values
This documentation was created for vehicle developers. If you do not have sufficient knowledge, you will struggle to understand this.
In order to successfully setup your working ladder props, you will need to find out where they should sit in relation to each other, as well as in relation to the base chassis. The following parts of the documentation assume you have successfully followed the previous parts on creating each prop, and have created a YTYP. Don’t try and follow the next parts without this.
To do this, you will need Menyoo (or a similar trainer) where you can spawn props in, move them around and attach props to each other.
Installing MenYoo
You'll firstly need ScriptHookV enabled on your server. We don't recommend enabling this on a public server, so you should set this up on a localhost or development server.
You can download menyoo here. After downloading, you should watch this video here on installing it into your FiveM application data folder.
Default Values
Go into game. Use Menyoo in either FiveM or single player GTAV. Ideally go a large open flat space in game as you may need some space to extend the props.
Open Menyoo, and open the object spooner mode using F9. This will put you into a slightly different viewport than the standard game camera, and give the ability to use a fly around camera. If it won't let you open the object spooner, press F8 a few times first to open the main menu, then close it again.
You can watch a video here on using the Object Spooner, found within menyoo. Another video found here also shows you the basics.
Press F to open the Spooner Menu. Go to “Spawn Entity into World – Object – then up arrow key to jump the bottom, where you hit enter on “Input Model”. Enter “ladder_seat” to spawn in your first prop.
Go back to the first page of the menu, and go to “Manage Entity Database”. Scroll down to “ladder_seat”, and then all the way to the bottom, to “Attachment Options”. Hit “Attach to Something”, and scroll to the vehicle you have spawned in:
For me, this is “surreyalp” as that is the vehicle spawn name. Once you have done this, it should look something like this:
From here, you need to adjust, the X, Y and Z values in the menu, until the prop is located where it should be on the vehicle. For me, it looks like this with these values:
NOTE DOWN THESE VALUES IN A DOCUMENT OR SPREADSHEET.
You will need these values to put into the config file that you have with your model files.
For the next piece (ladder_base), spawn it in, follow all previous steps to spawn it in and then to back to “Manage Entity Database”, except attach it to “ladder_seat” this time not to the vehicle itself. Again, you will need to move the X, Y and Z values so that it is positioned correctly. You should end up with something similar to this:
As you can see, my ladder_base piece is the new grey piece that has appeared with the text on it.
For the “ladder_outer”, “ladder_middle”, “ladder_inner” and any other extending pieces you may have, follow all steps as before about spawning in, but attach the piece you have just spawned to the previous piece. (i.e. ladder_inner attaches to ladder_middle), which in turn attaches to ladder_outer, which you’ve attached to ladder_base). Again, note down the XYZ values somewhere. You should end up with all three pieces sat where they would sit when the ladder is not extended/when it is driving around:
After this, you will need to attach your “ladder_end_piece”, should you have one. Same process as before. Spawn, attach to “ladder_inner”, and move the XYZ values until it is positioned in the right place.
After this, spawn your cage/bucket prop in, manage entity database, attach the “ladder_cage” (if applicable) to ladder_end_piece, and you will have completed setting up the ladder pieces.
Make sure to note down XYZ values for each prop, as this is the whole purpose of this part of the vehicle setup, so that you can put these into the .lua file, so that the script controls your vehicle correctly.
For the outriggers, spawn in your outrigger prop, attach this to the base vehicle, not to another prop, and move it to where it sits when you are driving around. You will need to note a rotation value too, as on one side, your outriggers are going to be flipped (the likely value will be -180.00). See below:
Move the outrigger prop to each location on the vehicle where there is an outrigger (you can do this with one prop as the script will spawn it in four times later), and note the values for each location.
For the feet, again you only need to spawn one in. Attach it to the outrigger prop, move it to where it sits when driving, and then note down these values. Again, the script will spawn it in four times. The values will be the same (assuming your outrigger models are all the same) for each corner of the vehicle because it is attaching to the outrigger prop not offsetting from the centre of the vehicle.
This concludes the process of getting the default values.
Maximum Values
The next stage is to ascertain the maximum offset/rotation values (i.e. the maximum distance from the base position that a given ladder piece extends or rotates).
To do this, start with ladder_base (as ladder_seat is likely to rotate 360⁰), and rotate it upwards to its maximum point. Often with ladders this will be around 80⁰, as most do not point straight upwards. For me, it is 84⁰. Your screen should look something like this now:
For ladder_base, the crucial value to note is the new “Pitch” value you have, as it is a rotating piece. For ladder_outer, _middle and _inner, and other extending pieces, you will likely be changing the Y value, and therefore that is the crucial new one to note as the under “maxOffSet” value. When you have moved each piece (taking care to do them in order, as then it will move the next piece with it), your screen should look something comparable to this:
Ideally, it will look like what the ladder looks like at full extension. N.B. the script doesn’t toggle between full extension and no extension, but rather you can move the pieces to whatever height and angle you want. This is just to obtain the maximum values.
For ladder_end_piece, it may be a rotating piece, as will ladder_cage. Therefore, rotate these to their maximum extent and note down the new Pitch value again.
For the outriggers, you will be moving these along the X axis, so move them on that until they get to their fullest reach, and note down the new X value.
With the outrigger feet, you will be moving these on the Z axis, so again, move their fullest extend or until they touch the ground, and note down your new Z value.
Completed
That is it, you have got all the relevant information to put into your config file so that the script controls your vehicle correctly. We promise everything you need to know is contained within this documentation, so please make sure you go over it numerous times if you have an issue before contacting our Support Team.
Important things to note:
You attach the ladder_seat and outrigger props to the base vehicle. The rest of the props attach to the previous one, and the feet to the outrigger.
Use your base 3d model before convert or pictures of the vehicle in real life to make sure you have placed the props correctly in relation to the vehicle and each other.
When finding the maximum offset values, use pictures and or videos, or documents of your vehicle in real life in order to ascertain how far each prop moves, and whether it rotates or extends.
See the picture below to understand how I noted everything down when it comes to the props, including the bb values when exporting from ZMod, as well as all the offset values:
Data File Creation
This documentation is designed for vehicle developers and you should have relevant experience in this area.
If you've got to this part, your vehicle should now be ready to create a data file. You should have:
Your base vehicle (with no attached parts, such as ladders)
All moveable parts exported separately as props
Default offset & rotation values for all props recorded
Maxmum offset & rotation values for all props recorded
Throughout this document we will refer to the included fire truck and the data file that enables it to work with Smart Ladder. As this vehicle is fully setup, it should provide a good starting point and reference for setting up your own vehicles with the resource.
Creating vehicle data files for use with Smart Ladder may at first appear confusing, but once you've read this and started doing it yourself, you'll soon get the hang of it.
Trailer Setup
Some vehicle creators have chosen to setup Smart Ladder as a trailer vehicle. To enable this, we have added code which informs the resource that the vehicle is a trailer, preventing it flipping out of control.
To enable this, just add a new line in the vehicle data file named isTrailer = true.
Data File Creation
Throughout this documentation, you should have the firetruk.lua file open in the vehicles folder in order to refer to it.
All data files begin with the name of the vehicle, such as firetruk surrounded in brackets. At the bottom of the file, we use the addVehicle(vehicleName) function to add the data to the SmartLadder resource.
You can likely create multiple vehicle files by cloning an existing one and just making changes. This ensures you have the structure the same, as often fire vehicles are very similar.
There are several configuration values which are relevant, but we'll go through later. These three at the start though should be completed now:
Here you should add the model of the fire truck, surrounded by this symbol: `` . You can set the name of the fire truck to anything you like, this is just a reference for the vehicle as we plan to add logging in the future.
The controlToOperate value is the key that a user will press to start controlling the vehicle. By default, this is X but you can use the controls list found on the FiveM documentation here to change it.
You should set the number to the control index and the string next to it is the name of the control, taken from the FiveM control list documentation.
Here's an example for the key D, you should set the number to 9 and the string to "INPUT_VEH_DUCK".
You have now successfully changed the key to operate the vehicle. We'll now move onto setting up the props, the more complicated part.
Disable Outside Control
We've added the option for you to disable outside control of the vehicle, meaning a player will no longer be able to control the vehicle without being in the driver seat. This is perfect for construction vehicles where it would make no sense for the vehicle to be controlled by anyone not driving it!
To disable outside control, add the following line to the data file:
Please note that if you have disabled outside control, you will need to setup controlling while driving, as set out in the section below.
Control while driving
We've added the ability for you to allow vehicles to be controlled whilst a player is driving. This is perfect for making construction vehicles and other types which require parts to move whilst driving.
To allow a vehicle to be controlled whilst driving, add the following line to the data file:
Whilst a player is driving a setup smart vehicle, they can press the control key to begin controlling the vehicle whilst driving. Please note, a player is unable to leave the vehicle until they stop controlling the vehicle and a message will be displayed to show this if they attempt to do so.
Data Entries
For this next part, you'll need to navigate to the data = {
section of the vehicle data file. This is where we'll define all of the props that need to be installed on the vehicle and the position in which that should be done. You'll also define the control for moving each prop and the way in which it should move, along with the maximum and minimum off set and rotation values.
The data section is essentially a table of data entries. Each entry is wrapped in brackets: {}.
Every moveable part of the vehicle needs a data entry. For example, on our released ladder as part of this resource, we have the following data entries:
Ladder Seat - this rotates left and right
Ladder Base- this rotates up and down
Ladder Outer - this is the external ladder
Ladder Middle - this is the middle ladder
Ladder Inner - this is the internal ladder
Ladder End Piece - this is the rotating end of the ladder
Cage - this is the cage at the end that rotates
Outrigger 1 - This is the first outrigger
Outrigger 2 - This is the second outrigger
Outrigger 3 - This is the third outrigger
Outrigger 4 - This is the fourth outrigger
Foot1 - This is the first foot
Foot 2 - This is the second foot
Foot 3 - This is the third foot
Foot 4 - This is the fourth foot
As you can see this one vehicle needs a large amount of data entries to successfully operate with SmartLadder and hopefully gives you an idea of what a data entry is. For example, even though the outriggers are using the exact same prop name, as they are all in different positions on the vehicle, they all need their own data entry. Setting all their controls to the same is the key factor that allows them all to move at the same time, which we'll discuss in more detail throughout this documentation.
A data entry
Each data entry needs a number of core values, we'll go through them one by one and tell you what it is for and how you can set it.
ID
The ID (id = "LadderSeat",
) value must be unique for this data entry. This can be anything that identifies that prop, for example we've set the first one to "LadderSeat". ID's are used throughout the data section.
For example, if you want another prop to attach to the LadderSeat prop, you'll need to reference the LadderSeat data entry ID later. We'll go into more detail on this though.
Model
The model value is the model of the prop. This doesn't need to be unique, so if you have four data entries for four outriggers, they can all use the same model name and it will work perfectly fine. Just make sure your model is wrapped in this symbol: ``, as this ensures runtime hashing and improved efficiency.
This should be the name of one of your addon props that you created earlier and exported from either ZModeler3 or another software.
isLadder Property
This is a simple true or false and determines whether the data entry is a ladder. For our base vehicle, we setup the three ladders next to each other as a data entry and enabled this for all three.
The reason we have a separate isLadder property is because ladders move differently to other props. For example, you press one control to move all outriggers at once (and their data entries have the same control value, allowing this). With a ladder though, we don't want them to move at the same time, but instead one by one.
If you want them all to move at the same time, you should be good to disable this as some american fire trucks work in this way, allowing a faster extension of the ladder.
Remember that you need a separate data entry for each ladder. For our base vehicle we have Ladder Outer, Ladder Inner and Ladder Middle. All three have the isLadder property set to true, meaning that they don't all extend at the same time.
attachTo Property
This configuration value is very important and makes use of ID's for data values.
Essentially, this defines where you want the current data entry/moveable prop to attach to. You have the option of choosing another data entry and entering the ID of it here, or using the term "vehicle", which will attach it to the vehicle.
For example, in the LadderSeat data entry, we have the following attachTo property:
This is because the ladder seat needs to attach to the vehicle and rotate.
If we look at the next data entry for our included vehicle, it has a different attachTo property:
Instead of using "vehicle", we are using "LadderSeat" which is the ID of the ladder seat prop. This will attach the ladder base prop to the ladder seat prop.
This is essentially how it works throughout. For example, for all four outriggers, you'll want them to attach to the vehicle, so you can set it to "vehicle". In contrast, for the cage, you'll want that to either attach to the end of the ladder or a ladder end piece, so you'll find the ID for that data value and enter it here.
Whilst this may seem complex, once you try it in-game, you should soon have the hang of it. You can always test the vehicle out in-game as you go along, adding a data entry then restarting the resource and trying it out to see if your changes worked.
If you need assistance with this, our support team may be able to help, although they have limited experience in vehicle creation. We are seeking to have a team just for assisting with the SmartLadder resource.
Default Offset
By this point, you should already have the default offset for the data point. This is the offset that it will attach to, relative to the prop/vehicle it is attaching to.
You should enter this value that you obtained earlier using a menu such as menyoo into both the defaultOffSet and the offSet values.
In this example, the ladder base will attach to the ladder seat with an offSet of 0.0 left/right, -2.0 forwards/backwards and 1.17 up/down.
{Left/Right, Forward/Backwards, Up/Down}
This is the format used and we'll talk more about this later when we start configuring the movement of these props and data entries.
Default Rotation
This is exactly the same as the default offSet, except this is for rotation. You should have already obtained this value earlier using a menu such as menyoo.
{X, Y, Z}
This allows you to rotate the pitch, yaw and roll properties of the data entry. For our ladder base, we wanted the same rotation as the ladder seat when it attaches, as it sits just ontop of it so we set the rotation to 0 for all three values.
Minimum/Maximum Rotation
This allows you to set a minimum/maximum rotation value for the prop. You can set both or just a minimum/maximum or no limits at all.
For example, with our cage data entry, we don't want it to be rotated a full 360 degrees as it would collide with the ladder, so we gather the rotations needed and then set the maximum/minimum values in the data entry.
At the top of the configuration file, you can enable the following value to draw the rotation on the screen, this can assist in perfecting the maximum/minimum values:
Here is the maximum and minimum rotation values for the cage:
As you can see, if you want a minimum rotation, you'll need to enable minRotation. This is the same if you want a maximum rotation, you'll need to enable maxRotation and then set the values for both.
Minimum/Maximum Offset
This allows you to set a minimum/maximum offset value for the prop. You can set both or just a minimum/maximum or no limits at all.
For example, with the ladders we only want them to be extended as far as the prop or even the outriggers should only be extended as far as they are visible with the vehicle. This is why a minimum and maximum value is important.
As the cage doesn't move, we don't need off set maximum/minimum values like we did for the previous example. Therefore, we'll use Ladder Outer instead to showcase this:
As you can see, if you want to set a minimum offSet value, you'll need to enable minOffSet and the same for a maximum offset, setting maxOffSet to true.
Controls
This is where we'll define which controls move the prop and in which way. A single control can either rotate the prop or move it (changing the offset).
Multiple data entries can use the same control, this is how all four outriggers are able to move at the same time. By setting them all to the same control, the script is able to do that.
To begin, you'll need to choose a control from the FiveM controls list here. You'll need to find the control index of the key you want.
For example, the control D has an index of 9. You may find multiple indexes of the same control, just try the first one and if it doesn't work, you have others to also try.
You will need to create or navigate to the controls = {
section of the data entry.
For reference purposes, we'll use the OuterLadder data entry as an example, looking at the controls in place for it.
You must firstly enter the control index in square brackets: [Control Index] = {}
Dual Controls
Some complex Smart Ladder vehicles may have 20+ moveable parts, all of which could require their own unique keybind to operate. For this reason, we have added dual controls to allow you to require a user to press two keys at once before allowing a certain movement or rotation.
To setup a new dual control, add a new control as normal (such as the one above). Next, inside the control table, you'll need to add a new value secondaryControl:
As you can see, the main control for this code block is 63 (which is A), however the secondaryControl has been set to 26 (which is C). Therefore, in order to rotate this part, a user must press A and C at the same time. This allows you to increase the possibilities of vehicles with Smart Ladder.
Movement Types
The movementType
property can either be "move", "rotate" or "attachVehicle".
If it is set to "move", it will adjust the offSet of the prop, based on your desired settings.
If it is set to "rotate", it will adjust the rotation of the prop, based on your desired settings.
If it is set to "attachVehicle", pressing the specified key will allow it to hook/pickup a vehicle, as seen with our recovery truck.
Attach Vehicle - More Information
Under the movementType = "attachVehicle"
property you are also able to set some other values:
overrideOffSet = false,
offSet = {0.0, 0.0, 1.5},
rotation = {0.0, 0.0, 0.0}, },
Firstly, you are able to set the offSet and rotation relative to the prop which the vehicle will be attaching to. This might be a hook or the bed of a trailer.
Our resource will automatically work out the position to attach the vehicle to the prop and then add your offSet values onto it. For example, you may want to attach a vehicle to the bed of a trailer. Our resource will automatically work out the position once it is on the trailer, however you may want to move it up or down so your offSet is added to this. In the example above, the offSet is increased by 1.5.
If you enable overrideOffSet, this will use your offSet values fully and ignore our resource's calculation of the vehicle position relative to the prop. You may want to try both and see what works for you.
LadderOuter Example:
As we are looking at the LadderOuter here, we will want it to move up and down and not rotate at all. A prop can do both though, it must use different controls for it.
Therefore, we set the movementType
to "move" for both the OuterLadder and all other ladders as we just want to change the offSet.
Axis
Once you have set the movenent type, you'll want to configure which axis you want it to move on. This is a number between 1 and 3.
If the axis is 1, it will move the first value in either the rotation or offSet. If the axis is 2, it will move the second value and if the axis is 3, it will move the third value.
For the ladders, we have set the axis to 2. As we've set the movement type to "move" this means it will change the second value of the offSet property. This means forwards/backwards. If the axis was set to 1, it would move left and right and if the axis was set to 3, it would move up and down.
As it is a ladder however, we want it to move forwards and backwards, so an axis of 2 is pefect. For other props such as outrigger feet, you'll want them to move a different way, namely up and down, so you'll want a different axis (up and down would be 3). Outriggers for example may move left and right, so their axis would be 1, depending on how the prop is setup.
Movement Amount
The movement amount property determines by how much the prop is moved or rotated when the key is pressed. Remember the key can be held down, so you won't want to set this too high.
From our experience, you'll want higher movement amounts when you're rotating a prop, compared to just moving it, this is because it operates within a bigger scale.
For example, we've set the movementAmount to the following for LadderOuter:
This can also be seen as the speed at which the ladder will move, which we've set to 0.01. This is relatively slow, but as we want it to appear synced to the best extent for other players, it's best not to have this too fast.
Reducing
Remember that you'll also need a control for reducing the value. For example, in the context of ladders, this means one key to extend them and one key to retract them.
Here's the control setup for retracting the ladder outer, which is also the same for the other ladders:
To quickly run through this, we have a control index of 132 setup. This is LEFT CTRL after searching the FiveM controls list. The movement type is set to "move", meaning it will adjust the offSet on axis 2, which is forwards and backwards (as it is a ladder). This time though, the movement amount is set to -0.01. This is because we are retracting the ladder, not extending it.
Data Entry Completed
You've now got to the end of adding a data entry. You aren't completely done though and there's still a couple of key configuration values to add which we missed at the beginning. Head to the top of the config.lua and we'll get started:
Ped Attachment Point
This is the point at which the ped will attach to the vehicle once they are controlling it. You should specify the ID once again of either "vehicle", to directly attach them to the vehicle, or the ID of a data entry.
In our included fire truck, you can see we have specified the ID of "LadderSeat". This will attach them to the ladder seat prop with the specified offSet and rotation. This visually puts them into the vehicle seat.
Animation
This is the animation settings for the ped once they are attached to the vehicle/prop, when they are controlling it.
If you don't want an animation, you can set enabled to false. Additionally, you should then set the animation dict and name within the idle = {
section. We plan to add an animation for entering the seat in the future, which is why we've named this idle for now.
A menu such as menyoo contains a full list of animation dictionaries and names. Alternatively, you can find a full list here.
Cage Settings
This is where you'll define the ID of the ladder cage and also the position where the ped should attach to. This setting is important because people can enter the cage using /entercage and exit using /exitcage.
If you don't want this setting enabled, as your vehicle may not have a cage for example, you can just set enabled to false.
The ID should be the ID of the data entry you have setup for the cage. In our included vehicle, this is simply named "Cage", but it can be anything.
The offSet and rotation is relative to the prop and this is the point where the ped will attach to. {0, 0, 0} may work, which would attach them to the centre of the cage, but with our included vehicle, we found it was too low down so we modified it to move them slightly forward and up, producing the following offset:
Multiple Ladders
You are able to setup different ladders to work for the same vehicle model in-game, allowing a user to select their desired ladder at the time of setup.
Each separate ladder requires a new .lua file, but with the following changes:
If you have multiple .lua files with the same vehicle model specified you must now add a different ID number to each of them. For example, if you have two vehicle files both for the firetruk model, one could have an id of 1 and the other an id of 2.
Lastly, the name must be one word, allowing a user to select it in-game with the /setupvehicle command.
Working Water
Smart Ladder allows for working water/particle effects to be emitted from different props. To do this, set up a water section in your data file, looking like this as an example:
You can set the control used at the top of this section, which toggles all particles at same time.
In the locations section, you may specify as many different items as you want. Each section within the locations table must reference the id name of a data reference later, such as "Cage" or "LadderSeat". Within that specific reference (such as cage), you can then setup multiple particle points, such as having two water monitors on the rear of the cage as seen with our rearmount ladder.
Each entry can have a different scale, particle asset and name, along with the offset and rotation which is relative to the prop (such as the cage in this case).
Custom Features
We're always adding new features to Smart Ladder to allow third party developers to make new and realistic vehicles. Get in touch with us if you want something added and we'll try our best!
Finished
You are now ready to begin using your ladder in-game. If you have any questions, please reach out to our Support Team.
Last updated