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
Isaac
Posts: 3185
Joined: Fri Mar 02, 2012 10:02 pm

Re: Ask a simple question, get a simple answer

Post by Isaac »

You could disable the other components that you no longer wish to be active, and the delay can be done with a timer, or the delayedCall function.
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 »

I see, oh the onAnimationEvent does not seem to work for this btw, does it only recognize grimrock 2 animations? or am not understanding how it works?
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 »

LoG2 animations are different than those from LoG1, but you can convert them through the Blender LoG export script.

For what you are doing, it could be done from the onClick, in the Clickable component.

The onAnimationEvent hook works in tandem with separately defined animation events. The purpose of these are to call the hook during the play of a specific animation file, and at a specific frame number; or percentage of the duration.

When the event is called, the event receives the [event] name of the calling animationEvent.
defineAnimationEvent(desc)
Defines a new animation event. desc is a table with the following fields:

animation:the name of animation file to attach animation event to. The filename must end with “.fbx”
event:the animation event string, e.g. “footstep” or “attack”.
frame:(optional) a frame number in the animation to attach the event to (one frame equals 1/30th of a second).
normalizedTime:(optional) normalized time of the event in range 0-1 to be used instead of frame (0 = start of animation, 1 = end of animation).
Example:

Code: Select all

defineAnimationEvent{
		animation = "assets/animations/monsters/skeleton_warrior/skeleton_warrior_walk.fbx",
		event = "footstep",
		frame = 20,
	}
The above event allows one to know when frame 20 is reached in the skeleton_warrior_walk. At frame 20, the onAnimationEvent is called, and the string "footstep" is passed to it. The event string can be an arbitrarily chosen string; it is passed to the hook when it is called.

It is also possible to play a sound effect as the event, like so:

Code: Select all

--In the animationEvent
--
event = "playSound:impact_blade",
--
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 »

Ahh ok, now I see. Thanks man :D
Pompidom
Posts: 497
Joined: Sun May 06, 2018 9:42 pm

Re: Ask a simple question, get a simple answer

Post by Pompidom »

I was thinking about the option of "skinning" or "recovering" resources.
Mainly skeleton corpses.

A custom "skinning_knife" that detects if a dm_floordeco_skeleton is in front of the party.

Maybe basically something like the shovel mechanic, in case you have a skeleton corpse in front of you
you can remove and polish the skull and recover some bones from it.


if dm_floordeco_skeleton is true
then ...
...
floordeco_corpse:destroy()
spawn("dirt_patch")
spawn("skull")
spawn("skeletal_bone")

What are my options here?
Pompidom
Posts: 497
Joined: Sun May 06, 2018 9:42 pm

Re: Ask a simple question, get a simple answer

Post by Pompidom »

Normally objects on a square get pushed to the side you're walking on to the square.
Objects dropped by skeletons don't move to the side of a square when walking on those squares however, probably blocked by the freshly spawned dm_floordeco_skeleton object. They're just lying there in the middle of the square. It's still perfectly possible to pick them up but mostly the only way to pick them up is during movement only. You can't pick them up anymore when you're standing over them or next to them.

Can I change something to this object so that it doesn't block items from being pushed on the square?

Code: Select all

defineObject{
	name = "dm_floordeco_skeleton",
	baseObject = "dm_redcarpet_tile",
	components = {
		{
			class = "Model",
			model = "mod_assets/dmcsb_pack/models/env/dm_floor_skeleton.fbx",
			staticShadow = true,
		},
		{
			class = "ItemConstrainBox",
			offset = vec(0,0.2,0),
			size = vec(0.7,0.4,2.2),
		},
	},
	editorIcon = 136,
}
User avatar
Zo Kath Ra
Posts: 937
Joined: Sat Apr 21, 2012 9:57 am
Location: Germany

Re: Ask a simple question, get a simple answer

Post by Zo Kath Ra »

Pompidom wrote: Mon May 06, 2019 1:48 pm Can I change something to this object so that it doesn't block items from being pushed on the square?
ItemConstrainBox
viewtopic.php?f=22&t=9336
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 »

Silly question, is there a way to change the tint on a materials diffuse in the definition? example: I want to add a little red to the "mine_pressure_plate" material in my own material definition with out adding a new texture, is that possible?
minmay
Posts: 2780
Joined: Mon Sep 23, 2013 2:24 am

Re: Ask a simple question, get a simple answer

Post by minmay »

No, though again, you can try to fake it by using emissive color.
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
vanblam
Posts: 243
Joined: Sun Nov 09, 2014 12:15 am

Re: Ask a simple question, get a simple answer

Post by vanblam »

minmay wrote: Sun May 12, 2019 1:24 am No, though again, you can try to fake it by using emissive color.
I was thinking about that, but it wont receive lighting correctly right?
Post Reply