Ask a simple question, get a simple answer

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!
User avatar
juho
Posts: 238
Joined: Mon Feb 27, 2012 1:18 pm

Re: Ask a simple question, get a simple answer

Post by juho »

Here you go guys. I did a really quick rig and animation to the crow in blender. It's not the best (I did it during lunch brake), but it's a good star for someone to take it a bit further.

Use it any way you like. Grab the .blend file and textures here: https://dl.dropboxusercontent.com/u/111 ... g_crow.zip

The rig is really simple. I did couple of the main controllers as shapes to spot them more easily. Animation is a flying loop in action editor. I don't think the crow can fold it's wings properly with this rig.

If you use the crow, please post it somewhere in these forums.

I did a new topic about this in Mod Creation so that other people could find it a bit easier.
Follow me on Twitter: @JuhoMakingStuff
minmay
Posts: 2768
Joined: Mon Sep 23, 2013 2:24 am

Re: Ask a simple question, get a simple answer

Post by minmay »

Isaac wrote:What are the acceptable strings for Champion:showAttackResult(any, string)
*And what's "any"?
"any" means that the argument can be of any type. In the case of Champion:showAttackResult(), only numbers and strings will work, though; anything else will crash.
The second argument can be the name of any GuiItem. Generally you are only interested in "HitSplashSmall", "HitSplash", and "HitSplashLarge".
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: Ask a simple question, get a simple answer

Post by zimberzimber »

Eleven Warrior wrote:RE: Bear Form Potion.
Thats because conditions aren't present in the current asset pack sadly.
The icon can be changed with a change to the equipped items icon, but I think it would react badly to trying to unequip/equip items. (Unless you can prevent the player from doing that)

Speaking of which... How do I render a champion unable to act? (pseudo-paralyzed)
And as asked by Eleven Warrior, how do I revert the champions portrait back to what it was?
My asset pack [v1.10]
Features a bit of everything! :D
User avatar
Isaac
Posts: 3172
Joined: Fri Mar 02, 2012 10:02 pm

Re: Ask a simple question, get a simple answer

Post by Isaac »

@minmay : Perfect;
Thanks! 8-)
zimberzimber wrote:... how do I revert the champions portrait back to what it was?
Petri explains the onGetPortrait party hook here: viewtopic.php?f=22&t=9470&p=91873&hilit ... ait#p91868

**Is there a known method for preventing the rune panel from opening? (besides changing the PC class?)
The obvious choice is remove the "hand_caster" trait, but that seems to be hard coded; it does not get removed, and is impossible to add by champion:addTrait("hand_caster").

I have a working Tiger Form condition. It's complete but still experimental, and ~at present does not interfere with the rune panel; so the wizard PC can cast spells as a tiger. :(

https://www.dropbox.com/s/8xgfw57ucfgd7 ... m.dat?dl=0

https://www.dropbox.com/s/tq3vk02qubnp0 ... 0form?dl=0
User avatar
zimberzimber
Posts: 432
Joined: Fri Feb 08, 2013 8:06 pm

Re: Ask a simple question, get a simple answer

Post by zimberzimber »

How does one replicate the healing crystals gradual darkening on use, and how do I change the animation speed? (so it would turn darker, and spin slower like it does after you use it)
Tried attaching the models emissive color to the sounds volume level or to the lights brightness through an 'onUpdate()' function and fade them out, but it doesn't seem to work. (I can guess why)
I'm trying to replicate the 'crystal' component so I would have more control over whats happening.
My asset pack [v1.10]
Features a bit of everything! :D
minmay
Posts: 2768
Joined: Mon Sep 23, 2013 2:24 am

Re: Ask a simple question, get a simple answer

Post by minmay »

zimberzimber wrote:How does one replicate the healing crystals gradual darkening on use, and how do I change the animation speed? (so it would turn darker, and spin slower like it does after you use it)
Tried attaching the models emissive color to the sounds volume level or to the lights brightness through an 'onUpdate()' function and fade them out, but it doesn't seem to work. (I can guess why)
I'm trying to replicate the 'crystal' component so I would have more control over whats happening.
Here is the closest recreation of the builtin healing_crystal+CrystalComponent shader behaviour I was able to manage:

Code: Select all

