Azcarer
HEJJJJ!! :D
I want to have a level scroll on my server so if ppl right click the scroll gives them like 50 levels or something.
There are like 20 threads about it..
-- OTcentrum.pl - Polskie Centrum OpenTibii
local config = {
funnyEffect = "YES", -- effects fireworks & Animated Text (YES/NO)
minimumLevel = 1,
addExp = {[60] = 1000, [80] = 2000, [100] = 3000, [120] = 4000, [math.huge] = 5000}
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
local expTable = config.addExp
local effect = math.random(CONST_ME_FIREWORK_YELLOW,CONST_ME_FIREWORK_BLUE)
if getPlayerLevel(cid) < config.minimumLevel then
doPlayerSendCancel(cid, "You need to be at least "..config.minimumLevel.." to use a scroll.")
return FALSE
end
for k, v in pairs(expTable) do
if getPlayerLevel(cid) <= k then
doPlayerAddExp(cid, v)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "k: "..k.." // v: "..v.."")
doRemoveItem(item.uid, 1)
break
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "k: "..k.." // v: "..v.."")
end
end
if config.funnyEffect == "YES" then
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), "Yeah! Exp!", TEXTCOLOR_RED)
doSendMagicEffect(positions[i],effect)
end
end
return TRUE
end
But where am I gonna put it in?
function onUse(cid, item, fromPosition, itemEx, toPosition)
doPlayerAddLevel(cid, 50)
doPlayerSendTextMessage(cid, "You've gained 50 levels.")
return TRUE
end
function doPlayerAddLevel(cid, amount)
local newExp = 0
local currentLevel = getPlayerLevel(cid)
if(amount > 0) then
newExp = getExperienceForLevel(currentLevel + amount) - getExperienceForLevel(currentLevel)
else
newExp = getExperienceForLevel(currentLevel) - getExperienceForLevel(currentLevel + amount)
end
return doPlayerAddExp(cid, newExp)
end
<action itemid="SCROLL_ID_HERE" event="script" value="/DIRECTORY_HERE/levelscroll.lua"/>
Have only seen 4There are like 20 threads about it..