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

Change material on items

Post by ratman » 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.
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!

Zo Kath Ra
Posts: 829
Joined: Sat Apr 21, 2012 9:57 am
Location: Germany

Re: Change material on items

Post by Zo Kath Ra » Fri Apr 24, 2020 7:01 am

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

ratman
Posts: 76
Joined: Fri Jan 10, 2020 1:13 am

Re: Change material on items

Post by ratman » Fri Apr 24, 2020 5:20 pm

Thanks. I copy and pasted your script and it worked. :D

ratman
Posts: 76
Joined: Fri Jan 10, 2020 1:13 am

Re: Change material on items

Post by ratman » Fri Apr 24, 2020 10:25 pm

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: 1130
Joined: Wed Nov 20, 2013 11:35 pm
Location: Germany - Cologne
Contact:

Re: Change material on items

Post by THOM » Fri Apr 24, 2020 10:53 pm

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

ratman
Posts: 76
Joined: Fri Jan 10, 2020 1:13 am

Re: Change material on items

Post by ratman » Fri Apr 24, 2020 11:22 pm

Okay. Thanks

Post Reply