> For the complete documentation index, see [llms.txt](https://titans-productions.gitbook.io/documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://titans-productions.gitbook.io/documentation/redm/utility-scripts/tp-object-loader.md).

# TP Object Loader

**TP Object Loader** is used to create and spawn objects on the desired locations directly from the configuration file, those objects are client-sided with a rendering system to properly load and unload when being nearby / not. The same system xmls and ymaps are using, the only differences is that they cannot be edited that easily as it is through just a configuration file at anytime.

### Create a new file and an area with the desired locations

1. Lets start by creating a file, go to `tp_objectloader/data` and create a new lua file with any desired name - i mostly use names that i understand for finding and editing easily after an amount of time than searching a file one by one without knowing which one is it.
2. After creating a file (lets call it `ranch1`), it is time to create the required data inside `local data` table.

```lua
    --- @param Object - requires a string (a valid object model name)
    --- @param Coords - requires a table form (the location to spawn the object with its pitch, roll and yaw which are the rotation values).
    --- @param PlaceObjectOnGroundProperly - requires a boolean value (this is in case you want the object to perfectly spawn in the ground - do not use it if you want to place the object to a specific height position).
    --- @param ObjectRenderDistance - requires an integer or float value (this is the rendering distance for the player to load the object).
    --- @param RemoveExistingObject - requires a boolean value (this is for deleting the desired object on the desired location that is from in-game).
    {
        Object = 'stall3',

        Coords = { 
            x = -835.8909301757812, y = 368.5548400878906, z = 97.12201690673828,
            pitch = 0, roll = 0, yaw = -132.8577117919922
        },
    
        PlaceObjectOnGroundProperly = false,
    
        ObjectRenderDistance = 100,
        
        RemoveExistingObject = false,
    }, -- <= ALWAYS ADD A COMMA
```

{% hint style="info" %}
The same objectloader system is used in other scripts of ours and not only through **TP Object Loader** - this tutorial and explanation is also for the objectloader that some scripts are using instead of this utility script.
{% endhint %}
