Signup Now
Results 1 to 5 of 5
  1. #1
    Banned
    Join Date
    Dec 2013
    Location
    Porto Alegre - RS
    Posts
    524
    Reputation
    61
    Rep Power
    0

    HUD - Left percent to level

    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.."%")
    Last edited by User Not Found; 03-04-2015 at 01:37 PM.

  2. #2
    Free User pvzin's Avatar
    Join Date
    Dec 2013
    Location
    USA
    Posts
    974
    Reputation
    48
    Rep Power
    22
    Do your magic @Riku!
    Yours,
    pvzin

  3. #3
    Moderator Raphael's Avatar
    Join Date
    Dec 2013
    Location
    raphseller.com
    Posts
    2,441
    Reputation
    309
    Rep Power
    28
    Couldn't you just use $levelpc?

  4. #4
    Banned
    Join Date
    Dec 2013
    Location
    Porto Alegre - RS
    Posts
    524
    Reputation
    61
    Rep Power
    0
    I didn't find it on Docs in Tibiawindbot.com/docs!

  5. #5
    Moderator Leonardo's Avatar
    Join Date
    Dec 2013
    Location
    Brazil
    Posts
    758
    Reputation
    77
    Rep Power
    22
    https://www.tibiawindbot.com/docs.ht...iables-levelpc

    Anyway 'setfontdecor' is not documented.

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •