function onSay(cid, words, param)
-- Rune Merger Spell by Alreth, v1.02.
-- Last updated 2007-04-25 13:00, by Alreth.
-- Edit these variables so they fit to your map and server settings. --
runesidmin = 2261 -- Itemid of the first rune on the server
runesidmax = 2316 -- Itemid of the last rune on the server
manacost = 100 -- Mana spent every time runes are merged
maxcharges = 250 -- Max amount of charges allowed for runes (value has to be between 2 and 255)
allowvoc = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10} -- Enter the vocation ids which will be allowed to use this rune. 0 = rook, 1 = sorc, 2 = druid, 3 = paladin, 4 = knight
gmaccess = 3 -- Accesslevel for GMs (GMs are allowed, regardless vocation)
-- Stop editing here unless you know what you are doing. --
rune1 = getPlayerSlotItem(cid, 5) -- The item in your left hand
rune2 = getPlayerSlotItem(cid, 6) -- The item in your right hand
if (isInArray(allowvoc, getPlayerVocation(cid)) or getPlayerAccess(cid) >= gmaccess) then
if (rune1.itemid >= runesidmin and rune1.itemid <= runesidmax) then
if (rune1.itemid == rune2.itemid) then
if (getPlayerMana(cid) < manacost) then
doPlayerSendTextMessage(cid, 22, "You need "..manacost.." mana to perform this merge.")
return 1
else
rune1x = rune1.type
rune2x = rune2.type
if (rune1x == 0) then
rune1x = 1
end
if (rune2x == 0) then
rune2x = 1
end
runetotal = rune1x + rune2x
if (runetotal <= maxcharges) then
newrune1 = runetotal
newrune2 = 0
else
newrune1 = maxcharges
newrune2 = runetotal-maxcharges
doPlayerSendTextMessage(cid, 22, "The new merged rune can not have more than "..maxcharges.." charges. One full rune will be made and one with restoring charges.")
end
if (newrune1 > 0) then
doPlayerAddItem(cid, rune1.itemid, newrune1)
end
if (newrune2 > 0) then
doPlayerAddItem(cid, rune1.itemid, newrune2)
end
doRemoveItem(rune1.uid, rune1.type)
doRemoveItem(rune2.uid, rune2.type)
doSendAnimatedText(getPlayerPosition(cid),"Adevo mas", 24)
doSendMagicEffect(getPlayerPosition(cid), 14)
doPlayerAddMana(cid, -manacost)
end
else
doPlayerSendTextMessage(cid, 22, "Please hold two runes of the same typ in each one of your hands before trying to merge them together.")
doSendMagicEffect(getPlayerPosition(cid), 2)
return 1
end
else
doPlayerSendTextMessage(cid, 22, "You can only merge runes together.")
doSendMagicEffect(getPlayerPosition(cid), 2)
return 1
end
else
doSendMagicEffect(getPlayerPosition(cid), 2)
doPlayerSendCancel(cid, "Sorry, but your vocation is not allowed to perform this spell.")
return 1
end
return 0
-- end of rune merger script --
end
<talkaction words="adevo mas" script="mergerune.lua" />
Code:function onSay(cid, words, param) -- Rune Merger Spell by Alreth, v1.02. -- Last updated 2007-04-25 13:00, by Alreth. -- Edit these variables so they fit to your map and server settings. -- runesidmin = 2261 -- Itemid of the first rune on the server runesidmax = 2316 -- Itemid of the last rune on the server manacost = 100 -- Mana spent every time runes are merged maxcharges = 250 -- Max amount of charges allowed for runes (value has to be between 2 and 255) allowvoc = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10} -- Enter the vocation ids which will be allowed to use this rune. 0 = rook, 1 = sorc, 2 = druid, 3 = paladin, 4 = knight gmaccess = 3 -- Accesslevel for GMs (GMs are allowed, regardless vocation) -- Stop editing here unless you know what you are doing. -- rune1 = getPlayerSlotItem(cid, 5) -- The item in your left hand rune2 = getPlayerSlotItem(cid, 6) -- The item in your right hand if (isInArray(allowvoc, getPlayerVocation(cid)) or getPlayerAccess(cid) >= gmaccess) then if (rune1.itemid >= runesidmin and rune1.itemid <= runesidmax) then if (rune1.itemid == rune2.itemid) then if (getPlayerMana(cid) < manacost) then doPlayerSendTextMessage(cid, 22, "You need "..manacost.." mana to perform this merge.") return 1 else rune1x = rune1.type rune2x = rune2.type if (rune1x == 0) then rune1x = 1 end if (rune2x == 0) then rune2x = 1 end runetotal = rune1x + rune2x if (runetotal <= maxcharges) then newrune1 = runetotal newrune2 = 0 else newrune1 = maxcharges newrune2 = runetotal-maxcharges doPlayerSendTextMessage(cid, 22, "The new merged rune can not have more than "..maxcharges.." charges. One full rune will be made and one with restoring charges.") end if (newrune1 > 0) then doPlayerAddItem(cid, rune1.itemid, newrune1) end if (newrune2 > 0) then doPlayerAddItem(cid, rune1.itemid, newrune2) end doRemoveItem(rune1.uid, rune1.type) doRemoveItem(rune2.uid, rune2.type) doSendAnimatedText(getPlayerPosition(cid),"Adevo mas", 24) doSendMagicEffect(getPlayerPosition(cid), 14) doPlayerAddMana(cid, -manacost) end else doPlayerSendTextMessage(cid, 22, "Please hold two runes of the same typ in each one of your hands before trying to merge them together.") doSendMagicEffect(getPlayerPosition(cid), 2) return 1 end else doPlayerSendTextMessage(cid, 22, "You can only merge runes together.") doSendMagicEffect(getPlayerPosition(cid), 2) return 1 end else doSendMagicEffect(getPlayerPosition(cid), 2) doPlayerSendCancel(cid, "Sorry, but your vocation is not allowed to perform this spell.") return 1 end return 0 -- end of rune merger script -- end