User File #73199531389776805

Upload All User Files

#73199531389776805 - Fist of the North Star HUD v3

hokuto2.lua
221 downloads
Uploaded 8/1/2021 1:04 PM by MESHUGGAH (see all 292)
  • Added enemy object ID, X, Y
  • Added lag level indicators:
    • when 2nd number becomes 200 from a different number, the previous frame was a lag frame. Usually this is what you see if there was a lag frame:
    • (1st number something) 200 0 32 208
--[[ MESHUGGAH's HUD Template

This template features an example to 

v contains RAM addresses of position values (hexadecimal)
p positon values stored here after reading memory from location v (memory.readbyte)
pp  previous position values stored here to compare with new positions on next frame
--]]

-- Variable array: P1 X, P1 Y, Camera X
local v = {
0x30,
0x32,
--0x613,             
--0x61c,
0x26
}

-- Position array
local p = {} for i = 1, table.getn(v) do p[i] = 0 end

-- Previous position array
local pp = {} for k,v in pairs(p) do pp[k] = v end

-----------------------------------------------------------------------

local function objects()

  -- display ID if alive
  for i = 0, 15 do
    if memory.readbyte(0x386+i*19) ~= 0 then
      gui.text(memory.readbyte(0x388+i*19)+i*30,memory.readbyte(0x38b+i*19)+i*30,string.format("%d X: %3d\nY: %3d",i,memory.readbyte(0x388+i*19),memory.readbyte(0x38b+i*19)),"#FFFFFFFF","#FF000080")
    end
  end
  
end

local function hud()
  -- Display object's ID and a simple box around them (not actual hitbox positions)
  objects()

  -- Read new positions
  for i = 1, table.getn(v)-1 do p[i] = memory.readbyte(v[i]) end
  p[3] = memory.read_u16_le(v[3])
  
  -- CamX pos
  gui.text(120,0,string.format("CamX %5d (%d)",p[3],p[3]-pp[3]),"#FFFFFFFF","#00000080")
  
  -- Level
  gui.text(120,15,string.format("Level %d\n",memory.readbyte(0xee)),"#FFFFFFFF","#00000080")
  
  -- X pos, Y pos
  gui.text(280,0,string.format("X %5d (%d)",p[1],p[1]-pp[1]),"#FFFFFFFF","#00000080")
  gui.text(280,15,string.format("Y %5d (%d)",p[2],p[2]-pp[2]),"#FFFFFFFF","#00000080")
  
  -- Timer
  gui.text(420,0,string.format("0x84 %3d\n0xFE %3d",memory.readbyte(0x84),memory.readbyte(0xfe)),"#FFFFFFFF","#00000080")
  
  gui.text(520,0,string.format("LAG %3d %3d %3d %3d %3d\n",memory.readbyte(0x1ea),memory.readbyte(0x1f7),memory.readbyte(0x601),memory.readbyte(0x602),memory.readbyte(0x603)),"#FFFFFFFF","#00000080")
  
  -- Store positions to compare them in next frame
  for k,v in pairs(p) do pp[k] = v end
end

event.onframeend(hud)

while true do
	emu.frameadvance()
end