Page 1 of 1

Using a different material for default monster?

Posted: Sat Sep 15, 2012 2:49 am
by Aexrael
Is there a way to overwrite which material an object/item/monster uses

Example

dungeon.lua

Code: Select all

spawn("weak_spider", 1, 10, 9, 3, "weak_spider1")
monster.lua

Code: Select all

cloneObject{
	name = "weak_spider",
	baseObject = "spider",
	health = 1,
}
materials.lua

and then define a different named material for use with the weak_spider? I realize we can overwrite the parameters listed under defineMaterial for the default spider model, but that's not what I want to do, because that affects all spiders.

Code: Select all

defineMaterial{
	name = "weak_spider",
	diffuseMap = "assets/textures/monsters/spider_dif.tga",
	specularMap = "assets/textures/monsters/spider_spec.tga",
	normalMap = "assets/textures/monsters/spider_normal.tga",
	doubleSided = false,
	lighting = true,
	alphaTest = false,
	blendMode = "Opaque",
	textureAddressMode = "Wrap",
	glossiness = 40,
	depthBias = 0,
}

Re: Using a different material for default monster?

Posted: Sat Sep 15, 2012 2:59 am
by Bek
A workaround would be to define a new monster that is the spider copied but with a different material.

Re: Using a different material for default monster?

Posted: Sat Sep 15, 2012 11:36 am
by Aexrael
Could you give an example?

Re: Using a different material for default monster?

Posted: Tue Sep 18, 2012 9:10 am
by antti
The material (or materials) used by monsters and other 3D objects is defined in the 3D model itself so basically the material names cannot be changed without changing the .model files. Unfortunately that is currently practically not possible since we haven't gotten the asset pack ready yet (busy fixing bugs still, which take priority!) and there's no .model exporter/converter yet.

You can, of course, override a material (by defining a material with the same name as the original, like "spider" for example) which will change all objects that refer to the material (in this case, both the spider and the weak spider).

I hope this clarifies the matter a bit.

Re: Using a different material for default monster?

Posted: Tue Sep 18, 2012 11:15 am
by Aexrael
I was afraid that was the case. I wanted to have two different looking spiders so as to indicate that they were of different difficulty/ability. It was an attempt to differentiate the limited selection of monsters available, effectively making more monsters available.

Hopefully the selection will expand down the line.