362 lines
No EOL
8.7 KiB
Markdown
362 lines
No EOL
8.7 KiB
Markdown
---
|
|
title: Creating a VehicleModel
|
|
description: This page describes how to create a custom VehicleModel
|
|
published: true
|
|
date: 2023-01-25T19:37:41.129Z
|
|
tags:
|
|
editor: markdown
|
|
dateCreated: 2023-01-25T19:35:38.907Z
|
|
---
|
|
|
|
# Creating a VehicleModel
|
|
This page describes how to create a custom VehicleModel
|
|
|
|
## Preparing the skin
|
|
This section is still work in progress!
|
|
|
|
## Creating the model
|
|
Go to the `vehicles` folder in the VehiclesPlus data folder. Choose the vehicletype you want to create the model in. Copy the example model and rename the file to the name for your new model.
|
|
|
|
Now start changing the configuration based on your preferences. The following configuration can be used as reference:
|
|
```json
|
|
{
|
|
//The unique identifier of your model, probably the same as the filename
|
|
id: ExampleCar
|
|
//The name for this model used in the GUIs (like the shop), supports chatcolors
|
|
displayName: &cExample &aCar
|
|
//The unique identifier for the vehicletype, MUST be the same as the folder name
|
|
typeId: car
|
|
//The price of this vehicle in the shop
|
|
price: 100000
|
|
//The permissions for this vehicle
|
|
permissions:
|
|
{
|
|
//This permission is required to buy this vehicle
|
|
buy: vp.buy.ExampleCar
|
|
//This permission is required to change a bought vehicle (tuning, settings, fixing, ...)
|
|
adjust: vp.adjust.ExampleCar
|
|
//This permission is required to spawn a bought vehicle
|
|
spawn: vp.spawn.ExampleCar
|
|
//This permission is required to drive a bought vehicle
|
|
ride: vp.ride.ExampleCar
|
|
//If true, players can sit in the non-drive seats without the ride permission
|
|
sitWithoutRidePermission: true
|
|
}
|
|
//Contains all the RGB colors available for this model in the shop
|
|
availableColors:
|
|
[
|
|
{
|
|
red: 255
|
|
green: 0
|
|
blue: 0
|
|
}
|
|
{
|
|
red: 0
|
|
green: 0
|
|
blue: 0
|
|
}
|
|
{
|
|
red: 255
|
|
green: 255
|
|
blue: 255
|
|
}
|
|
{
|
|
red: 128
|
|
green: 128
|
|
blue: 128
|
|
}
|
|
{
|
|
red: 192
|
|
green: 192
|
|
blue: 192
|
|
}
|
|
]
|
|
//A list of all the parts for this model
|
|
parts:
|
|
[
|
|
//The skin part is the main chasis of the vehicle
|
|
{
|
|
type: skin
|
|
//The x, y and z offsets are the offsets from the center location of the vehicle
|
|
//X = Forwards (+) or backwards (-)
|
|
xoffset: 0
|
|
//Y = Higher (+) or lower (-)
|
|
yoffset: 0
|
|
//Z = Left (+) or right (-)
|
|
zoffset: 0
|
|
//The item containing the chasis
|
|
//Check out the section below for more information
|
|
item:
|
|
{
|
|
damage: 1
|
|
material: LEATHER_BOOTS
|
|
unbreakable: true
|
|
color:
|
|
{
|
|
red: 255
|
|
green: 255
|
|
blue: 255
|
|
}
|
|
}
|
|
}
|
|
//Now 4 seat parts follow
|
|
{
|
|
type: seat
|
|
//Check out the description at the skin part
|
|
xoffset: -0.2
|
|
yoffset: -1.45
|
|
zoffset: 0.45
|
|
//If set to true, a player in this seat can steer the vehicle
|
|
steer: true
|
|
}
|
|
{
|
|
type: seat
|
|
xoffset: -0.2
|
|
yoffset: -1.45
|
|
zoffset: -0.45
|
|
steer: false
|
|
}
|
|
{
|
|
type: seat
|
|
xoffset: -1
|
|
yoffset: -1.45
|
|
zoffset: 0.45
|
|
steer: false
|
|
}
|
|
{
|
|
type: seat
|
|
xoffset: -1
|
|
yoffset: -1.45
|
|
zoffset: -0.45
|
|
steer: false
|
|
}
|
|
//Now 4 wheels follow
|
|
{
|
|
type: wheel
|
|
//Check out the description at the skin part
|
|
xoffset: 1.8
|
|
yoffset: 0
|
|
zoffset: -1.1
|
|
//The ID of the rim design used for this model
|
|
rimDesignId: default
|
|
//The RGB color of the wheel (only applicable if connected to leather armor)
|
|
color:
|
|
{
|
|
red: 128
|
|
green: 128
|
|
blue: 128
|
|
}
|
|
//If true, the wheel will move left/right when the driver steers left/right
|
|
steering: true
|
|
//The offset (degrees) the wheel will rotate when steering
|
|
//180 degrees means 90 degrees left and 90 degrees right
|
|
rotationOffset: 180
|
|
}
|
|
{
|
|
type: wheel
|
|
xoffset: 1.8
|
|
yoffset: 0
|
|
zoffset: 1.1
|
|
rimDesignId: default
|
|
color:
|
|
{
|
|
red: 128
|
|
green: 128
|
|
blue: 128
|
|
}
|
|
steering: true
|
|
rotationOffset: 180
|
|
}
|
|
{
|
|
type: wheel
|
|
xoffset: -1.67
|
|
yoffset: 0
|
|
zoffset: -1.1
|
|
rimDesignId: default
|
|
color:
|
|
{
|
|
red: 128
|
|
green: 128
|
|
blue: 128
|
|
}
|
|
steering: false
|
|
rotationOffset: 180
|
|
}
|
|
{
|
|
type: wheel
|
|
xoffset: -1.67
|
|
yoffset: 0
|
|
zoffset: 1.1
|
|
rimDesignId: default
|
|
color:
|
|
{
|
|
red: 128
|
|
green: 128
|
|
blue: 128
|
|
}
|
|
steering: false
|
|
rotationOffset: 180
|
|
}
|
|
]
|
|
//The max speed of this model
|
|
//The default max speed is 100 km/h. A player pays 1000 per 5 added to that.
|
|
//The maximum max speed which can be upgraded to is 200 km/h.
|
|
maxSpeed:
|
|
{
|
|
//The base setting is the default after this vehicle is bought
|
|
base: 100
|
|
//The max setting is the maximum that can be upgraded to
|
|
max: 200
|
|
//The step setting is the amount each purchase will add to the current value
|
|
step: 5
|
|
//The price the player pays per step
|
|
stepCost: 1000
|
|
}
|
|
//The fuel tank of this model
|
|
//Check out the maxSpeed setting for more info
|
|
fuelTank:
|
|
{
|
|
base: 50
|
|
max: 100
|
|
step: 5
|
|
stepCost: 1000
|
|
}
|
|
//The turning radius of this model
|
|
//Check out the maxSpeed setting for more info
|
|
turningRadius:
|
|
{
|
|
base: 7
|
|
max: 15
|
|
step: 1
|
|
stepCost: 1000
|
|
}
|
|
//The acceleration of this model
|
|
//Check out the maxSpeed setting for more info
|
|
acceleration:
|
|
{
|
|
base: 50
|
|
max: 100
|
|
step: 5
|
|
stepCost: 1000
|
|
}
|
|
//Sizing of the hitbox of this model
|
|
hitbox:
|
|
{
|
|
//Length is front to back
|
|
length: 3
|
|
//Width is left to right
|
|
width: 2
|
|
//Height is bottom to top
|
|
height: 1
|
|
}
|
|
//The fuel to be used to refuel this vehicle
|
|
fuel:
|
|
{
|
|
//The type of fuel which has to be used
|
|
typeId: gasoline
|
|
//The amount of liters used by this model
|
|
//For example, when you drive 60 km/h and the max speed is 100 km/h
|
|
//-> 60 / 100 * 6 / 1000 * 20 = 0.072 liter is used per second you drive the same speed
|
|
usage: 6
|
|
}
|
|
//The exhaust of this model
|
|
exhaust:
|
|
{
|
|
//If true, the exhaust particle will be shown
|
|
enabled: true
|
|
//The particle type to show
|
|
//Check out https://hub.spigotmc.org/javadocs/spigot/org/bukkit/Particle.html for a full list
|
|
particle: SMOKE_LARGE
|
|
//Check out the description at the skin part
|
|
zoffset: 0
|
|
xoffset: -5
|
|
yoffset: 0
|
|
}
|
|
//The horn for this model
|
|
horn:
|
|
{
|
|
//If true, the horn will be sounded when space is pressed
|
|
enabled: true
|
|
//The sound to play
|
|
//Check out https://www.digminecraft.com/lists/sound_list_pc.php for a full list
|
|
sound: block.note_block.bass
|
|
}
|
|
//The sounds used for this model
|
|
//Check out https://www.digminecraft.com/lists/sound_list_pc.php for a full list
|
|
sounds:
|
|
{
|
|
//This sound is played when the vehicle stands still
|
|
idle:
|
|
{
|
|
//The sound to play
|
|
sound: car.idle
|
|
//The number of seconds after which the sound is replayed
|
|
duration: 6
|
|
}
|
|
//This sound is played when the vehicle is started (player enters a driver seat)
|
|
start:
|
|
{
|
|
//Check out the description for the idle sound
|
|
sound: car.start
|
|
duration: 2
|
|
}
|
|
//This sound is played when the vehicle accelerates
|
|
accelerate:
|
|
{
|
|
//Check out the description for the idle sound
|
|
sound: car.accelerate
|
|
duration: 2
|
|
}
|
|
//This sound is played when the vehicle is driven
|
|
driving:
|
|
{
|
|
//Check out the description for the idle sound
|
|
sound: car.driving
|
|
duration: 2
|
|
}
|
|
//This sound is played when the vehicle is slowing down
|
|
slowingDown:
|
|
{
|
|
//Check out the description for the idle sound
|
|
sound: car.slowingdown
|
|
duration: 2
|
|
}
|
|
}
|
|
//If true, steering will feel more realistic (no instant movement)
|
|
realisticSteering: false
|
|
//The size of the trunk (blocks)
|
|
trunkSize: 27
|
|
//If true, the vehicle will drift when space is pressed
|
|
drift: true
|
|
//If true, players can exit while the vehicle is moving
|
|
exitWhileMoving: true
|
|
//The health this vehicle has
|
|
health: 100
|
|
}
|
|
```
|
|
|
|
## Connecting your skin
|
|
The skin part has an item section. The following options are available for this section:
|
|
```json
|
|
item:
|
|
{
|
|
//The material of this item
|
|
//For a full list, see https://hub.spigotmc.org/javadocs/spigot/org/bukkit/Material.html
|
|
material: LEATHER_BOOTS
|
|
//The damage to apply to the item
|
|
damage: 1
|
|
//If true, the item will be unbreakable
|
|
unbreakable: true
|
|
//The custom model data to apply to the item
|
|
custommodeldata: 1
|
|
//The player for the skull (only applicable if the material is PLAYER_HEAD)
|
|
skull: SBDeveloper
|
|
//The RGB colors to apply to the item (only applicable for leather armor)
|
|
color:
|
|
{
|
|
red: 255
|
|
green: 255
|
|
blue: 255
|
|
}
|
|
}
|
|
``` |