• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Item Add Skills per Storage

Vrotz

Member
Joined
Apr 7, 2011
Messages
1,071
Reaction score
7
Location
Brazil
Hello guys,

Today, i need an script that add skills or magic level per storage. So, when the player get and use that item, he get X count of skill then the item have a storage to don't use this item again.

Think one quest where the player get and use this item but he can't use this item 2x.

Thanks!
 
You can do it like this to add more skills.
Code:
local skill, amount = SKILL_SWORD, 3

for i = 1, amount do
      doPlayerAddSkillTry(cid, skill, (getPlayerRequiredSkillTries(cid, skill, getPlayerSkillLevel(cid, skill) + 1) - getPlayerSkillTries(cid, skill)), false)
end
 
Sorry? I don't understand @Limos
You need to modify the type of skill and the amount
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)

    if getPlayerStorageValue(cid, 11111) ~= 1 then
        local skill, amount = SKILL_SWORD, 3

        for i = 1, amount do
                  doPlayerAddSkillTry(cid, skill, (getPlayerRequiredSkillTries(cid, skill, getPlayerSkillLevel(cid, skill) + 1) - getPlayerSkillTries(cid, skill)), false)
        end
        setPlayerStorageValue(cid, 11111, 1)
    else
        doPlayerSendCancel(cid,"You already used this item")
    end
    return TRUE
end

thanks @Limos that works 100%
 
try this one
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)

    if getPlayerStorageValue(cid, 11111) ~= 1 then
        doPlayerAddMagLevel(cid, amount of magic)
        doPlayerAddSkill(cid, number of the skill, amount of skills, round)
        setPlayerStorageValue(cid, 11111, 1)
    else
        doPlayerSendCancel(cid,"You already used this item")
    end
    return TRUE
end

it works weird ... i tested on 0.4, it adds one full skill but you need to go to a monster/use spell for the skill to level up.

Maybe is just my bugged server or whatever, worth a try

Bro @kikos your script are working! But, now, how can I do it for select vocations? So, only the vocation to use that chests!?
 
Bro your script are working! But, now, how can I do it for select vocations? So, only the vocation to use that chests!?
delete the voc that you dont want
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)

    if getPlayerStorageValue(cid, 11111) ~= 1 and isSorcerer(cid) or isDruid(cid) or isPaladin(cid) or isKnight(cid) then
        local skill, amount = SKILL_SWORD, 3

        for i = 1, amount do
                  doPlayerAddSkillTry(cid, skill, (getPlayerRequiredSkillTries(cid, skill, getPlayerSkillLevel(cid, skill) + 1) - getPlayerSkillTries(cid, skill)), false)
        end
        setPlayerStorageValue(cid, 11111, 1)
    else
        doPlayerSendCancel(cid,"You already used this item")
    end   
    return TRUE
end
 
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)

    if getPlayerStorageValue(cid, 11111) ~= 1 and isSorcerer(cid) then
        local skill, amount = SKILL_SWORD, 3

        for i = 1, amount do
                  doPlayerAddSkillTry(cid, skill, (getPlayerRequiredSkillTries(cid, skill, getPlayerSkillLevel(cid, skill) + 1) - getPlayerSkillTries(cid, skill)), false)
        end
        setPlayerStorageValue(cid, 11111, 1)
    else
        doPlayerSendCancel(cid,"You already used this item")
    end  
    return TRUE
end
[/QUOTE]

Like that?
 
use this one (little improvement)
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)

    if getPlayerStorageValue(cid, 11111) ~= 1 then
        if isSorcerer(cid) or isDruid(cid) or isPaladin(cid) or isKnight(cid) then
            local skill, amount = SKILL_SWORD, 3

            for i = 1, amount do
                      doPlayerAddSkillTry(cid, skill, (getPlayerRequiredSkillTries(cid, skill, getPlayerSkillLevel(cid, skill) + 1) - getPlayerSkillTries(cid, skill)), false)
            end
            setPlayerStorageValue(cid, 11111, 1)
        else
            doPlayerSendCancel(cid,"You don't have the required vocation")
            return true
        end
        else
        doPlayerSendCancel(cid,"You already used this item")
    end 
    return true
