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!
brzrkr
Posts: 11
Joined: Wed Aug 10, 2016 4:05 pm

Re: Ask a simple question, get a simple answer

Post by brzrkr »

Hi there, it's me again.
I was wondering, is there a way to prevent the auto map from mapping certain tiles? I've looked in the scripting reference but there doesn't seem to be anything appropriate. Is there a possible workaround to make it work, in case the code itself can't do that directly?
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 »

Do you mean ~not exposing the area of the map, (retaining the fog-of-war in certain places)?
Or do you mean not identifying certain objects on the exposed map?

*As for the Fog-Of-War... people can draw their own maps in a notebook; (and likely will, if a permanent fog is implemented).
brzrkr
Posts: 11
Joined: Wed Aug 10, 2016 4:05 pm

Re: Ask a simple question, get a simple answer

Post by brzrkr »

Isaac wrote:*As for the Fog-Of-War... people can draw their own maps in a notebook; (and likely will, if a permanent fog is implemented).
That's what I mean. I don't mind players mapping on their own, it's just a section of the map that I want having this little feature. Is it feasible?
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 a look at this project: https://www.dropbox.com/s/srqyshj4900d5 ... r.zip?dl=0

It implements a kind of Fog-of-War that keeps selected areas unrecorded on the map.

Image

In the editor there are two new fog_of_war assets, one obscures a single tile, and the other will obscure a definable region of tiles.
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'm having a weird issue with sockets. I've defined an object that features nothing but a bunch of sockets that hold items. So far so good.
The problem is that said items cannot be picked up from the tile the object is placed on, but only from adjacent tiles. And it doesn't matter where the socket is placed, even if its offset is -1.49, 0 , -1.49 and you're standing on the opposite tile.
Here's the object definition:

Code: Select all

defineObject{
	name = "river_sockets",
	baseObject = "base_floor_decoration",
	components = {
		{
			class = "Socket",
			name = "s1",
			offset = vec(0.35, 0, 1.49),
			rotation = vec(0, 0, 0),
			onInit = function(self)
				self:addItem(spawn("crystal_flower").item)
			end,
		},
		{
			class = "Socket",
			name = "s2",
			offset = vec(-0.35, 0, 1.1),
			rotation = vec(0, 0, 0),
			onInit = function(self)
				self:addItem(spawn("blooddrop_cap").item)
			end,
		},
		{
			class = "Socket",
			name = "s3",
			offset = vec(-0.35, 0, 0.4),
			rotation = vec(0, 0, 0),
			onInit = function(self)
				self:addItem(spawn("aether_weed").item)
			end,
		},
		{
			class = "Socket",
			name = "s4",
			offset = vec(0.8, -0.05, 0.55),
			rotation = vec(0, 0, 0),
			onInit = function(self)
				self:addItem(spawn("brass_key").item)
			end,
		},
		{
			class = "Socket",
			name = "s5",
			offset = vec(-0.5, 0, -0.85),
			rotation = vec(0, 0, 0),
			onInit = function(self)
				self:addItem(spawn("skull").item)
			end,
		},
	},
	placement = "floor",
	editorIcon = 104,
}
Also, how can I enable the source "console" for the script component on a non-script-entity (with the script component)?
My asset pack [v1.10]
Features a bit of everything! :D
brzrkr
Posts: 11
Joined: Wed Aug 10, 2016 4:05 pm

Re: Ask a simple question, get a simple answer

Post by brzrkr »

Isaac wrote:Have a look at this project: https://www.dropbox.com/s/srqyshj4900d5 ... r.zip?dl=0

It implements a kind of Fog-of-War that keeps selected areas unrecorded on the map.

http://i271.photobucket.com/albums/jj12 ... 7hw5lo.jpg

In the editor there are two new fog_of_war assets, one obscures a single tile, and the other will obscure a definable region of tiles.
Thanks, that was very useful.
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 »

So my question is... is there a way to select the Question-mark icon for a spawned map marker?
zimberzimber wrote:Also, how can I enable the source "console" for the script component on a non-script-entity (with the script component)?
If you mean view the script in the inspector, in editor... That will happen automatically if you set the script source in the object definition.

