Jump to content

i want no see the map if you dont use the compass


Recommended Posts

Hi, basicly i want to make a mod similar as better compass, but instead of reveal the map, hide map if you dont equip the compass.

I was looking some way to do it, 2 ways i think should be paths are working with a keyfuntion change (a realy bad idea for modding in any game) the other is get an black overlay over the map screen. Someone knows other better way? block the function of calling the map is mybe a way but i dont know if the script let you block a funtion temporaly (or something similar) some idea?

Link to comment
Share on other sites

To temporarily block a function in LUA is pretty easy if you have access to the function.

Hook the function and in the prehook check your toggle variable, local to the player table or something, and if it's on then don't call the original function.

 

Example in LUA:

-- Given:
a = {}
function a:SomeFunction(a, b, c)
  print(self, a, b, c)
end
player = {}

-- Do:
player.blockmap = false
local SomeFunction_old = a.SomeFunction
a.SomeFunction = function(self, a, b, c, ...)
  if player.blockmap == true
  then
    return
  end
  return SomeFunction_old(self, a, b, c, ...)
end

-- Test:
a:SomeFunction("a", "b")

 

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...