• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Lua Help LUA set monster value

gmstrikker

Well-Known Member
Joined
Jul 30, 2014
Messages
458
Solutions
1
Reaction score
50
Using this system to add monster skull in lua: Skull Random In monsters

I want to sometimes, only sometimes monster set a skull randoly, i already made the base of script, but how to check if monster already has checked on this system? I cant check the skull because sometimes it can be 0 (no skull)

Code:
<globalevent name="monster_skull" interval="1000" event="script" value="monster_skull.lua"/>

Code:
function onThink(interval, lastExecution, thinkInterval)
    local m = checkSpawnMonster()
    -- SKULL_NONE = 0
    -- SKULL_WHITE = 3
    -- SKULL_RED = 4
    -- SKULL_BLACK = 5
    for _, mid in ipairs(m) do
        --if(monster_dont_have_skull_seted) then
            local mpos = getThingPos(mid)
            local skull, bonus_percent
            local chance = math.random(1, 100)
            if(chance <= 1) then
                skull = 5
                bonus_percent = 100
            elseif(chance >= 2 and chance <= 10) then
                skull = 4
                bonus_percent = 50
            elseif(chance >= 11 and chance <= 25) then
                skull = 3
                bonus_percent = 25
            else
                skull = 0
                bonus_percent = 0
            end

            --set(monster_skull_seted)
            if(skull > 0) then
                local hp = (getCreatureMaxHealth(mid)) + ((getCreatureMaxHealth(mid) * bonus_percent) / ( 100 ))

                setCreatureMaxHealth(mid, hp)
              
                doCreatureSetSkullType(mid, skull)
            end
        -- end
    end
    return 0
end


Code:
--set(monster_skull_seted)

Code:
--if(monster_dont_have_skull_seted) then
 
Last edited:
Back
Top