User File #637986465820758936

Upload All User Files

#637986465820758936 - Contra Advance enemy hp script

Contra Advance.lua
112 downloads
Uploaded 9/13/2022 6:16 AM by Fortranm (see all 102)
Displays the hp values of all active enemies on the screen
local function Enemies()
	local start = 0x04449C
	local oend = 89
	local base
	local active
	local id
	local hp
	j = 0
	
	for i = 0,oend,1 do
		base = start + (i * 0x38)
		
		active = memory.read_s16_le(base + 2)
		hp = memory.read_s16_le(base + 6)
		if active > 0 and hp > 0 then
			id = memory.readbyte(base)
			gui.text(0, 60 + j * 15, id .. ": " .. hp)
			j = j + 1
		end
	end	
	
end

while true do
	memory.usememorydomain("Combined WRAM")
	Enemies()
	emu.frameadvance()
end