Blockage Problem

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
Eleven Warrior
Posts: 752
Joined: Thu Apr 18, 2013 2:32 pm
Location: Australia

Blockage Problem

Post by Eleven Warrior »

Hi to any one who can help with this. Ok I have a fake wall with a door. I can make the fake wall an obstacle no problems, but when you walk towards the wall you are stopped by the Blockage 1 tile in front of the wall. What I need to know is how do you allow the player to walk up to the wall face to face, but they cant pass through it. Here is the code I have ATM (below). I can make this wall a door, but that seems stupid, why because if you have lots of these fake wall-doors on the levels, I believe it will slow the game down sooner or later I think. I need to know how I can make the blockage around the wall shrink to a door blockage area. I do hope this makes sense lol :)

Code: Select all

defineObject{
	name = "sx_town_door",
	components = {
    {
	class = "Model",
	model = "mod_assets/sx_towntileset/models/sx_town_door.fbx",
    },
	{
		class = "Obstacle",
		blockItems = true,
		blockMonsters = true,
		blockParty = true,
		repelProjectiles = true,
		},
		{
		class = "ProjectileCollider",
		size = vec(0.4,1,1),
		},
  },
  placement = "wall",
  editorIcon = 120,
}
Batty
Posts: 509
Joined: Sun Apr 15, 2012 7:04 pm

Re: Blockage Problem

Post by Batty »

Placing a door and unchecking "model" in the inspector is the simple way to do it. You could place hundreds of them, probably thousands, it won't slow the game down. Lighting & water slow the game.
minmay
Posts: 2790
Joined: Mon Sep 23, 2013 2:24 am

Re: Blockage Problem

Post by minmay »

Use a DoorComponent. It's how the mine support walls etc. do it; look at the asset pack.
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.
Grimfan
Posts: 369
Joined: Wed Jan 02, 2013 7:48 am

Re: Blockage Problem

Post by Grimfan »

Batty wrote:Placing a door and unchecking "model" in the inspector is the simple way to do it. You could place hundreds of them, probably thousands, it won't slow the game down. Lighting & water slow the game.
I second this. One of the best things about components is the amount they can be manipulated.
User avatar
Eleven Warrior
Posts: 752
Joined: Thu Apr 18, 2013 2:32 pm
Location: Australia

Re: Blockage Problem

Post by Eleven Warrior »

Ok I checked out the mine lua file and found what I needed and this is what I have (code below). It works the way I want it to but in the editor it says (gate node not found on sx_town_door_1) I do not know what is missing or what a gate node is lol.

Code: Select all

defineObject{
	name = "sx_town_door",
	components = {
		{
		class = "Model",
		model = "mod_assets/sx_towntileset/models/sx_town_door.fbx",
		staticShadow = true,
		},
		{
		class = "Door",
		sparse = true,
		hitSound = "impact_blunt",
		},
	},
	placement = "wall",
	editorIcon = 160,
	automapIcon = 88,
	minimalSaveState = true,
}
User avatar
MadCatter
Posts: 34
Joined: Mon Nov 03, 2014 5:02 am
Location: Southampton, UK

Re: Blockage Problem

Post by MadCatter »

I had problems with this for a while too.

With your custom model, in GMT where you set the materials you simply need to select the model node from the drop-down box and type "gate" into the box that says name, then click Update Node and re-save your model.
The gate node is the part that grimrock animates with the opening/closing. All door nodes have this name, I guess for consistencies sake.
User avatar
Eleven Warrior
Posts: 752
Joined: Thu Apr 18, 2013 2:32 pm
Location: Australia

Re: Blockage Problem

Post by Eleven Warrior »

Thxs Madcatter it did the trick awesome man now I can continue with the Sx Town Set thanks again :) 4 Kuddos added.
User avatar
Eleven Warrior
Posts: 752
Joined: Thu Apr 18, 2013 2:32 pm
Location: Australia

Re: Blockage Problem

Post by Eleven Warrior »

Hi again lol. I am trying to get this Object to move left or right (Below code). I can move the object up/down and forward and backwards NP. I am using the offset = vec routine. 0.3, 0.5 = up/down + 0,0,0 = back/forward I think which works on one of the 0's. Does anyone know how I can move this object left or right?

I can do it in the Editor using setworldpositon, but this is not what I need. The object below is the water effect on the wall fountain thxs for any help :)

Code: Select all

defineObject{
	name = "sx_fountain_effect",
	components = {
		{
			class = "Particle",
			particleSystem = "sx_fountain_effect",
			offset = vec(0.3, 0.5 + 0, 0, 0),
			--offset = vec(0.3, 0.3, 0,1),
		},
		{
			class = "Light",
			offset = vec(0, 1.8, 0),
			range = 5,
			color = vec(0.2, 0.75, 0.5),
			brightness = 4,
			fillLight = true,
		},
			{
			class = "Controller",
			onActivate = function(self)
				self.go.light:enable()
				self.go.particle:enable()
			end,
			onDeactivate = function(self)
				self.go.light:disable()
				self.go.particle:disable()
			end,
			onToggle = function(self)
				if self.go.light:isEnabled() then
					self.go.light:disable()
					self.go.particle:disable()
				else
					self.go.light:enable()
					self.go.particle:enable()
				end
			end,
		},
	},
	placement = "floor",
	editorIcon = 88,
}
User avatar
Drakkan
Posts: 1318
Joined: Mon Dec 31, 2012 12:25 am

Re: Blockage Problem

Post by Drakkan »

Eleven Warrior wrote:Hi again lol. I am trying to get this Object to move left or right (Below code). I can move the object up/down and forward and backwards NP. I am using the offset = vec routine. 0.3, 0.5 = up/down + 0,0,0 = back/forward I think which works on one of the 0's. Does anyone know how I can move this object left or right?

I can do it in the Editor using setworldpositon, but this is not what I need. The object below is the water effect on the wall fountain thxs for any help :)

Code: Select all

defineObject{
	name = "sx_fountain_effect",
	components = {
		{
			class = "Particle",
			particleSystem = "sx_fountain_effect",
			offset = vec(0.3, 0.5 + 0, 0, 0),
			--offset = vec(0.3, 0.3, 0,1),
		},
		{
			class = "Light",
			offset = vec(0, 1.8, 0),
			range = 5,
			color = vec(0.2, 0.75, 0.5),
			brightness = 4,
			fillLight = true,
		},
			{
			class = "Controller",
			onActivate = function(self)
				self.go.light:enable()
				self.go.particle:enable()
			end,
			onDeactivate = function(self)
				self.go.light:disable()
				self.go.particle:disable()
			end,
			onToggle = function(self)
				if self.go.light:isEnabled() then
					self.go.light:disable()
					self.go.particle:disable()
				else
					self.go.light:enable()
					self.go.particle:enable()
				end
			end,
		},
	},
	placement = "floor",
	editorIcon = 88,
}
As I already made some minor changes with offset I am aware there are actually 4 parms, not just three. I was able to move object any way I think
offset = vec(0,0,0,0),

also please be aware (perhaps you already noticed) that if you change some of this inside script and just reload editor it will not come true, you have to "hard reset" whole editor. Just an observation perhaps it helps you a little.
Breath from the unpromising waters.
Eye of the Atlantis
Post Reply