Custom objects have to be manually defined. There are blank scripts in your project's scripts folder. You would usually open the items.lua file and add your item definition.TheAdder wrote: Secondly, how do I actually add coins into the game for the player to pick up? There seems to be no new objects I can find in the editor objects pane, but then I don't know what I'm looking for!
Thanks in advance.
The easiest way to learn how to make your own items, is to read through the official item definitions, to see how they are defined.
You get these in the game's asset pack; available here: http://www.grimrock.net/modding/grimrock-2-asset-pack/
This is a zipped copy of most of the game's default assets. Extract it somewhere convenient, and you'll have the definitions for all of the objects in the game.
You can copy/paste definitions from the asset pack into the scripts in your mod's scripts folder. and any changes you make will be reflected in the mod; when loaded.
A reasonable example for a coin, is to copy the definition of a gemstone, and change it to suit.
This is the definition of the green gem in LoG2.
Code: Select all
defineObject{
name = "green_gem",
baseObject = "base_item",
components = {
{
class = "Model",
model = "assets/models/items/green_gem.fbx",
},
{
class = "Item",
uiName = "Green Gem",
gfxIndex = 119,
weight = 0.2,
traits = { "gem" },
}
},
}
Code: Select all
--two dashes in front, means to skip the rest of the line.
defineObject{
name = "glass_coin", --changed object item name
baseObject = "base_item",
components = {
{
class = "Model",
model = "assets/models/items/green_gem.fbx",
},
{
class = "Item",
uiName = "Glass Coin", --changed in-game item name
gfxIndex = 119,
weight = 0.2,
--traits = { "gem" }, --removed gem trait
}
},
}
To make it actually look like a coin, you will have to create the two artwork files for it. One is a 3D model of the coin, and the other is either a 2D drawing of the coin, or a render of the 3D coin.