Page 1 of 1

Change material on items

Posted: Fri Apr 24, 2020 2:03 am
by ratman
How do you change the material for items? I tried using the 'material = " " line on it, but it looks the same.
Here's the full code.

Code: Select all

defineMaterial{
	name = "longbow_ghost",
	diffuseMap = "assets/textures/items/longbow_dif.tga",
	specularMap = "assets/textures/items/longbow_spec.tga",
	doubleSided = false,
	lighting = true,
	alphaTest = false,
	blendMode = "Additive",
	textureAddressMode = "Wrap",
	glossiness = 20,
	depthBias = 0,
}
defineObject{
	name = "longbow_ghost",
	baseObject = "base_item",
	material = "longbow_ghost",
	components = {
		{
			class = "Model",
			model = "assets/models/items/longbow.fbx",
		},
		{
			class = "Item",
			uiName = "Ghost Longbow",
			description = "An ethereal bow.",
			gfxIndex = 165,
			gfxIndexPowerAttack = 98,
			impactSound = "impact_blunt",
			weight = 1.6,
			traits = { "missile_weapon" },
		},
		{
			class = "RangedAttack",
			attackPower = 16,
			cooldown = 4.5,
			attackSound = "swipe_bow",
			ammo = "arrow",
		},
	},
	tags = { "weapon", "weapon_missile" },
}

Thanks!

Re: Change material on items

Posted: Fri Apr 24, 2020 7:01 am
by Zo Kath Ra
ratman wrote:
Fri Apr 24, 2020 2:03 am
How do you change the material for items? I tried using the 'material = " " line on it, but it looks the same.
How did you use the 'material = " " line?

Here's how I used it:

Code: Select all

defineObject{
	name = "longbow_ghost",
	baseObject = "base_item",
	material = "longbow_ghost",
	components = {
		{
			class = "Model",
			model = "assets/models/items/longbow.fbx",
			material = "longbow_ghost",
		},
		{
			class = "Item",
			uiName = "Ghost Longbow",
			description = "An ethereal bow.",
			gfxIndex = 165,
			gfxIndexPowerAttack = 98,
			impactSound = "impact_blunt",
			weight = 1.6,
			traits = { "missile_weapon" },
		},
		{
			class = "RangedAttack",
			attackPower = 16,
			cooldown = 4.5,
			attackSound = "swipe_bow",
			ammo = "arrow",
		},
	},
	tags = { "weapon", "weapon_missile" },
}
Normal bow:
https://imgur.com/IssZSnK

Ghost bow:
https://imgur.com/ATdzrJX

Re: Change material on items

Posted: Fri Apr 24, 2020 5:20 pm
by ratman
Thanks. I copy and pasted your script and it worked. :D

Re: Change material on items

Posted: Fri Apr 24, 2020 10:25 pm
by ratman
Is there a way to change the material on the tiny_rat? I'm making a sort of 'ghost' level.

Re: Change material on items

Posted: Fri Apr 24, 2020 10:53 pm
by THOM
It's always the same way: add material = "longbow_ghost", to the model's component.

Re: Change material on items

Posted: Fri Apr 24, 2020 11:22 pm
by ratman
Okay. Thanks