Jump to content

[MOD-WIP] Minimap : Need some help


Penta

Recommended Posts

I'm not good at this, but I just came here to say that a minimap in the hud would be awesome! Looking forward to this. :grin:

It was awesome, until the Nightmares update broke the existing one. This is a sort of revive attempt - and I'm hoping it is fixed, because I really loved this mod. =)

Link to comment
Share on other sites

It was awesome, until the Nightmares update broke the existing one. This is a sort of revive attempt - and I'm hoping it is fixed, because I really loved this mod. =)

Oh, didn't recognize it was there before! My mistake!

 

It must've been awesome... Is it adding a map to the hud so you don't have to open it up all the time? (so I didn't get that wrong too, haha!)

Link to comment
Share on other sites

Oh, didn't recognize it was there before! My mistake!

 

It must've been awesome... Is it adding a map to the hud so you don't have to open it up all the time? (so I didn't get that wrong too, haha!)

Yeah, the way it worked was that you got a little minimap widget next to the calendar thing. It was fabulous!

Link to comment
Share on other sites

Ok I will try to work a bit tonight on it but i'm stuck with assigning this function.

It's present in script but visibily not declared.

I don't know what to call at start of script, even if I watched some samples from Klei

local update = GLOBAL.PlayerHud.OnUpdate 

Any help would be good :)

Link to comment
Share on other sites

Hi everybody, I think i fixed the undeclared variable.

 

But i'm still working on second issue :

The mod calls a function to scroll the minimap. You can watch it here.

local function addMiniMapScroll(inst)	local count = 0	for k,v in pairs(inst.inputhandlers) do		if v.event == GLOBAL.MOUSEBUTTON_SCROLLUP or v.event == GLOBAL.MOUSEBUTTON_SCROLLDOWN then			local scrollCam = v.fn			v.fn = function ()				if mapVisibility == MINIMAP then					local mouse = GLOBAL.TheInput:GetMouseScreenPos()					local scr_w, scr_h = GLOBAL.TheSim:GetScreenSize()					local x = scr_w * position 					local y = scr_h * map_y					local w = scr_w * mapscale_x					local h = scr_w * mapscale_y					if mouse.x >= x and mouse.x <= x + w and						mouse.y >= y and mouse.y <= y + h then						if v.event == GLOBAL.MOUSEBUTTON_SCROLLUP then							inst.inst.HUD.minimap.MiniMap:Zoom( -1 )						else							inst.inst.HUD.minimap.MiniMap:Zoom( 1 )						end						return					end				end				scrollCam()			end			count = count + 1		end		if count == 2 then break end	endend

The error is due to this line : 

 

for k,v in pairs(inst.inputhandlers) do

 

I think the table changed, and I don't know where it could be now.

 

You can watch error log here : 

 

 

MiniMapComponent::SetAtlasInfo( minimap/minimap_data.xml )

scripts/mods.lua(17,1) error calling ComponentPostInit: playercontroller in mod MiniMap[WIP]v1.0 (Mini Map): 
...ont_starve/data/../mods/MiniMap[WIP]v1.0/modmain.lua:130: bad argument #1 to 'pairs' (table expected, got nil)
LUA ERROR stack traceback:
        =[C] in function 'pairs'
        B:/Steam/steamapps/common/dont_starve/data/../mods/MiniMap[WIP]v1.0/modmain.lua(130,1)
        =(tail call) ?
        =[C] in function 'xpcall'
        B:/Steam/steamapps/common/dont_starve/data/scripts/mods.lua(15,1) in function 'fn'
        B:/Steam/steamapps/common/dont_starve/data/scripts/entityscript.lua(298,1) in function 'AddComponent'
        B:/Steam/steamapps/common/dont_starve/data/scripts/prefabs/player_common.lua(155,1) in function 'fn'
        B:/Steam/steamapps/common/dont_starve/data/scripts/mainfunctions.lua(90,1)
        =[C] in function 'SpawnPrefab'
        B:/Steam/steamapps/common/dont_starve/data/scripts/mainfunctions.lua(124,1) in function 'SpawnPrefab'
        B:/Steam/steamapps/common/dont_starve/data/scripts/gamelogic.lua(384,1) in function 'PopulateWorld'
...
        =[C] in function 'GetPersistentString'
        B:/Steam/steamapps/common/dont_starve/data/scripts/saveindex.lua(67,1) in function 'Load'
        B:/Steam/steamapps/common/dont_starve/data/scripts/gamelogic.lua(1063,1) in function 'callback'
        B:/Steam/steamapps/common/dont_starve/data/scripts/playerprofile.lua(335,1) in function 'Set'
        B:/Steam/steamapps/common/dont_starve/data/scripts/playerprofile.lua(248,1)
        =[C] in function 'GetPersistentString'
        B:/Steam/steamapps/common/dont_starve/data/scripts/playerprofile.lua(246,1) in function 'Load'
        B:/Steam/steamapps/common/dont_starve/data/scripts/gamelogic.lua(1062,1) in main chunk
        =[C] in function 'require'
        B:/Steam/steamapps/common/dont_starve/data/scripts/mainfunctions.lua(602,1)
scripts/mods.lua(212,1) Disabling MiniMap[WIP]v1.0 (Mini Map) because it had an error.
scripts/frontend.lua(475,1) SCRIPT ERROR! Showing error screen

 

Thank you

Link to comment
Share on other sites

Almost none of this code will work anymore. All of the screen code got changed around a lot in one of the updates, and very little of the variables used even exist anymore.

I'll poke around and see if I can come up with anything, but the whole thing basically has to be rewritten.

Link to comment
Share on other sites

First thank you for your awnser.

Do you think it could be better to rewrite all from scratch and just keep the idea? I'm not sure I've got time to do it all and I think i don't have the abilities to do it.

Link to comment
Share on other sites

Edut : any way to increase zoom in?

Thx

Short answer: No. From the comments section on the mod page:

 

#1: Not possible. Max zoom level is hardcoded (actual value of max zoom is 0; as you zoom out that value increases, as you zoom in decreases but will never go below 0), nothing I can do about that. It does seem to scale on its own depending on resolution, though. Zoom level 0 is much more zoomed out on 1920x1080 than it is on 1024x768.

However, I uploaded version 1.0.1 which fixes the size of the map on lower resolutions, so make sure you have that.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

Please be aware that the content of this thread may be outdated and no longer applicable.

×
  • Create New...