Page 1 of 1

Restricting Worldmap Viewing Field

Posted: Mon Dec 14, 2020 8:02 am
by DrMekar
Image

I just finished the Worldmap of MH1.5's World 5, so since I used some abstract Methods to create it, I can't continue it outside of the
Playable Zone. Therefore I wondered if it would be possible to restrict the Players Viewing Field to the Worldmap "Box".

Thanks in Advance for any assistance.

Re: Restricting Worldmap Viewing Field

Posted: Mon Dec 14, 2020 8:11 am
by Emral
You can use camlock, defining the boundaries as an area at least 800x600 big to serve as the camera boundaries (independent of any overlays that further reduce the size of the viewport)

Re: Restricting Worldmap Viewing Field

Posted: Mon Dec 14, 2020 8:48 am
by DrMekar
Enjl wrote:
Mon Dec 14, 2020 8:11 am
You can use camlock, defining the boundaries as an area at least 800x600 big to serve as the camera boundaries (independent of any overlays that further reduce the size of the viewport)
Ah, Okay.

Regarding Width and Height, what do I enter there?
The amount of Tiles from left to right/top to bottom?
(The Whole Map is of course only a single Tile in reality.)

Re: Restricting Worldmap Viewing Field

Posted: Mon Dec 14, 2020 8:58 am
by Emral
DrMekar wrote:
Mon Dec 14, 2020 8:48 am
Enjl wrote:
Mon Dec 14, 2020 8:11 am
You can use camlock, defining the boundaries as an area at least 800x600 big to serve as the camera boundaries (independent of any overlays that further reduce the size of the viewport)
Ah, Okay.

Regarding Width and Height, what do I enter there?
The amount of Tiles from left to right/top to bottom?
(The Whole Map is of course only a single Tile in reality.)
Usually (like here, too), measurements for width and height are done in pixels. Width must at least be 800, and height must at least be 600, since that's the size of the camera. Camlock restricts the camera to a rectangle once the player is inside that rectangle, and the camera cannot fit into an area smaller than itself.

Re: Restricting Worldmap Viewing Field

Posted: Mon Dec 14, 2020 9:13 am
by DrMekar
I did it, though Nothing changed. My Tile is 865x672, therefore it should work.

The Code:

Code: Select all

local camLock = API.load("camLock")
camLock.addZone(6208,-5792,865,672,0)

Re: Restricting Worldmap Viewing Field

Posted: Mon Dec 14, 2020 10:28 am
by Emral
DrMekar wrote:
Mon Dec 14, 2020 9:13 am
I did it, though Nothing changed. My Tile is 865x672, therefore it should work.

The Code:

Code: Select all

local camLock = API.load("camLock")
camLock.addZone(6208,-5792,865,672,0)
Try putting 1 as the last argument.

Re: Restricting Worldmap Viewing Field

Posted: Mon Dec 14, 2020 10:40 am
by DrMekar
Enjl wrote:
Mon Dec 14, 2020 10:28 am
DrMekar wrote:
Mon Dec 14, 2020 9:13 am
I did it, though Nothing changed. My Tile is 865x672, therefore it should work.

The Code:

Code: Select all

local camLock = API.load("camLock")
camLock.addZone(6208,-5792,865,672,0)
Try putting 1 as the last argument.
I did. Still refuses to work. I also tried it with the Bottom, Top, Left and Right
Coordinates as an alternative with the same result.

Re: Restricting Worldmap Viewing Field

Posted: Mon Dec 14, 2020 10:48 am
by Emral
DrMekar wrote:
Mon Dec 14, 2020 10:40 am
Enjl wrote:
Mon Dec 14, 2020 10:28 am
DrMekar wrote:
Mon Dec 14, 2020 9:13 am
I did it, though Nothing changed. My Tile is 865x672, therefore it should work.

The Code:

Code: Select all

local camLock = API.load("camLock")
camLock.addZone(6208,-5792,865,672,0)
Try putting 1 as the last argument.
I did. Still refuses to work. I also tried it with the Bottom, Top, Left and Right
Coordinates as an alternative with the same result.
It works for me, using the camlock from SMBX2 beta 4's installation.
Are 6208,-5792 the left and top edges of the box respectively?

Re: Restricting Worldmap Viewing Field

Posted: Mon Dec 14, 2020 10:56 am
by DrMekar
Enjl wrote:
Mon Dec 14, 2020 10:48 am
DrMekar wrote:
Mon Dec 14, 2020 10:40 am
Enjl wrote:
Mon Dec 14, 2020 10:28 am


Try putting 1 as the last argument.
I did. Still refuses to work. I also tried it with the Bottom, Top, Left and Right
Coordinates as an alternative with the same result.
It works for me, using the camlock from SMBX2 beta 4's installation.
Are 6208,-5792 the left and top edges of the box respectively?
Image
They are. I also have the newest Patch, Patch 3.
I was about to look it up on the PGE Wiki, but found your Libary, which is what I'm using.

