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 »

Hey there,

is that possible to make a stair that did not show the fade in animation?

(it's for somekind of stair, used to go in a 2nd floor in the same level)
My asset pack: viewtopic.php?f=22&t=9320

Log1 mod : Toorum Manor: viewtopic.php?f=14&t=5505
User avatar
THOM
Posts: 1274
Joined: Wed Nov 20, 2013 11:35 pm
Location: Germany - Cologne
Contact:

Re: Ask a simple question, get a simple answer

Post by THOM »

I had the same question a while ago. The answer was: No! If not minm- ...erm, a tech-freak meanwhile found a solution...
THOM formaly known as tschrage
_______________________________________________
My MOD (LoG1): Castle Ringfort Thread
My MOD (LoG2): Journey To Justice Thread | Download
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 »

THOM wrote:I had the same question a while ago. The answer was: No! If not minm- ...erm, a tech-freak meanwhile found a solution...
You could have an instant fade in apply once you go up/down the stairs.
Your party will jump a bit forward and there might be a single frame of blackness, but its something
My asset pack [v1.10]
Features a bit of everything! :D
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 based on what you've say here what I 've done:

SpoilerShow
Image
2 floor_triggers (on the screenshot, one is just where I stay - 2nd floor, one is at the bottom of the stairs), that trigger a timer and which timer trigger a script:

timer is set to 0.01 in interval, disable self should not be set, so the timer repetively trigger the scripts, until it is stopped by others floor_trigger. In this case I have put those floor trigger plates all around the trigger plate that start the timer.

the script is about to fade quickly:
SpoilerShow

Code: Select all

function noBlackScreen()
	GameMode.fadeIn(0x0,0.001)
end
SpoilerShow
Image
(I did not use a timer on the first time, and place the trigger plates, directly on the first square of the stairs, but it seems that the stairs has priority against the floor trigger, and the game didn't take in count the fadeIn things. So finaly I use a timer which runs infinitely, this works.)

So, it runs perfect until the party come at the end of the stair, where a quick black screen is shown, immediately fading in by the timer.

The bottom stair is a model (used to go up), in fact there is the only model that is shown. The upper stair(used to go down) is just an invisible stair without model, there is also an invisible platform on the same height of the upper stair, or the party will run into big troubles.

bottom stair:
SpoilerShow

Code: Select all

defineObject{
	name = "stairs_up_open",
	components = {
		{
			class = "Model",
			model = "mod_assets/models/stairs_up_open.fbx",
			staticShadow = true,
		},
		{
			class = "Stairs",
			direction = "up",
		},
		{
			class = "Obstacle",
			blockMonsters = true,
			blockParty = false,
			blockItems = true,
		},
	},
	placement = "floor",
	killHeightmap = true,
	editorIcon = 44,
	automapIcon = 96,
}
the bottom stairs block the items


upper stair:
SpoilerShow

Code: Select all

defineObject{
	name = "stairs_down_empty",
	components = {
		{
			class = "Stairs",
			direction = "down",
		},
		{
			class = "Obstacle",
			blockMonsters = true,
			blockParty = false,
			blockItems = false,
		},
	},
	placement = "floor",
	killHeightmap = true,
	editorIcon = 48,
	automapIcon = 100,
}
the upper stairs let the items pass.

the side wall at the entrance of the bottom stair are not real wall but wall_decoration, if not the stairs kill basic walls. So they have no occluders, well, I didn't try to use occluders on a wall decoration.
Also there is the issue with the ceilings, which are removed on top of the stairs.


I tryed with fake stairs and invisible teleporters to go up and down, but I like more the walking on stairs effect.
My asset pack: viewtopic.php?f=22&t=9320

Log1 mod : Toorum Manor: viewtopic.php?f=14&t=5505
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 »

You can bypass stairs killing walls/floors/pillars by initially placing them somewhere else where it won't interfere with anything, then have a script run on game start that'll move them to where you need em'.

Image
There is a stairs model (from sx_towntileset) that functions as a platform for the tile above it, so the party won't fall down and cause some horrible issues.
script entity above left stairs:

Code: Select all

dungeon_stairs_up_1:setPosition(self.go.x, self.go.y, self.go.facing, self.go.elevation, self.go.level)
script entity above right stairs:

Code: Select all

dungeon_stairs_down_4:setPosition(self.go.x, self.go.y, self.go.facing, self.go.elevation, self.go.level)
script entity above the others:

Code: Select all

function stairsFade()
  GameMode.fadeIn(0, 0)
end
-- There is a timer (not shown in the screenshot) that triggers this function every 0.01 seconds
scripts set the stairs to their location, stairs have invisible models and a custom location. However, I assume this'll be problematic if a player is to save/load a game.

Here's what it looks like in game: (Model is from sx_towntileset)
(The black frame is not seen in this gif due to compression)
Image

As you can see, they party 'jumps' a bit forward when using this method, which is why I prefer having fade in/out.

Biggest issue is the stairs killing pillars/floors/ceiling.
Floor isn't a problem, can be added to the stairs up as their model, and set the material based on what you need,
Placing ceilings manually works fine.
Pillars though... I have no idea how to fix em without a custom model. I tried using a high pillar and just place them below/above the required location, but placing the upper one didn't work because it got removed by stairs_down. An impractical fix would be editing a pillars model to look like its where you need it, but its real location is on a lower height.
My asset pack [v1.10]
Features a bit of everything! :D
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 »

Have you tried setting a custom destination for the stairs-down object, to the cell where the stairs-up object is?
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 »

Same effect as having a teleporter teleport you to a teleporter that would teleport you to the previous teleporter :P
My asset pack [v1.10]
Features a bit of everything! :D
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 »

I remember reading somewhere that you can attach items(models) to monsters via script, but I can't find it anywhere, nor am I able to figure it out myself.
Anyone knows anything about this, or was I just hallucinating?
My asset pack [v1.10]
Features a bit of everything! :D
minmay
Posts: 2780
Joined: Mon Sep 23, 2013 2:24 am

Re: Ask a simple question, get a simple answer

Post by minmay »

The parentNode component property makes the component adopt the transform of a node in a ModelComponent on the same object (location, rotation, scale). For example, the air_elemental monster uses it to keep the SoundComponent at the same 3D position as the monster's head:

Code: Select all

		{
			class = "Sound",
			sound = "air_elemental_wind",
			parentNode = "head",
		},
and the eyctopus monster uses it so the particles for the ink cloud come out of the monster's nether regions:

Code: Select all

		{
			class = "Particle",
			name = "analParticle",
			parentNode = "anal",
			particleSystem = "eyctopus_fart",
			enabled = false,
			--debugDraw = true,
		},
It's also supported on ModelComponent, LightComponent, and probably more. This object in ORRR3 uses it to make a ratling NPC hold a piece of cheese, without needing any new models, just a new animation.

Code: Select all

defineObject{
	name = "or3_ratling_smith",
	placement = "floor",
	components = {
		{
			class = "Model",
			model = "assets/models/monsters/ratling3.fbx",
			boundBox = {pos=vec(0,0.9,0.2),size=vec(3,1.8,2.5)},
			materialOverrides = {pistol="nothing"},
		},
		{
			class = "Model",
			name = "cheese",
			model = "assets/models/items/cheese.fbx",
			parentNode = "sword",
		},
		{
			class = "Animation",
			animations = {
				idle = "mod_assets/core/animations/ratling3_anvil_idle.fbx",
				getUp = "mod_assets/core/animations/ratling1_idle.fbx",
				hit = "assets/animations/monsters/ratling/ratling3_get_hit_front_left.fbx",
			},
			currentLevelOnly = true,
			playOnInit = "idle",
			loop = true,
		},
	},
	editorIcon = 4,
}
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 »

Attaching a model to a node for monsters with scaled down animations scales down the attached model, but the parent mesh gets resized to its original state :lol:
Rescaling models didn't help fixing it
My asset pack [v1.10]
Features a bit of everything! :D
Post Reply