I got a PlayerINFO.lua and change some things, so i'm not good with LUA so guys can edit the GUI and to be better?
Calculation that i made:
- Get the EXPERIENCE at 0% of (my current level - the exp of next level) it will return X
- Get the EXPERIENCE LEFT and (Exp Left - The EXP result from above)
- Get the EXP from above and (Exp done yet / Exp Total next level)
- This will result in 0,XX value
- Make the 0,XX value * 100 (using a math.floor) it will return XX%
- Use this to make a 100% BAR and the XX% for fill the bar.
Captura de Tela 2015-03-03 às 22.28.10.jpg
Code:init start -- local SCRIPT_VERSION = '1.0.0' local glowRadius = 4 useworldhud() if $windowsxp then glowRadius = 0 setmaskcolorxp(0) end MINEXP = $exp LEVEL = $level LEVELGO = $level+1 LEVELXP = ((50*(LEVEL)*(LEVEL)*(LEVEL)-150*(LEVEL)*(LEVEL)+400*(LEVEL))/3) LEVELXPe = ((50*(LEVELGO)*(LEVELGO)*(LEVELGO)-150*(LEVELGO)*(LEVELGO)+400*(LEVELGO))/3) XPTOTAL = (LEVELXP - MINEXP) XPNEED = (LEVELXPe - LEVELXP) PERCENT = math.floor((XPTOTAL / XPNEED)*100) PERCENT = 100 - PERCENT PERCENT = PERCENT * 10 local function drawmanabar(r, mppc) if ( r ) then setfillstyle("color", 0) drawrect(0, 0, 1000, 50) setfillstyle("color", 0x02266FF) drawrect(0, 0, PERCENT, 50) end end init end setfontstyle("Tahoma", 7, 100) foreach creature c "pxs" do local playerinfo = c.playerinfo if ( playerinfo and playerinfo.level > 0 ) then local r = getnamearea(c) if ( r ) then if ( c.isenemy ) then setfontdecor(0xFFBBDD, 1, 0xFF0000, glowRadius, 0x80CC2233) elseif ( c.isleader ) then setfontdecor(0x33FF99, 1, 0xDDFFDD, glowRadius, 0x3066FF33) elseif ( c.isally ) then setfontdecor(0x4499FF, 1, 0x000000, glowRadius, 0x802020FF) else setfontdecor(c.hpcolor, 1, 0x000000) end local str = playerinfo.level .. " " .. playerinfo.vocshort if ( playerinfo.guild ~= "" ) then str = str .. "\n" .. playerinfo.guild end drawtext(str, r.left, r.top + 25) end end end setbordercolor(-1) drawmanabar(getbararea($self), $mppc/100) if $navigation then foreach navchar n "as" do if n.creature.updated and n.id ~= $id then drawmanabar(getbararea(n.creature), n.mp/n.maxmp) end end end setposition(1900, 45) TEST = PERCENT / 10 drawtext(TEST.."%")