Re: Restricting Worldmap Viewing Field

Posted: Mon Dec 14, 2020 10:58 am
by Emral
DrMekar wrote:
Mon Dec 14, 2020 10:56 am
Enjl wrote:
Mon Dec 14, 2020 10:48 am
DrMekar wrote:
Mon Dec 14, 2020 10:40 am


I did. Still refuses to work. I also tried it with the Bottom, Top, Left and Right
Coordinates as an alternative with the same result.
It works for me, using the camlock from SMBX2 beta 4's installation.
Are 6208,-5792 the left and top edges of the box respectively?
Image
They are. I also have the newest Patch, Patch 3.
I was about to look it up on the PGE Wiki, but found your Libary, which is what I'm using.
Camlock is included in beta 4. The version posted to the forums may be outdated.

Re: Restricting Worldmap Viewing Field

Posted: Mon Dec 14, 2020 11:08 am
by DrMekar
Enjl wrote:
Mon Dec 14, 2020 10:58 am
DrMekar wrote:
Mon Dec 14, 2020 10:56 am
Enjl wrote:
Mon Dec 14, 2020 10:48 am


It works for me, using the camlock from SMBX2 beta 4's installation.
Are 6208,-5792 the left and top edges of the box respectively?
Image
They are. I also have the newest Patch, Patch 3.
I was about to look it up on the PGE Wiki, but found your Libary, which is what I'm using.
Camlock is included in beta 4. The version posted to the forums may be outdated.
local camLock = require("camlock")
camLock.addZone(6208,-5792,862,672,1)
Okay, I used the included Version now, though still without results.
I did found this into camlock local vectr = require("vectr"), do I need
to name this in my lunaoverworld too?

Re: Restricting Worldmap Viewing Field

Posted: Mon Dec 14, 2020 11:13 am
by Emral
DrMekar wrote:
Mon Dec 14, 2020 11:08 am
Enjl wrote:
Mon Dec 14, 2020 10:58 am
DrMekar wrote:
Mon Dec 14, 2020 10:56 am


Image
They are. I also have the newest Patch, Patch 3.
I was about to look it up on the PGE Wiki, but found your Libary, which is what I'm using.
Camlock is included in beta 4. The version posted to the forums may be outdated.
local camLock = require("camlock")
camLock.addZone(6208,-5792,862,672,1)
Okay, I used the included Version now, though still without results.
I did found this into camlock local vectr = require("vectr"), do I need
to name this in my lunaoverworld too?
No. Like I said, it works for me with the included one, so the problem here is probably elsewhere? If you can send me the necessary files, I can take a look.

Re: Restricting Worldmap Viewing Field

Posted: Mon Dec 14, 2020 11:19 am
by DrMekar
Enjl wrote:
Mon Dec 14, 2020 11:13 am
DrMekar wrote:
Mon Dec 14, 2020 11:08 am
Enjl wrote:
Mon Dec 14, 2020 10:58 am

Camlock is included in beta 4. The version posted to the forums may be outdated.
local camLock = require("camlock")
camLock.addZone(6208,-5792,862,672,1)
Okay, I used the included Version now, though still without results.
I did found this into camlock local vectr = require("vectr"), do I need
to name this in my lunaoverworld too?
No. Like I said, it works for me with the included one, so the problem here is probably elsewhere? If you can send me the necessary files, I can take a look.
Okay. Here're the Files: https://www.mediafire.com/file/8249fsx4 ... s.zip/file

It includes my Worldmap File, My LuaOverworld and the Tile in Question, hope that's everything needed.

Re: Restricting Worldmap Viewing Field

Posted: Mon Dec 14, 2020 11:29 am
by Emral
rename the lua file to map.lua and edit it like follows:

Code: Select all

for i=1, 36 do
	if i ~= 14 then
		local s = Graphics.loadImage("tile-" .. i .. ".png") --why does graphics.sprites not work for this...?
		if s then
			for k,v in pairs(Tile.get(i)) do
				v.width = s.width
				v.height = s.height
			end
		end
	end
end

local camLock = require("camlock")
camLock.addZone(6208,-5792,862,672,1)

Re: Restricting Worldmap Viewing Field

Posted: Mon Dec 14, 2020 11:35 am
by DrMekar
Enjl wrote:
Mon Dec 14, 2020 11:29 am
rename the lua file to map.lua and edit it like follows:

Code: Select all

for i=1, 36 do
	if i ~= 14 then
		local s = Graphics.loadImage("tile-" .. i .. ".png") --why does graphics.sprites not work for this...?
		if s then
			for k,v in pairs(Tile.get(i)) do
				v.width = s.width
				v.height = s.height
			end
		end
	end
end

local camLock = require("camlock")
camLock.addZone(6208,-5792,862,672,1)
Thank You :).