Page 1 of 1

A couple of questions about asset definitions

Posted: Tue Oct 09, 2012 8:38 am
by Phitt
I have a couple of questions about defining assets, couldn't find anything in the modding documentation (though maybe I only missed it).

1. Is there a list of editor icons and their icon number (the one you need when defining the asset) somewhere? So far I could only look at the ones used in the 'rotten place' mod, is there a complete list somewhere?

2. I can't find some asset types in the definition reference. For example how do I add a ceiling shaft I can place manually? I could define it as deco object, but there doesn't seem to be a 'replaces ceiling' boolean available. So how would I do that?

3. The syntax is sometimes a bit unclear to me. For example if I wanted to enable random floor facing in the wall_sets.lua, what do I have to type and where? Tried various combinations of randomFloorFacing = true, but either the editor spits out errors or it simply doesn't work.

I hope someone can help.

EDIT: Oh, and what about the scripting hooks? Do I need to define them somehow or are they just mentioned for scripting reference?

Re: A couple of questions about asset defiitions

Posted: Tue Oct 09, 2012 11:12 am
by Grimwold
Have you tried looking in the asset pack:
http://www.grimrock.net/modding/asset-pack/
There are definitions for pretty much everything... including which editorIcon is used for each object.

For the dungeon ceiling shaft (again from the asset pack) the definition is:
SpoilerShow

Code: Select all

defineObject{
	name = "dungeon_ceiling_shaft",
	class = "Decoration",
	model = "assets/models/env/dungeon_ceiling_pit.fbx",
	placement = "ceiling",
	editorIcon = 104,
}
So at a guess you just need class="Decoration" and placement="ceiling"


Regarding the random floor facing... It looks like when defining a wall set you place randomFloorFacing = true immediately after the name e.g.
SpoilerShow

Code: Select all

defineWallSet{
	name = "dungeon",
	randomFloorFacing = true,
	
	floors = {
		"assets/models/env/dungeon_floor_01.fbx", 5,
		"assets/models/env/dungeon_floor_02.fbx", 5,
		"assets/models/env/dungeon_floor_03.fbx", 5,
		"assets/models/env/dungeon_floor_04.fbx", 5,
		"assets/models/env/dungeon_floor_05.fbx", 5,
		"assets/models/env/dungeon_floor_06.fbx", 5,
		"assets/models/env/dungeon_floor_drainage.fbx", 1,
	},
	
	walls = {
		"assets/models/env/dungeon_wall_01.fbx", 50,
		"assets/models/env/dungeon_wall_drainage.fbx", 1,
	},
	
	pillars = {
		"assets/models/env/dungeon_pillar.fbx", 1,
	},

	ceilings = {
		"assets/models/env/dungeon_ceiling.fbx", 1,
	},
	
	ceilingShafts = {
		"assets/models/env/dungeon_ceiling_pit.fbx", 1,
	},

	floorDecorations = {
	},
	
	wallDecorations = {
		"assets/models/env/metal_hooks_wall.fbx", 1,
		"assets/models/env/metal_hooks_chain_wall.fbx", 1,
	},
	
	pillarDecorations = {
		"assets/models/env/metal_hook_pillar.fbx", 1,
		"assets/models/env/metal_hook_chain_pillar.fbx", 1,
		"assets/models/env/metal_ring_pillar.fbx", 1,
	},
}

Re: A couple of questions about asset defiitions

Posted: Tue Oct 09, 2012 11:19 am
by Grimwold
Regarding scripting hooks. If I understand what you're asking, you have to define the event that takes place.

e.g. to make use of the hook "onMove" by the party you would need to "modify" the entry for the party to point to a script and function which you could then add in the editor.

e.g. from my init.lua file

Code: Select all

cloneObject{
   name = "party",
   baseObject = "party",

   onMove = function(self, dir)
      return direction_script.moveCheck(dir)
   end,
}
so every time the party moves it runs the function moveCheck() which is defined in the direction_script script entity in my dungeon.

Re: A couple of questions about asset defiitions

Posted: Tue Oct 09, 2012 11:28 am
by Neikun
It would appear that the string
placement = "ceiling",
does in fact act as replaceCeiling=true,

Re: A couple of questions about asset defiitions

Posted: Thu Oct 11, 2012 9:48 pm
by Phitt
Thanks, didn't know there were definitions in the asset pack. Didn't know about the ceiling either.

So I guess if I make a custom tile set I'll leave the script part out of the objects.lua so modders can fill it in themselves?

Re: A couple of questions about asset defiitions

Posted: Thu Oct 11, 2012 11:02 pm
by Neikun
I think the best way for modders to use bulk assets is to create a new .lua file and add it to the import file.
This way it's easier to keep track of custom assets that are all from the same source.

So whatever custom assets you bring, they can put it into their own files via good old copy&paste.

Re: A couple of questions about asset defiitions

Posted: Fri Oct 12, 2012 7:49 am
by Phitt
Neikun wrote:I think the best way for modders to use bulk assets is to create a new .lua file and add it to the import file.
This way it's easier to keep track of custom assets that are all from the same source.

So whatever custom assets you bring, they can put it into their own files via good old copy&paste.
That's what I planned, I want to copy the lua definitions for materials, objects and wall sets into a txt file so people can copy/paste them into their current project. The only question is whether I should define any scripting hooks or leave those out so modders can define them on their own. I guess I shouldn't add any scripting hooks, and that is my question.

Re: A couple of questions about asset defiitions

Posted: Fri Oct 12, 2012 10:20 am
by JohnWordsworth
One suggestion is to have a subdirectory for a custom asset pack like so...

Code: Select all

mod_assets/mine_wallset/models/...
mod_assets/mine_wallset/textures/...
mod_assets/mine_wallset/scripts/materials.lua
mod_assets/mine_wallset/scripts/wallsets.lua
mod_assets/mine_wallset/scripts/init.lua
In your asset pack's init.lua, you could include the other lua files in your asset pack.

Pros
- Your entire pack of assets and scripts are in one folder.
- Including all of the scripts for that pack simply involves including mod_assets/mine_wallset/scripts/init.lua in mod_assets/scripts/init.lua

Cons
- Loads of extra includes will increase loading time, but I expect it will be a really tiny increase.
- It's harder to spot naming conflicts. Perhaps custom asset packs should use name prefixing (mine_something_01).

Install instructions would then just be 'extract files to right folder, add init include'.

Re: A couple of questions about asset defiitions

Posted: Fri Oct 12, 2012 11:08 am
by Komag
simplicity and clarity are KING! So this is a good approach

Re: A couple of questions about asset defiitions

Posted: Sat Oct 13, 2012 1:21 am
by Phitt
That's great, didn't know you could do that. Very clean and simple to use for modders utilizing my tileset. Thanks!