• 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!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

[action] Exp scroll By Stages

kimokimo

Kimo
Joined
Jan 25, 2011
Messages
821
Solutions
6
Reaction score
156
GitHub
karimadnan
I posted this maybe someone needs [not my script] :)

actions/scripts/others/expscroll.lua
PHP:
local config = {
funnyEffect = "YES", 
minimumLevel = 50,
maximumLevel = 99999, -- for infinite type math.huge
}
local addExp = {
[{config.minimumLevel, 100}] = 2500000,
[{100, 200}] = 5000000,
[{200, 300}] = 7500000,
[{300, 400}] = 10000000,
[{400, 500}] = 15000000,
[{500, 600}] = 20000000,
[{600, 1000}] = 30000000,
[{1000, 2000}] = 45000000,
[{2000, 2500}] = 125000000,
[{2500, 7500}] = 150000000,
[{7500, 10000}] = 200000000,
[{10000, 20000}] = 250000000,
[{20000, config.maximumLevel}] = 300000000
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
local level = getPlayerLevel(cid)
    local effect = math.random(CONST_ME_FIREWORK_YELLOW,CONST_ME_FIREWORK_BLUE) 

    if level < config.minimumLevel then
        doPlayerSendCancel(cid, "You need to be at least "..config.minimumLevel.." to use a scroll.")
        return FALSE 
    end
    
    if level >= config.maximumLevel then
        doPlayerSendCancel(cid, "Your level is too high for using a scroll.")
        return FALSE 
    end

    for k, v in pairs(addExp) do 
        if level >= k[1] and level < k[2] then 
            doPlayerAddExp(cid, v)
            doPlayerSendTextMessage(cid, 22, "Experience Scroll Gave You " .. v .." experience!")
            doRemoveItem(item.uid, 1)
            break 
        end 
    end  

        if config.funnyEffect == "YES" then
	local playerexp = addExp
        local pos = getPlayerPosition(cid)
        local positions = {
                {x=pos.x+1,y=pos.y-1,z=pos.z},
                {x=pos.x-1,y=pos.y-1,z=pos.z},
                {x=pos.x+1,y=pos.y+1,z=pos.z},
                {x=pos.x-1,y=pos.y+1,z=pos.z},
                {x=pos.x+1,y=pos.y,z=pos.z},
                {x=pos.x-1,y=pos.y,z=pos.z},
                {x=pos.x,y=pos.y+1,z=pos.z},
                {x=pos.x,y=pos.y-1,z=pos.z}
        }

        for i = 1, table.getn(positions) do
	
            doSendAnimatedText(getThingPos(cid), playerexp, TEXTCOLOR_RED) 
            doSendMagicEffect(positions[i],effect)
        end
    end
    return TRUE 
end

actions.xml
PHP:
	<action itemid="7722" event="script" value="other/expscroll.lua"/>
 
very easy script, it would take 5 min to do it. ; dd anyway thanks, for sharing :)
 
Back
Top