HUD help

Pizza

Member
Hud won't load


Code:
local client
local p_startseg
local p_onseg
local p_offseg
local p_endseg
local p_ki

local function kihud(v, player)
    client = player
		if player.mo and player.mo.skin == "songoku"
		  local kipower = 0
		  local kimax   = 0
		  local kidrain = 0
		  if player.kimeter == nil
		      return
		  end
		   kipower = $1 + 80
		   kimax = $1 + player.kimeter
		   kidrain = $1 + player.kimeter+1

          local p_startseg = v.cachePatch("KIGAUGE")
	      local p_onseg    = v.cachePatch("KIGAUGE3")
	      local p_offseg   = v.cachePatch("KIGAUGE4")
	      local p_endseg   = v.cachePatch("KIGAUGE2")
	      local p_ki       = v.cachePatch("KI")	
	      local posx = 130
		  local posy = 0
		  
				posy = 155
			else
				posy = 174 
			end
	
		-- Ending segment first
	v.draw(posx, posy, p_endseg, V_SNAPTOTOP|V_SNAPTORIGHT|V_HUDTRANS)
	posx = $1 - 1
	
    	-- Step through backwards, to match the way we're drawing.
	for i = kimax, 1, -1
		if kipower >= i
			v.draw(posx, posy, p_onseg, V_SNAPTOTOP|V_SNAPTORIGHT|V_HUDTRANS)
		else
			v.draw(posx, posy, p_offseg, V_SNAPTOTOP|V_SNAPTORIGHT|V_HUDTRANS)
		end
		posx = $1 - 8;
	end     	 
		 
		 
		 -- Start segment and BOSS text
	v.draw(posx, posy, p_startseg, V_SNAPTOTOP|V_SNAPTORIGHT|V_HUDTRANS)
	v.draw(posx, posy, p_ki, V_SNAPTOTOP|V_SNAPTORIGHT|V_HUDTRANS);
	        return
	    end
	return
end
hud.add(kihud)
 
I don't know a thing about drawing custom HUD patches, but I think it's a problem with the indentation. Not only that, but you seem to have a problem with your "assignment" operations.
Code:
 local p_onseg    = v.cachePatch("KIGAUGE3")
Here, you have 3 whitespaces. You should only have one. The resulting line should look like this:
Code:
local p_onseg = v.cachePatch("KIGAUGE3")
Not only that, but you also seem to have an unfinished conditional.


This code:

Code:
local posx = 130
     local posy = 0
    -- Don't mind me, just filling in the blank line.

         posy = 155
    else
        posy = 174
    end
should turn into:
Code:
local posx = 130
local posy = 0 -- This line was indented incorrectly, and the same thing goes for the five lines below it.
--IF Statement goes here
    posy = 155
 else
    posy = 174
end


There might be a lot of other errors I haven't caught, but that should be the basic stuff.
 
Thanks, i tried it but the hud still won't show up
Edit- never mind solved it
 
Last edited:

Who is viewing this thread (Total: 1, Members: 0, Guests: 1)

Back
Top