User File #73111147014864254

Upload All User Files

#73111147014864254 - Fist of the North Star HUD v1

hokuto2.lua
221 downloads
Uploaded 7/28/2021 1:32 PM by MESHUGGAH (see all 292)
An edited version of my Hokuto no Ken (the first game of the series) for FCEUX to work with Fist of the North Star on BizHawk.
  • Ignore the "template" comments, as I had to change the format for BizHawk (cannot read word, have to use read_u16_le or something)
  • The memory variables are very similar between Hokuto no Ken and Fist of the North Star, so the following variables are OK: Cam X, PX, PY
  • The following is not implemented so far: Enemy/projectiles IDs, these being alive
  • There's also a bad quickfix on the bottom of the script which doesn't cares about BizHawk loaded a ROM, so loading this script twice will closes BizHawk... will fix it in next version
--[[ MESHUGGAH's HUD Template

This template features an example to NES Rush'n Attack

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 = {
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(0x500+i*32) ~= 0 then
      gui.text(memory.readbyte(v[1]+i*32),memory.readbyte(v[2]+i*32)+40,i,"#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])
  
  -- Anything else you would like to display?
  gui.text(1,1,string.format("CamX %3d (%d)",p[3],pp[3]-p[3]),"#FFFFFFFF","#00000080")
  
  -- Display positions for players
  gui.text(p[1],p[2]+48,string.format("X %3d (%d)\nY %d (%d)",p[1],pp[1]-p[1],p[2],pp[2]-p[2]),"#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