It's a runtime event if you set it via the onInit hook [instead]... and does not display during the preview.
minmay
Posts: 2780
Joined: Mon Sep 23, 2013 2:24 am

Re: Ask a simple question, get a simple answer

Post by minmay »

Isaac wrote:So my question is... is there a way to select the Question-mark icon for a spawned map marker?
You cannot change the MapMarkerComponent symbol dynamically but you can set it in the object definition.

Code: Select all

defineObject{
	name = "map_marker_question",
	placement = "floor",
	components = {
		{
			class = "MapMarker",
			symbol = "question",
		},
	}
}
defineObject{
	name = "map_marker_cross",
	placement = "floor",
	components = {
		{
			class = "MapMarker",
			symbol = "cross",
		},
	}
}
defineObject{
	name = "map_marker_exclamation",
	placement = "floor",
	components = {
		{
			class = "MapMarker",
			symbol = "exclamation",
		},
	}
}
zimberzimber wrote:I'm having a weird issue with sockets. I've defined an object that features nothing but a bunch of sockets that hold items. So far so good.
The problem is that said items cannot be picked up from the tile the object is placed on, but only from adjacent tiles. And it doesn't matter where the socket is placed, even if its offset is -1.49, 0 , -1.49 and you're standing on the opposite tile.
Here's the object definition:

Code: Select all

defineObject{
	name = "river_sockets",
	baseObject = "base_floor_decoration",
	components = {
		{
			class = "Socket",
			name = "s1",
			offset = vec(0.35, 0, 1.49),
			rotation = vec(0, 0, 0),
			onInit = function(self)
				self:addItem(spawn("crystal_flower").item)
			end,
		},
		{
			class = "Socket",
			name = "s2",
			offset = vec(-0.35, 0, 1.1),
			rotation = vec(0, 0, 0),
			onInit = function(self)
				self:addItem(spawn("blooddrop_cap").item)
			end,
		},
		{
			class = "Socket",
			name = "s3",
			offset = vec(-0.35, 0, 0.4),
			rotation = vec(0, 0, 0),
			onInit = function(self)
				self:addItem(spawn("aether_weed").item)
			end,
		},
		{
			class = "Socket",
			name = "s4",
			offset = vec(0.8, -0.05, 0.55),
			rotation = vec(0, 0, 0),
			onInit = function(self)
				self:addItem(spawn("brass_key").item)
			end,
		},
		{
			class = "Socket",
			name = "s5",
			offset = vec(-0.5, 0, -0.85),
			rotation = vec(0, 0, 0),
			onInit = function(self)
				self:addItem(spawn("skull").item)
			end,
		},
	},
	placement = "floor",
	editorIcon = 104,
}
SocketComponent is very finicky about allowing the player to take items out of it. It's specialized for the beach puzzle statue and the essence holder statues (which are themselves questionable) and often you are better served with a SurfaceComponent that uses an onAcceptItem hook to only allow one item to be inserted. In this case, you don't let the player insert items at all, which suggests to me that you don't want to use either component - just place the items in the editor and set their world position to the desired position.
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 »

minmay wrote:symbol = "question",
Thank you. I could not find that written anywhere; but I suppose I missed it somewhere.
@brzrkr minmay's solution above can be used to change the map marker icon from feather to the question mark, in the fog-of-war script... if you use it.
... just place the items in the editor and set their world position to the desired position.
That was going to be my suggestion as well. I wrote a function that spawns those items at the script's location, then offsets from the script's world location. It worked, but something odd happened... I had the script print all of the item and script world location tables, and the printed numbers never changed between previews [as expected], but the on screen locations of each item did; often by up to an in-game foot and a half. The same thing happened when I used subtileOffset, (which I had tried using before switching to setWorldPosition).

*I wondered if accurate positioning was the only reason for choosing sockets.
minmay
Posts: 2780
Joined: Mon Sep 23, 2013 2:24 am

Re: Ask a simple question, get a simple answer

Post by minmay »

Isaac wrote:
minmay wrote:symbol = "question",
Thank you. I could not find that written anywhere; but I suppose I missed it somewhere.
No, it was never documented anywhere before my post.
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