Change material on items

Ask for help about creating mods and scripts for Grimrock 2 or share your tips, scripts, tools and assets with other modders here. Warning: forum contains spoilers!
Post Reply
User avatar
ratman
Posts: 158
Joined: Fri Jan 10, 2020 1:13 am

Change material on items

Post 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!
User avatar
Zo Kath Ra
Posts: 931
Joined: Sat Apr 21, 2012 9:57 am
Location: Germany

Re: Change material on items

Post 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
User avatar
ratman
Posts: 158
Joined: Fri Jan 10, 2020 1:13 am

Re: Change material on items

Post by ratman »

Thanks. I copy and pasted your script and it worked. :D
User avatar
ratman
Posts: 158
Joined: Fri Jan 10, 2020 1:13 am

Re: Change material on items

Post by ratman »

Is there a way to change the material on the tiny_rat? I'm making a sort of 'ghost' level.
Last edited by ratman on Fri Apr 24, 2020 11:22 pm, edited 2 times in total.
User avatar
THOM
Posts: 1266
Joined: Wed Nov 20, 2013 11:35 pm
Location: Germany - Cologne
Contact:

Re: Change material on items

Post by THOM »

It's always the same way: add material = "longbow_ghost", to the model's component.
THOM formaly known as tschrage
_______________________________________________
My MOD (LoG1): Castle Ringfort Thread
My MOD (LoG2): Journey To Justice Thread | Download
User avatar
ratman
Posts: 158
Joined: Fri Jan 10, 2020 1:13 am

Re: Change material on items

Post by ratman »

Okay. Thanks
Post Reply