• 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 Gives 1 Lvl And Magic Skill Scroll

perfection

FATAL DAMAGE
Joined
Aug 27, 2011
Messages
196
Reaction score
8
Exp Scroll:

PHP:
-- Scripted By Perfection --
local itemID = 6119 
local lvl = 1 
function onUse(cid, item, frompos, item2, topos)
if item.itemid == itemID then
doPlayerAddLevel(cid, lvl)
doPlayerSendTextMessage(cid,22,"You Recieved 1 Level !")
doRemoveItem(cid, item.uid, 1)
end
return 1
end

and in actions.xml

PHP:
<action itemid="6119" event="script" value="Exp Scroll.lua"/>

Magic Skill Scroll:

PHP:
-- Scripted By Perfection --
local itemID = 6087
local magiclvl = 100000
function onUse(cid, item, frompos, item2, topos)
if item.itemid == itemID then
doPlayerAddSpentMana(cid, magiclvl)
doPlayerSendTextMessage(cid,22,"Here u GO :) !")
doRemoveItem(cid, item.uid, 1)
end
return 1
end

and in actions.xml

PHP:
<action itemid="6087" event="script" value="Magic Scroll.lua"/>
 
I just want to go up a level, no exp.
how would the code?
Code:
local config = {
level = 1
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
doPlayerAddLevel(cid, config.level)
doPlayerSendTextMessage(cid, 28, "You Have Advanced 1 Level")
doSendTextAnimated(getCreaturePosition(cid), 28, TEXTCOLOR_RED
doSendMagicEffect(getCreaturePosition(cid), 28
doRemoveItem(cid, item, 1)
return true
end
 
Thanks Lician, I was wrong, I want to go up a level of magic.
and how I can do so that you can occupy only 2 times in a character?
 
Thanks Lician, I was wrong, I want to go up a level of magic.
and how I can do so that you can occupy only 2 times in a character?
At First It's Lucian :p
secondly


Code:
local config = {
level = 1
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
    if getCreatureStorage(cid, 141) == 1 then
        doPlayerSendCancel(cid, 'You already used this once.')
    else
        doCreatureSetStorage(cid, 141, 1)
        doPlayerAddMagLevel(cid, config.level)
        doRemoveItem(cid, item, 1)
    end
    return true
end

@Limos i have developed it on my Own :D
got some questions :-
1- i can't do what he ask me i can also make it just 1 time to use no more :/ dunno how
2- why i use it it give me exp tell the rest of my recent magic level, would you fix or explain ?

3- is it well tabbed ? :D
 
Last edited by a moderator:
Yes, it's tabbed correct.
Replace the function in data/lib/050-function.lua if there are problems with adding ml.
Code:
function doPlayerAddMagLevel(cid, amount)
     for i = 1, amount do
         doPlayerAddSpentMana(cid, (getPlayerRequiredMana(cid, getPlayerMagLevel(cid, true) + 1) - getPlayerSpentMana(cid)), false)
     end
     return true
end
 
Yes, it tabbed correct.
Replace the function in data/lib/050-function.lua if there are problems with adding ml.
Code:
function doPlayerAddMagLevel(cid, amount)
     for i = 1, amount do
         doPlayerAddSpentMana(cid, (getPlayerRequiredMana(cid, getPlayerMagLevel(cid, true) + 1) - getPlayerSpentMana(cid)), false)
     end
     return true
end
what about make this itmeID work only 2 times ?
 
You can add an actionid to the item, for example 100 first time, 200 second time, then check if the item has actionid 200 and then remove the item.
 
thank you very much LUCIAN, but I just want that they can occupy 5 times, I can only occupy one.
 
dude, iam following Limos instruction he make two things at the same time he helps you and teaching me :D "helping you through me" if i couldn't do that he will :D
let me try :p

@Limos

Code:
local config = {
level = 1
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
    if getItemActionId(uid, 200) then
        doPlayerSendCancel(cid, 'You already used this once.')
        doRemoveItem(cid, item, 1)

    else
        doSetItemActionId(uid, 100, 200)
        doPlayerAddMagLevel(cid, config.level)
    end
    return true
end

Look at mu sucks work :p
doSetItemActionId(uid, 100, 200) ----- is That Line right ?
if getItemActionId(uid, 200) then ----- it doesn't exists :D
how could i check that ?
 
Last edited by a moderator:
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
     doItemSetAttribute(item.uid, "aid", getItemAttribute(item.uid, "aid") ~= nil and getItemAttribute(item.uid, "aid") + 100 or 100)
     doPlayerAddMagLevel(cid, 1)
     doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You received 1 magiclevel!")
     if getItemAttribute(item.uid, "aid") == 500 then
         doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "The item is used 5x and is now removed.")
         doRemoveItem(item.uid, 1)
     end
     return true
end
 
9AkXbzx.png


this is what I want, but that only increases the level of magic.ç

I want the item will have to buy 5 times and each time deal disappears. and can occupy only 5 times per character.
 
Then you can use storage instead.
Code:
local storage = 43855

function onUse(cid, item, fromPosition, itemEx, toPosition)
     if getPlayerStorageValue(cid, storage) >= 4 then
         return doPlayerSendCancel(cid, "You already used it 5x.")
     end
     doRemoveItem(item.uid, 1)
     doPlayerAddMagLevel(cid, 1)
     doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You received 1 magiclevel!")
     setPlayerStorageValue(cid, storage, getPlayerStorageValue(cid, storage) + 1)
     return true
end

:O
Now you helped him, what about me:p can you explain these lines ?
Cause it's new for me :)
Which parts don't you understand?
 
Then you can use storage instead.
Code:
local storage = 43855

function onUse(cid, item, fromPosition, itemEx, toPosition)
     if getPlayerStorageValue(cid, storage) >= 4 then
         return doPlayerSendCancel(cid, "You already used it 5x.")
     end
     doRemoveItem(item.uid, 1)
     doPlayerAddMagLevel(cid, 1)
     doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You received 1 magiclevel!")
     setPlayerStorageValue(cid, storage, getPlayerStorageValue(cid, storage) + 1)
     return true
end


Which parts don't you understand?
Code:
     setPlayerStorageValue(cid, storage, getPlayerStorageValue(cid, storage) + 1)

a bit more explain cause it's 6:56 AM :D
 
thanks Limos :D
and now, if a want get sword, axe, distance and club levels.
i need change "doPlayerAddMagLevel(cid, 1)" for what?
 
Back
Top