end

for just making it sorcerer then
Code:
        if isSorcerer(cid) then
 
Last edited:
well this one should work but it's not working and i don't know why!
tried with SKILL_MAGICLEVEL, SKILL__MAGICLEVEL, SKILL_MAGIC, SKILL__MAGIC, SKILL__MAGLEVEL, SKILL_MAGLEVEL

No idea whats happening

Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)

    if getPlayerStorageValue(cid, 11111) == 1 then
        if isSorcerer(cid) then
            local skill, amount = SKILL__MAGLEVEL, 3

            for i = 1, amount do
                doPlayerAddSpentMana(cid, (getPlayerRequiredMana(cid, getPlayerMagLevel(cid, true) + 1) - getPlayerSpentMana(cid)) / getConfigInfo('rateMagic'))
            end
            setPlayerStorageValue(cid, 11111, 1)
        else
            doPlayerSendCancel(cid,"You don't have the required vocation")
            return true
        end
        else
        doPlayerSendCancel(cid,"You already used this item")
    end 
    return true
end

@Limos halp
 
Code:
for i = 1, 3 do
      doPlayerAddSpentMana(cid, (getPlayerRequiredMana(cid, getPlayerMagLevel(cid, true) + 1) - getPlayerSpentMana(cid)), false)
end
 
Works fine for me :p
Did you tested it with what I posted?
LOL it was because i was trying it with a knight and i had the Magic level bugged :D


edit: just used it with a sorc, but worked just one time (then it bugs the ml) be carefull with that, but maybe is just my shitty sources

@Vrotz
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)

    if getPlayerStorageValue(cid, 11111) ~= 1 then
        if isSorcerer(cid) then
            for i = 1, 3 do
                doPlayerAddSpentMana(cid, (getPlayerRequiredMana(cid, getPlayerMagLevel(cid, true) + 1) - getPlayerSpentMana(cid)), false)
            end
            setPlayerStorageValue(cid, 11111, 1)
        else
            doPlayerSendCancel(cid,"You don't have the required vocation")
            return true
        end
        else
        doPlayerSendCancel(cid,"You already used this item")
    end
    return true
end
 
Last edited:
Add it like this:
Code:
for i = 1, 3 do
     doPlayerAddSpentMana(cid, (getPlayerRequiredMana(cid, getPlayerMagLevel(cid, true) + 1) - getPlayerSpentMana(cid)), false)
end
C4TuE-us.png


Never had problems doing it like this.
Just tested it with a new character with mlvl 0, was able to use it till mlvl 156.

Which server do you use?
 
Last edited:
Add it like this:
Code:
for i = 1, 3 do
     doPlayerAddSpentMana(cid, (getPlayerRequiredMana(cid, getPlayerMagLevel(cid, true) + 1) - getPlayerSpentMana(cid)), false)
end
Now I did add this one, when reached 87 on a sorc it bugged

yo but its ok i don't think he wants to use it infinite times xD and i won't use it for now so yeah
 
LOL it was because i was trying it with a knight and i had the Magic level bugged :D


edit: just used it with a sorc, but worked just one time (then it bugs the ml) be carefull with that, but maybe is just my shitty sources

@Vrotz
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)

    if getPlayerStorageValue(cid, 11111) ~= 1 then
        if isSorcerer(cid) then
            for i = 1, 3 do
                doPlayerAddSpentMana(cid, (getPlayerRequiredMana(cid, getPlayerMagLevel(cid, true) + 1) - getPlayerSpentMana(cid)), false)
            end
            setPlayerStorageValue(cid, 11111, 1)
        else
            doPlayerSendCancel(cid,"You don't have the required vocation")
            return true
        end
        else
        doPlayerSendCancel(cid,"You already used this item")
    end
    return true
end

Working perfect! Thanks a lot brah's @Limos @kikos
 
Back
Top