-- CrystalComponent only works properly if the material is named
-- "healing_crystal".
defineObject{
	name = "g1_healing_crystal",
	baseObject = "healing_crystal",
	components = {
		{
			class = "Model",
			model = "mod_assets/g1/Healing_Crystal/healing_crystal.fbx",
			castShadow = false,
			material = "g1_healing_crystal_42",
		},
		{
			class = "Light",
			offset = vec(0,1,0),
			color = vec(39/255, 90/255, 205/255),
			range = 7,
			shadowMapSize = 128,
			castShadow = true,
			staticShadows = true,
			-- lame attempt at imitating the crystalIntensity fadeout (it
			-- only happens naturally for the "healing_crystal" material)
			onUpdate = function(self)
				local v = math.max(math.min(1,self.go.sound:getVolume()*2),0)
				local choice = math.modf(v*42+0.01)
				self.go.model:setMaterial(string.format("g1_healing_crystal_%d",choice))
			end,
		},
	},
}
-- Shader params don't seem to have changed between Grimrock 1 and 2.
-- At 60 FPS, there are 43 frames between the crystal starting to fade and
-- finishing with fading.
-- Unfortunately, I don't have a good way to mimic the effect where the
-- shadeTexAngle stops changing.
for i=0,42 do
defineMaterial{
	name = string.format("g1_healing_crystal_%d",i),
	diffuseMap = "mod_assets/g1/Healing_Crystal/healing_crystal_dif.tga",
	specularMap = "mod_assets/g1/Healing_Crystal/healing_crystal_spec.tga",
	normalMap = "mod_assets/g1/Healing_Crystal/healing_crystal_normal.tga",
	doubleSided = false,
	lighting = true,
	ambientOcclusion = false,
	alphaTest = false,
	blendMode = "Opaque",
	textureAddressMode = "Wrap",
	glossiness = 20,
	depthBias = 0,
	shader = "crystal",
	shadeTex = "assets/textures/env/healing_crystal_shadetex.tga",
	shadeTexAngle = 0,
	crystalIntensity = 0.5+3.5*i/89,
	onUpdate = function(self, time)
		self:setParam("shadeTexAngle", time*0.8)
	end,
}
end
end
Instead of switching out materials, you could instead define a different material for every individual healing crystal on a level (you can share them between levels since you can't see two objects on different levels at once), and use the onUpdate hook to dynamically change the crystalIntensity param.
Emissive color should not appear at any point during this.

Recreating the slower animation is easier. Since the healing crystal animation doesn't involve any mesh deformation, you can remove the actual animation, separate the crystal model into 5 models, and re-create the animation using Component:setOffset() and Component:setRotationAngles() every frame to move and rotate each of the 5 models the same way the animation would.
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
Isaac
Posts: 3172
Joined: Fri Mar 02, 2012 10:02 pm

Re: Ask a simple question, get a simple answer

Post by Isaac »

minmay wrote:Recreating the slower animation is easier. Since the healing crystal animation doesn't involve any mesh deformation, you can remove the actual animation, separate the crystal model into 5 models, and re-create the animation using Component:setOffset() and Component:setRotationAngles() every frame to move and rotate each of the 5 models the same way the animation would.
What about [I mean also/instead] importing it into..., scaling it, and then exporting it out of... Blender?
minmay
Posts: 2768
Joined: Mon Sep 23, 2013 2:24 am

Re: Ask a simple question, get a simple answer

Post by minmay »

Isaac wrote:
minmay wrote:Recreating the slower animation is easier. Since the healing crystal animation doesn't involve any mesh deformation, you can remove the actual animation, separate the crystal model into 5 models, and re-create the animation using Component:setOffset() and Component:setRotationAngles() every frame to move and rotate each of the 5 models the same way the animation would.
What about [I mean also/instead] importing it into..., scaling it, and then exporting it out of... Blender?
Do you mean making a separate, slower animation? That won't work. The crystal has to be able to smoothly transition between the two speeds. AnimationComponent:crossfade(), while a very cool function, won't be enough for that, since it starts the new animation from its beginning; the animation would appear to go extremely fast and/or backwards during the fade period, depending on when the player clicks the crystal.
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: Ask a simple question, get a simple answer

Post by zimberzimber »

Found a better (I think) solution that involves two extra timers and a counter.
One timer for fading in the colors, will increment the counter and change the models emissive color accordingly, and the second timer does the same but decrements them instead.
End result wrong colors
My asset pack [v1.10]
Features a bit of everything! :D
minmay
Posts: 2768
Joined: Mon Sep 23, 2013 2:24 am

Re: Ask a simple question, get a simple answer

Post by minmay »

Isaac wrote:The obvious choice is remove the "hand_caster" trait, but that seems to be hard coded; it does not get removed, and is impossible to add by champion:addTrait("hand_caster").
Sorry, missed this question. If you use defineTrait() to define a trait called "hand_caster" (with no additional effects) then you should be able to add and remove the trait at will and it will work like you want it to.
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.
Post Reply