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

[MOD] Skill Scroll

Joined
Jun 19, 2009
Messages
1,852
Reaction score
5
Hellooooooo!

I request 4 different scripts that goes like this:

if you click on itemid = xxx then you get +1 club, and you may only use it up to 150 club fighting skills..

2.

Same as #1, but in sword

3. Same as #1, but in axe

4. Same as #1, but in distance xD

I thought I could do it myself but I don't understand the part when u give skills..

I just woke up so my english can be... confusing.

thanks
 
Action.xml
Code:
<action itemid="aaaa;bbbb;cccc;dddd" script="skill.lua" />

skill.lua
LUA:
function onUse(cid, item, frompos, item2, topos)

	if item.itemid == aaaa then
   
		if getPlayerSkillLevel(cid, 1) <= 150 then
			doPlayerAddSkill(cid, 1)
			doPlayerRemoveItem(cid,aaaa,1)
			doPlayerSendTextMessage(cid,22,"Your bought one club skill!")
			else
			doPlayerSendCancel(cid, "Your club skill is too big!")
			end
	
			if item.itemid == bbbb then
   
				if getPlayerSkillLevel(cid, 2) <= 150 then
				doPlayerRemoveItem(cid,bbbb,1)
				doPlayerAddSkill(cid, 2)
				doPlayerSendTextMessage(cid,22,"Your bought one sword skill")
				else
				doPlayerSendCancel(cid, "Your sword skill is too big!")
				end
	
				if item.itemid == cccc then
   
					if getPlayerSkillLevel(cid, 3) <= 150 then
					doPlayerAddSkill(cid, 3)
					doPlayerRemoveItem(cid,cccc,1)
					doPlayerSendTextMessage(cid,22,"Your bought one axe skill!")
					else
					doPlayerSendCancel(cid, "Your axe skill is too big!")
					end
					if item.itemid == dddd then

						if getPlayerSkillLevel(cid, 4) <= 150 then
						doPlayerAddSkill(cid, 4)
						doPlayerRemoveItem(cid,dddd,1)
						doPlayerSendTextMessage(cid,22,"Your bought one distance skill!")
						else
						doPlayerSendCancel(cid, "Your distance skill is too big!")
						end
					end
				end
			end
		end
	end

I didn't tested this
Just complete the ids
 
Last edited:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<mod name="Skill scroll" enabled="yes">
	<action itemid="aaaa;bbbb;cccc;dddd" event="script"><![CDATA[
		local t = {
			[aaaa] = {SKILL_CLUB, 150},
			[bbbb] = {SKILL_SWORD, 150},
			[cccc] = {SKILL_AXE, 150},
			[dddd] = {SKILL_DISTANCE, 150}
		}
		function onUse(cid, item, fromPosition, itemEx, toPosition)
			local v = t[item.itemid]
			if getPlayerSkillLevel(cid, v[1]) < v[2] then
				doPlayerAddSkill(cid, v[1], 1)
				doRemoveItem(item.uid, 1)
			else
				doCreatureSay(cid, "You can only use this if your " .. SKILL_NAMES[v[1]] .. " skill is lower than " .. v[2], TALKTYPE_ORANGE_1, false, cid)
			end
			return true
		end
	]]></action>
</mod>
 
Last edited:
hmm, if I transform this to mod, would it be like this?

Code:
<?xml version="1.0" encoding="UTF-8"?>
<mod name="I have no idea" enabled="yes">
	<action itemid="2556" event="script"><![CDATA[
		local t = {
	[aaaa] = {SKILL_CLUB, 150},
	[bbbb] = {SKILL_SWORD, 150},
	[cccc] = {SKILL_AXE, 150},
	[dddd] = {SKILL_DISTANCE, 150}
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
	local v = t[item.itemid]
	if getPlayerSkillLevel(cid, v[1]) < v[2] then
		doPlayerAddSkill(cid, v[1], 1)
		doRemoveItem(item.uid, 1)
	else
		doCreatureSay(cid, "You can only use this if your " .. SKILL_NAMES[v[1]] .. " skill is lower than " .. v[2], TALKTYPE_ORANGE_1, false, cid)
	end
	return true
end
	]]></action>
</mod>

I'm not so sure about "<action itemid="2556" event="script">" cuz I use multiple items ;o
 
Still doesn't work :o I only get some %

Also, you "can't" use the items more than once. If you use it twice or more, nothing will happen - your skill percents won't even go up 1% :P
 
I don't remember what I changed in order to fix this function ;/

Edit: Found :)
050-function.lua, edit this function:
Code:
function doPlayerAddSkill(cid, skill, amount, round)
	if(skill == SKILL__LEVEL) then
		return doPlayerAddLevel(cid, amount, round)
	elseif(skill == SKILL__MAGLEVEL) then
		return doPlayerAddMagLevel(cid, amount)
	end

	return doPlayerAddSkillTry(cid, skill, [COLOR="Red"][B]math.ceil([/B][/COLOR](getPlayerRequiredSkillTries(cid, skill, getPlayerSkillLevel(cid, skill) + 1) - getPlayerSkillTries(cid, skill)) / getConfigInfo('rateSkill')[B][COLOR="Red"])[/COLOR][/B])
end
 
Last edited:
I think you must use
Code:
doPlayerAddSkillTry(cid, skillid, getPlayerRequiredSkillTries(cid, skillid, getPlayerSkillLevel(cid, skillId)+1))
instead of doPlayerAddSkill :p something like that XD
 
Back
Top