Uggardian retexturing

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
zimberzimber
Posts: 432
Joined: Fri Feb 08, 2013 8:06 pm

Uggardian retexturing

Post by zimberzimber » Wed Apr 06, 2016 7:35 pm

I'm trying to create a new monster which is exactly like an Uggardian, but with a different texture, and encountered a few problems.

1) How do I change the texture for the armor? The script for Uggardians in the asset pack has a defined material named 'uggardian' with all the required textures linked, but I don't see where its used in the script itself.

2) I can't define a new material and have the new monster use it without the editor crashing upon pressing the 'play' button. No error, just a CTD.
What I did is redefine 'uggardian_fire' to use a different diffuse_map, but this also effects Uggardians.
Here's what I have for the material:

Code: Select all

defineMaterial{
	name = "uggardian_fire",
	diffuseMap = "mod_assets/textures/monsters/SF_fire_dif.tga",
	doubleSided = true,
	lighting = false,
	alphaTest = true,
	blendMode = "Opaque",
	textureAddressMode = "Wrap",
	glossiness = 20,
	depthBias = 0,
	ambientOcclusion = false,
}
Renaming it and having the monsters 'emitFromMaterial' use the new name CTDs. I assume this has to do with 'class = "UggardianFlames"', but I haven't found any traces of that in the asset pack.
My asset pack [v1.10]
Features a bit of everything! :D

CainOrdamoth
Posts: 32
Joined: Sun Mar 08, 2015 1:45 am

Re: Uggardian retexturing

Post by CainOrdamoth » Thu Apr 14, 2016 3:27 am

I ran into the same problems as well. I'm no expert but I've spent a long time messing around with custom enemies, and I had loads of issues with the uggardian like you do. But on my latest attempt I somehow got it to work. I'm not sure what I did or how I got it to work, but in the uggardian script there should be 2 texture definitions. The 'uggardian' def is for the armour, the 'uggardian_fire' is for the fiery body texture. I copied this and changed the name etc. to suit my needs, and it seems to work, but I'm not sure how or why, lol. Between my 2 attempts at this, the first crashed but my 2nd attempt succeeded, and I'm not sure what I did differently, but I hope this helps. Sorry I have no other answers for you.
SpoilerShow
defineMaterial{
name = "uggardian",
diffuseMap = "assets/textures/monsters/uggardian_dif.tga",
specularMap = "assets/textures/monsters/uggardian_spec.tga",
normalMap = "assets/textures/monsters/uggardian_normal.tga",
doubleSided = false,
lighting = true,
alphaTest = false,
blendMode = "Opaque",
textureAddressMode = "Wrap",
glossiness = 60,
depthBias = 0,
}

defineMaterial{
name = "uggardian_fire",
diffuseMap = "assets/textures/monsters/uggardian_fire_dif.tga",
doubleSided = true,
lighting = false,
alphaTest = true,
blendMode = "Opaque",
textureAddressMode = "Wrap",
glossiness = 20,
depthBias = 0,
ambientOcclusion = false,
}

minmay
Posts: 2700
Joined: Mon Sep 23, 2013 2:24 am

Re: Uggardian retexturing

Post by minmay » Thu Apr 14, 2016 7:37 am

If you look at the uggardian model you will see that it uses two materials, "uggardian" (the armor) and "uggardian_fire" (the rest of the mesh).
If you just want to change the materials on a model, use the "material" or "materialOverrides" fields. In this case, the model uses more than one material, so you need to use materialOverrides:

Code: Select all

{
	class = "Model",
	model = "assets/models/monsters/uggardian.fbx",
	storeSourceData = true,
	materialOverrides = { uggardian = "my_uggardian_material", uggardian_fire = "my_other_material" },
},
Note that because this is a monster, if you do not give it immunity to the "frozen" status you will need to account for another issue (which is also easy to do).
UggardianFlamesComponent ignores material overrides. It just looks at the material names in the original mesh. So you shouldn't change the UggardianFlamesComponent's emitFromMaterial away from "uggardian_fire", unless you actually want it to emit from the armor instead, or the entire mesh (use "*" to make it emit from the entire mesh).
zimberzimber wrote:2) I can't define a new material and have the new monster use it without the editor crashing upon pressing the 'play' button. No error, just a CTD.
There is ALWAYS an error. Run the game from the command line so you can see the output. Without the output it is practically impossible for anyone to figure out what it is that you did wrong.
Grimrock 1 dungeon
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.

User avatar
zimberzimber
Posts: 432
Joined: Fri Feb 08, 2013 8:06 pm

Re: Uggardian retexturing

Post by zimberzimber » Wed Apr 27, 2016 6:47 pm

YES! Thanks a lot minmay!
Before your post I was sure UggardianFlames was responsible for the textures for some reason... :oops:

Anyways, heres the end result:
Image
My asset pack [v1.10]
Features a bit of everything! :D

Post Reply