Info needed regards object gfx numbers

Talk about creating Grimrock 1 levels and mods here. Warning: forum contains spoilers!
Post Reply
User avatar
WaspUK1966
Posts: 135
Joined: Sat Aug 09, 2014 9:17 am

Info needed regards object gfx numbers

Post by WaspUK1966 »

Quick question: I notice every object in the game has a gfx item number (scrolls, keys, weapons etc). I assume the numbers are used by the game to catalogue/reference each item in the database. How does this work? What I mean is, if you clone an object and call it something else (ie clone "dagger" to create a" super-dagger" for example), surely both will have the same gfx number? What If you create a new object (defineObject) in Items.lua or elsewhere: do you have to give it a unique number or will the program automatically create one for it, or can you use an existing item number from an object that is similar? If you need to give it a unique number, what does the allowable range of numbers go up to? Any help appreciated..Thanks guys.
User avatar
Skuggasveinn
Posts: 561
Joined: Wed Sep 26, 2012 5:28 pm

Re: Info needed regards object gfx numbers

Post by Skuggasveinn »

gfx item number is a reference to the 2d sprite that the item has.
In your assets folder you have two DDS files called items.dds and items_2.dds
These textures hold all the 2d sprites for the items (inventory and when held in mouse cursor).

If you open up items.dds you can see that every item has a 75 pixels by 75 pixel box that defines the sprite.
its counted from 0, left to rigth, so the scimitar is gfxIndex = 0 and the IronKey is gfxIndex = 22
When you clone an object it holds the gfxIndex of the original object, if you define a new object you can change it. If you create our own object and your own 2d sprite you need to point to your gfxAtlas like this

Code: Select all

defineObject{
		name = "sx_theraen_ranger_cloak",
		class = "Item",
		uiName = "Theraen Ranger Cloak",
		model = "assets/models/items/diviner_clothes.fbx",
		slot = "Cloak",
		gfxAtlas = "mod_assets/sx_autumn_forest/textures/items_forest.tga",  
		gfxIndex = 3,
		description = "Dark grey cloak with a golden trim.",
		evasion = 8,
		vitality = 2,
		weight = 1.0,
	}
Here I have created my own cloak, its 2d sprite is the 4th item (remember it starts from 0) in my own gfxAtlas thats under my mod_assets folder.

John has also create a tool to help with the creation of your own Atlas, you should have a look at it.
http://www.johnwordsworth.com/legend-of ... s-toolkit/

Hope that helps.

Skuggasveinn.
Link to all my LoG 2 assets on Nexus.
Link to all my LoG 1 assets on Nexus.
Post Reply