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!
bongobeat
Posts: 1076
Joined: Thu May 16, 2013 5:58 pm
Location: France

Re: Ask a simple question, get a simple answer

Post by bongobeat »

ok,
thank you for the answer.
My asset pack: viewtopic.php?f=22&t=9320

Log1 mod : Toorum Manor: viewtopic.php?f=14&t=5505
minmay
Posts: 2780
Joined: Mon Sep 23, 2013 2:24 am

Re: Ask a simple question, get a simple answer

Post by minmay »

Skuggasveinn wrote: Thu Jul 25, 2019 4:00 pm
bongobeat wrote: Thu Jul 25, 2019 1:31 pm is that possible to play the same animation for 2 same model in this object?
yes but, offsetting a model doesn't offset the animation, so when the animation plays on the second model it will "jump" into the original position.
What you want is to offset the animation in blender and save it out for the second model.

kind regards.
Skuggasveinn.
This depends on the animation. Some animations set the position of RootNode and some don't. As it happens, the animation bongobeat is using doesn't; it will keep the offset.
Anyway, to animate two models, you need two AnimationComponents:

Code: Select all

defineObject{
	name = "forest_spruce_sapling_pillar_2x1",
--	baseObject = "base_pillar",
	components = {
		{
			class = "Model",
			model = "assets/models/env/forest_spruce_sapling_02.fbx",
			staticShadow = true,
		},
		{
			class = "Animation",
			animations = {
				sway = "assets/animations/env/forest_spruce_sapling_02_idle.fbx",
			},
			playOnInit = "sway",
			loop = true,
		},
		{
			class = "Model",
			name = "pil2",
			model = "assets/models/env/forest_spruce_sapling_02.fbx",
			offset = vec(0, 0, -3),
			staticShadow = true,
		},
		{
			class = "Animation",
			name = "animation2",
			model = "pil2",
			animations = {
				sway = "assets/animations/env/forest_spruce_sapling_02_idle.fbx",
			},
			playOnInit = "sway",
			loop = true,
		},
	},
	placement = "pillar",
	editorIcon = 108,
	minimalSaveState = true,
}
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: 3185
Joined: Fri Mar 02, 2012 10:02 pm

Re: Ask a simple question, get a simple answer

Post by Isaac »

That is a really great tip. I was unaware that the model could be specified. 8-) 8-) 8-)
User avatar
vanblam
Posts: 243
Joined: Sun Nov 09, 2014 12:15 am

Re: Ask a simple question, get a simple answer

Post by vanblam »

How do you control the direction the party's facing when you exit stairs. I have 2 stairs on the same level that are facing different directions, how do I control what direction there facing when they exit the other side?
User avatar
Isaac
Posts: 3185
Joined: Fri Mar 02, 2012 10:02 pm

Re: Ask a simple question, get a simple answer

Post by Isaac »

Via script placing their position, or [in editor] via invisible teleporter with its destination set to its own tile, and its spin feature set to the direction.

(Of course you'll have to suitably handle the teleporter behavior afterwards, to allow them to reenter the stairs without effect.)
User avatar
vanblam
Posts: 243
Joined: Sun Nov 09, 2014 12:15 am

Re: Ask a simple question, get a simple answer

Post by vanblam »

Isaac wrote: Wed Aug 07, 2019 7:27 pm Via script placing their position, or [in editor] via invisible teleporter with its destination set to its own tile, and its spin feature set to the direction.

(Of course you'll have to suitably handle the teleporter behavior afterwards, to allow them to reenter the stairs without effect.)
I forgot about the invisible teleporter LOL. Been creating assets so much I almost forgot how to build a level :P One more question, is it possible to remove the fade?
minmay
Posts: 2780
Joined: Mon Sep 23, 2013 2:24 am

Re: Ask a simple question, get a simple answer

Post by minmay »

You can hack around the fade on StairsComponent/ExitComponent by calling GameMode.fadeIn(0,0) every frame. However, this won't give you seamless stairs as the party's stair climbing animation doesn't quite actually reach the top/bottom.
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
Lorial
Posts: 91
Joined: Sat Dec 29, 2018 12:27 pm

Re: Ask a simple question, get a simple answer

Post by Lorial »

I received bug reports for custom alcoves which I gave additional components, namely "Clickable" and "Surface". However, bugs were reported saying that after a save&reload, items placed inside cannot be retrieved anymore. I assume the clickable option is lost during a save.

I deleted the minimalSaveState bit and upon starting a new custom dungeon it seemed to work just fine, but I am uncertain whether this really fixed the issue. In the Grimrock Asset Pack all the "pedestals" use the minimalaveState, so I am not sure.
Any idea?

Code: Select all

defineObject{
	name = "catacomb_alcove_candle_02",
	baseObject = "base_wall",
	components = {
		{
			class = "Model",
			model = "assets/models/env/catacomb_alcove_candle_02.fbx",
			staticShadow = true,
		},
		{
			class = "Light",
			range = 3.5,
			color = vec(1.1, 0.68, 0.35),
			brightness = 7,
			castShadow = true,
			staticShadows = true,
			staticShadowDistance = 0,
			shadowMapSize = 256,
			fillLight = true,
			offset = vec(-0.3, 1.15, 0.15),
			onUpdate = function(self)
				local noise = math.noise(Time.currentTime()*3 + 123) * 0.5 + 0.9
				self:setBrightness(noise * 10)
			end,
		},
		{
			class = "Particle",
			particleSystem = "catacomb_alcove_candles_02",
		},
		{
			class = "Surface",
			offset = vec(0, 0.85, 0.2),
			size = vec(1, 0.65),
		},
		{
			class = "Clickable",
			offset = vec(0, 0.85+0.1, 0),
			size = vec(1.1, 0.2, 0.9),
			pedestal = true,
		},
		{
			class = "Occluder",
			model = "assets/models/env/catacomb_alcove_01_occluder.fbx",
		},
	},
	editorIcon = 92,
--	minimalSaveState = true,
}
User avatar
Lorial
Posts: 91
Joined: Sat Dec 29, 2018 12:27 pm

Re: Ask a simple question, get a simple answer

Post by Lorial »

For a custom tile damaging spell (similar to fireburst and shockburst), how can I prevent casting in front of the party if the tile is blocked?
Apparently, this can lead to a CTD at the edge of a level and allows cheating by casting through grates and even solid walls.
minmay
Posts: 2780
Joined: Mon Sep 23, 2013 2:24 am

Re: Ask a simple question, get a simple answer

Post by minmay »

Lorial wrote: Fri Aug 09, 2019 5:47 amIn the Grimrock Asset Pack all the "pedestals" use the minimalaveState, so I am not sure.
This is not true. There is only one pedestal in the asset pack and it does not have minimalSaveState. Objects that have SurfaceComponents or SocketComponents, including the object you posted, will break if you give them minimalSaveState.
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