• 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!

items gives skill (or magic lvl) forever

Thorn

Spriting since 2013
Joined
Sep 24, 2012
Messages
2,203
Solutions
1
Reaction score
921
Location
Chile
hii, well like i said on the title, i'm looking for an action that makes a item give skill or magic lvl, for example, i have item id XXXX that when u use it it give you 5 sword skill points forever (or 5 magic levels)
plz guys help me with this :S i serch for it and i didn't found any
 
Lua:
SKILL_IDS = {
	["fist"] = SKILL_FIST,
	["club"] = SKILL_CLUB,
	["sword"] = SKILL_SWORD,
	["axe"] = SKILL_AXE,
	["distance"] = SKILL_DISTANCE,
	["dist"] = SKILL_DISTANCE,
	["shielding"] = SKILL_SHIELD,
	["shield"] = SKILL_SHIELD,
	["fishing"] = SKILL_FISHING,
	["fish"] = SKILL_FISHING,
	["level"] = SKILL__LEVEL,
	["magic"] = SKILL__MAGLEVEL
}
 
:D thanks guys!

- - - Updated - - -

i put this
Lua:
local skill, amount = SKILL__MAGLEVEL, 3 --Edit skill name Ex: SKILL_CLUB,1 = that means amount so, it add now 1 axe fighting.
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
	for i = 1, amount do
		doPlayerAddSkillTry(cid, skill, (getPlayerRequiredSkillTries(cid, skill, getPlayerSkillLevel(cid, skill) + 1) - getPlayerSkillTries(cid, skill)), false)
	end
	doSendMagicEffect(getThingPos(cid),math.random(CONST_ME_FIREWORK_YELLOW, CONST_ME_FIREWORK_BLUE))
	doCreatureSay(cid, "SKILL UP!", TALKTYPE_ORANGE_1)
	doRemoveItem(item.uid, 1)
	return true
end

but im getting this error :/
XML:
[22/08/2013 22:14:33] [Error - Action Interface] 
[22/08/2013 22:14:33] data/actions/scripts/moremagic.lua:onUse
[22/08/2013 22:14:33] Description: 
[22/08/2013 22:14:33] data/actions/scripts/moremagic.lua:5: attempt to perform arithmetic on a boolean value
[22/08/2013 22:14:34] stack traceback:
[22/08/2013 22:14:34] 	data/actions/scripts/moremagic.lua:5: in function <data/actions/scripts/moremagic.lua:3>

i put two __ like you guys said :/ and with one just gives fist skills
 
Lua:
local amount = 3 --Edit skill name Ex: SKILL_CLUB,1 = that means amount so, it add now 1 axe fighting.
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
    doPlayerAddMagLevel(cid, amount)
    doSendMagicEffect(getThingPos(cid),math.random(CONST_ME_FIREWORK_YELLOW, CONST_ME_FIREWORK_BLUE))
    doCreatureSay(cid, "SKILL UP!", TALKTYPE_ORANGE_1)
    doRemoveItem(item.uid, 1)
    return true
end
 
You can also do it the same as the skill, but then instead of skilltries, manaspent.
Lua:
for i = 1, amount do
	doPlayerAddSpentMana(cid, (getPlayerRequiredMana(cid, getPlayerMagLevel(cid, true) + 1) - getPlayerSpentMana(cid)), false)
end
 
OK i will test it later, now my website is not working i cannot create a character to test and with the god is not working properly, only gave 2 magic lvl and not working anymore
 
is not working :/ i tested it with a normal player and if the player has 0 ml, it goes to 2 ml, and then it don't work. is you use a magic spell then you can use it again but will only refilled the same ml to 99%
this is what i have now
Code:
local amount = 3 --Edit skill name Ex: SKILL_CLUB,1 = that means amount so, it add now 1 axe fighting.
function onUse(cid, item, fromPosition, itemEx, toPosition)
    doPlayerAddMagLevel(cid, amount)
    doSendMagicEffect(getThingPos(cid),math.random(CONST_ME_FIREWORK_YELLOW, CONST_ME_FIREWORK_BLUE))
    doCreatureSay(cid, "SKILL UP!", TALKTYPE_ORANGE_1)
    doRemoveItem(item.uid, 1)
    return true
end
 
Have you tried with Limos suggestion?

If you have and it didn't work properly, would you mind posting your doPlayerAddMagLevel function?
 
Code:
function doPlayerAddMagLevel(cid, amount)
    for i = 1, amount do
        doPlayerAddSpentMana(cid, (getPlayerRequiredMana(cid, getPlayerMagLevel(cid, true) + 1) - getPlayerSpentMana(cid)) / getConfigInfo('rateMagic'))
    end
    return true
end
 
Try with this
Code:
function doPlayerAddMagLevel(cid, amount)
   for i = 1, amount do
     doPlayerAddSpentMana(cid, math.ceil((getPlayerRequiredMana(cid, getPlayerMagLevel(cid, true) + 1) - getPlayerSpentMana(cid)) / getConfigInfo('rateMagic')))
   end
   return true
end

Hopefully it should advance to the next magic level instead of just going up to 99% :p
 
wow now works fine! thanks ninja, ad btw is there a chance to increse the limit? the limit is 156
 
Back
Top