[Technique] Simulate Old School (no map)

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!
Batty
Posts: 509
Joined: Sun Apr 15, 2012 7:04 pm

Re: [Technique] Simulate Old School (no map)

Post by Batty »

TSotP wrote:i don't know, i could see an application for this on a mod that actually has you find a 'Journal' and 'pen' to actually be able to draw your map.

it could be set that once you have Journal, Pen and Rest, you become able to see your map (as so far explored) giving the impression that you sat down and drew out your map before 'camping' for the night.

and if there was a way, have the map not auto update while exploring, but requiring a 'rest' before updating.
I like that idea, the automap seems too easy...it needs some procedure to it. You could even have the pen run out of ink... :)
macBos
Posts: 35
Joined: Mon Jun 03, 2013 9:52 pm

Re: [Technique] Simulate Old School (no map)

Post by macBos »

I was wondering about disabling automap too because there are a lot of simple walls in my dungeon which are just not displayed on automap and moreover tiles behind such walls are displayed too. That look just silly and also reveals to player areas which I, as dungeon creator, didn't planned to reveal.

I found particular solution using Map:setAutomapTile() method:
(place in script on dungeon's level where you don't want to fully draw the automap)
SpoilerShow

Code: Select all

for x = 0, 31 do
    for y = 0, 31 do
        self.go.map:setAutomapTile(x, y, 3)
    end
end
It sets like whole level is filled with walls. I observed that value of 3 represents solid wall, value 2 for example represents water, etc.
With this solution player still can see the map but it is not helpful for him at all. As I am saying - not perfect solution but can be usable for someone (like me, because I didn't find better solution so far ;) ).
User avatar
Soaponarope
Posts: 180
Joined: Thu Oct 04, 2012 3:21 am

Re: [Technique] Simulate Old School (no map)

Post by Soaponarope »

A way to disable sections of map while leaving the rest on would be great. I don't want to force players to play old school but have ideas for puzzles which the automap spoils badly.

Perhaps a new feature to have a mapping layer that simply works like the reflection or noise layer's on and off states. Any highlighted tiles in the layer would then not show on automap while the rest would.
User avatar
Aisuu
Posts: 61
Joined: Fri Oct 31, 2014 2:07 pm

Re: [Technique] Simulate Old School (no map)

Post by Aisuu »

macBos wrote:I was wondering about disabling automap too because there are a lot of simple walls in my dungeon which are just not displayed on automap and moreover tiles behind such walls are displayed too. That look just silly and also reveals to player areas which I, as dungeon creator, didn't planned to reveal.

I found particular solution using Map:setAutomapTile() method:
(place in script on dungeon's level where you don't want to fully draw the automap)
SpoilerShow

Code: Select all

for x = 0, 31 do
    for y = 0, 31 do
        self.go.map:setAutomapTile(x, y, 3)
    end
end
It sets like whole level is filled with walls. I observed that value of 3 represents solid wall, value 2 for example represents water, etc.
With this solution player still can see the map but it is not helpful for him at all. As I am saying - not perfect solution but can be usable for someone (like me, because I didn't find better solution so far ;) ).
How do I disable this function when I want party to start mapping again?
User avatar
Zo Kath Ra
Posts: 931
Joined: Sat Apr 21, 2012 9:57 am
Location: Germany

Re: [Technique] Simulate Old School (no map)

Post by Zo Kath Ra »

Soaponarope wrote:A way to disable sections of map while leaving the rest on would be great. I don't want to force players to play old school but have ideas for puzzles which the automap spoils badly.

Perhaps a new feature to have a mapping layer that simply works like the reflection or noise layer's on and off states. Any highlighted tiles in the layer would then not show on automap while the rest would.
You can use the MapGraphicsComponent to do this.

I've made a 2-level test dungeon where the entire automap in the lower level is overlayed by an image.
http://www.nexusmods.com/legendofgrimrock2/mods/86
You can adapt it to overlay only part of the automap on a particular level.

1) Define this object:

Code: Select all

defineObject{
	name = "automap_replacement",
	components = {
		{
			class = "MapGraphics",
			image = "mod_assets/textures/automap_replacement.dds", -- 960x960 (= 30x30 for each automap tile)
			--rotate = true,
			--offset0 = vec(0, 0),
			--offset1 = vec(0, 0),
			--offset2 = vec(0, 0),
			--offset3 = vec(0, 0),
		},
	},
	placement = "floor",
	editorIcon = 276,
}
Then put an automap_replacement at 0/0 in the level where you want the automap to be overlayed.
(if you want, you can define more than one object like this, so every level can have its own overlay image)
The .dds file was made with Gimp:
File -> Create -> Patterns -> Flatland

2) At every entrance to the level, put a floor trigger connected to this function inside a script entity:

Code: Select all

visited = {}

function setVisited()
	if (visited[party.level] == nil) then
		local party_x = party.x
		local party_y = party.y
		
		for x = 0, 31 do
			for y = 0, 31 do
				party:setPosition(x, y, party.facing, party.elevation, party.level)
			end
		end
		
		visited[party.level] = true
		
		party:setPosition(party_x, party_y, party.facing, party.elevation, party.level)
	end
end
The function setVisited() teleports the party to every square on the current map => every tile in the automap is marked as visited.
(there's a short delay while the function runs, but it's hardly noticeable even on my old computer)
Result: the entire automap is overlayed with automap_replacement.dds as soon as you enter the level.
Otherwise, you'd be able to see paths on the automap when you explore the level.
You can still see your position and put markers on the automap.

This method could also be used to replace the automap with a hand-drawn map.
The hand-drawn map could be enabled/disabled depending on whether the party is carrying a map scroll.
kelly1111
Posts: 349
Joined: Sun Jan 20, 2013 6:28 pm

Re: [Technique] Simulate Old School (no map)

Post by kelly1111 »

question about the use of setVisited. The party telports at every square of the map..
If I apply this will the party in the proces trigger things when entering the level... by teleporting everywhere (for instance a floor trigger?)
User avatar
Zo Kath Ra
Posts: 931
Joined: Sat Apr 21, 2012 9:57 am
Location: Germany

Re: [Technique] Simulate Old School (no map)

Post by Zo Kath Ra »

kelly1111 wrote: Thu Jan 31, 2019 9:15 pm question about the use of setVisited. The party telports at every square of the map..
If I apply this will the party in the proces trigger things when entering the level... by teleporting everywhere (for instance a floor trigger?)
It doesn't appear to trigger pressure plates or floor triggers.
But that answer is just from a few minutes of experimentation.

If the teleports did trigger pressure plates or floor triggers, then every function connected to them would have to check "Has this level been set to visited already?"
kelly1111
Posts: 349
Joined: Sun Jan 20, 2013 6:28 pm

Re: [Technique] Simulate Old School (no map)

Post by kelly1111 »

O Neat !!!
Now I can design custom drawn maps.. and insert them into my levels with a larger grid.
Post Reply