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

The Manarune.

loukili

New Member
Joined
Aug 11, 2009
Messages
12
Reaction score
0
This is my first tutorial
Today i gonna explain how to make a manarune :D


First go to data/actions/scripts, make a new .lua file and call it 'manarune.lua'
In the document you have to fill this in


PHP:
function onUse(cid, item, frompos, item2, topos)

minMana = 1000 -- How much mana minium will you get?
maxMana = 10000 -- How much mana max will you get?
magToUse = 8 -- What magic level do you need to be to use the rune?
useStats = true -- Shall given mana be affected by player level and magic level?
runeID = 2294 -- Enter the item Id of the rune.
loseCharges = false -- Write "true" if it shall lose charges. If not, then write something else such as "false".
storeValue = 3567 -- Value where exhaust is saved.
exhaustTime = 2 -- 1 = 1 second of exhaustion.
animationColor = 44 -- The color of the "animation".
mLvlLowMsg = "Your magic level is too low." -- Appears when player got too low magic level.
missPlayerMsg = "You can only use this rune on players."-- Appears when you don't shoot on a player.
exhaustMsg = "You are exhausted." -- Appears when you are exhausted.

------------------------------DONT CHANGE UNDER THIS LINE----------------------------------------------------------------------------------------

if item.itemid == runeID then
if getThingfromPos({x=topos.x, y=topos.y, z=topos.z, stackpos=253}).itemid > 0 then
if getPlayerMagLevel(cid) >= magToUse then
if (exhaust(cid, storeValue, 1) > 0) then
if loseCharges == true or loseCharges == True then
if item.type > 1 then
doChangeTypeItem(item.uid, item.type-1)
else
doRemoveItem(item.uid, 1)
end
end
newMana = math.random(minMana, maxMana)
if useStats then
newMana = newMana + getPlayerLevel(cid) + getPlayerMagLevel(cid)
end
manaNow = getPlayerMana(item2.uid)
doPlayerAddMana(item2.uid, 999999)
manaMax = getPlayerMana(item2.uid)
doPlayerAddMana(item2.uid, - manaMax + manaNow)
nMana = manaMax - manaNow
if newMana > nMana then
newMana = nMana
end
if getPlayerMana(item2.uid) == manaMax then
if getPlayerPosition(cid).x == getPlayerPosition(item2.uid).x and getPlayerPosition(cid).y == getPlayerPosition(item2.uid).y then
doPlayerSendCancel(item2.uid, "Your mana is already full.")
doChangeTypeItem(item.uid, item.type)
else
doPlayerSendCancel(cid, "" .. getPlayerName(item2.uid) .. " mana is already full.")
doChangeTypeItem(item.uid, item.type)
end
else
if getPlayerPosition(cid).x == getPlayerPosition(item2.uid).x and getPlayerPosition(cid).y == getPlayerPosition(item2.uid).y then
doSendMagicEffect(getPlayerPosition(cid), 12)
doPlayerSendTextMessage(cid, 23, "You received " .. newMana .. " mana.")
else
doSendMagicEffect(getPlayerPosition(cid), 14)
doSendMagicEffect(getPlayerPosition(item2.uid), 12)
doPlayerSendTextMessage(item2.uid, 23, "You received " .. newMana .. " mana.")
doPlayerSendTextMessage(cid, 23, "You gave " .. getPlayerName(item2.uid) .. " " .. newMana .. " mana.")
end
doPlayerAddMana(item2.uid, newMana)
doSendAnimatedText(getPlayerPosition(item2.uid), newMana, animationColor)
end
else
doPlayerSendCancel(cid, exhaustMsg)
end
else
doSendMagicEffect(getPlayerPosition(cid), 2)
doPlayerSendCancel(cid, mLvlLowMsg)
end
else
doSendMagicEffect(getPlayerPosition(cid), 2)
doPlayerSendCancel(cid, missPlayerMsg)
end
return 1
end
end


-- Exhaustion system (Made by Alreth, bugfix by me)
-- DO NOT EDIT!
function exhaust(cid, storeValue, exhaustTime)

newExhaust = os.time()
oldExhaust = getPlayerStorageValue(cid, storeValue)
if (oldExhaust == nil or oldExhaust < 0) then
oldExhaust = 0
end
if (exhaustTime == nil or exhaustTime < 0) then
exhaustTime = 1
end
diffTime = os.difftime(newExhaust, oldExhaust)
if (diffTime >= exhaustTime) then
setPlayerStorageValue(cid, storeValue, newExhaust)
return 1
else
return 0
end
end

As you see you can edit it yourself.
Save this document, copy it and paste it in data/spells/scripts/healing.
After that you have to find id 2294 (or the id you wanna use) and change the name in Manarune, after this go to data/actions/actions.xml and add this line

PHP:
<action itemid="2294" script="manarune.lua" />

After this, you got your manarune, it's not the best one but its 1 !

Have fun with it
 
i remeber this code, it looks like that one from armonia, that i saw a while ago, u have just removed the text at the beginning that says who created it i guess.
stealz00r?
 
i remeber this code, it looks like that one from armonia, that i saw a while ago, u have just removed the text at the beginning that says who created it i guess.
stealz00r?

Stolen + gotten rid of all the indents too :/
 
This is my first tutorial
Today i gonna explain how to make a manarune :D


First go to data/actions/scripts, make a new .lua file and call it 'manarune.lua'
In the document you have to fill this in


PHP:
function onUse(cid, item, frompos, item2, topos)

minMana = 1000 -- How much mana minium will you get?
maxMana = 10000 -- How much mana max will you get?
magToUse = 8 -- What magic level do you need to be to use the rune?
useStats = true -- Shall given mana be affected by player level and magic level?
runeID = 2294 -- Enter the item Id of the rune.
loseCharges = false -- Write "true" if it shall lose charges. If not, then write something else such as "false".
storeValue = 3567 -- Value where exhaust is saved.
exhaustTime = 2 -- 1 = 1 second of exhaustion.
animationColor = 44 -- The color of the "animation".
mLvlLowMsg = "Your magic level is too low." -- Appears when player got too low magic level.
missPlayerMsg = "You can only use this rune on players."-- Appears when you don't shoot on a player.
exhaustMsg = "You are exhausted." -- Appears when you are exhausted.

------------------------------DONT CHANGE UNDER THIS LINE----------------------------------------------------------------------------------------

if item.itemid == runeID then
if getThingfromPos({x=topos.x, y=topos.y, z=topos.z, stackpos=253}).itemid > 0 then
if getPlayerMagLevel(cid) >= magToUse then
if (exhaust(cid, storeValue, 1) > 0) then
if loseCharges == true or loseCharges == True then
if item.type > 1 then
doChangeTypeItem(item.uid, item.type-1)
else
doRemoveItem(item.uid, 1)
end
end
newMana = math.random(minMana, maxMana)
if useStats then
newMana = newMana + getPlayerLevel(cid) + getPlayerMagLevel(cid)
end
manaNow = getPlayerMana(item2.uid)
doPlayerAddMana(item2.uid, 999999)
manaMax = getPlayerMana(item2.uid)
doPlayerAddMana(item2.uid, - manaMax + manaNow)
nMana = manaMax - manaNow
if newMana > nMana then
newMana = nMana
end
if getPlayerMana(item2.uid) == manaMax then
if getPlayerPosition(cid).x == getPlayerPosition(item2.uid).x and getPlayerPosition(cid).y == getPlayerPosition(item2.uid).y then
doPlayerSendCancel(item2.uid, "Your mana is already full.")
doChangeTypeItem(item.uid, item.type)
else
doPlayerSendCancel(cid, "" .. getPlayerName(item2.uid) .. " mana is already full.")
doChangeTypeItem(item.uid, item.type)
end
else
if getPlayerPosition(cid).x == getPlayerPosition(item2.uid).x and getPlayerPosition(cid).y == getPlayerPosition(item2.uid).y then
doSendMagicEffect(getPlayerPosition(cid), 12)
doPlayerSendTextMessage(cid, 23, "You received " .. newMana .. " mana.")
else
doSendMagicEffect(getPlayerPosition(cid), 14)
doSendMagicEffect(getPlayerPosition(item2.uid), 12)
doPlayerSendTextMessage(item2.uid, 23, "You received " .. newMana .. " mana.")
doPlayerSendTextMessage(cid, 23, "You gave " .. getPlayerName(item2.uid) .. " " .. newMana .. " mana.")
end
doPlayerAddMana(item2.uid, newMana)
doSendAnimatedText(getPlayerPosition(item2.uid), newMana, animationColor)
end
else
doPlayerSendCancel(cid, exhaustMsg)
end
else
doSendMagicEffect(getPlayerPosition(cid), 2)
doPlayerSendCancel(cid, mLvlLowMsg)
end
else
doSendMagicEffect(getPlayerPosition(cid), 2)
doPlayerSendCancel(cid, missPlayerMsg)
end
return 1
end
end


-- Exhaustion system (Made by Alreth, bugfix by me)
-- DO NOT EDIT!
function exhaust(cid, storeValue, exhaustTime)

newExhaust = os.time()
oldExhaust = getPlayerStorageValue(cid, storeValue)
if (oldExhaust == nil or oldExhaust < 0) then
oldExhaust = 0
end
if (exhaustTime == nil or exhaustTime < 0) then
exhaustTime = 1
end
diffTime = os.difftime(newExhaust, oldExhaust)
if (diffTime >= exhaustTime) then
setPlayerStorageValue(cid, storeValue, newExhaust)
return 1
else
return 0
end
end

As you see you can edit it yourself.
Save this document, copy it and paste it in data/spells/scripts/healing.
After that you have to find id 2294 (or the id you wanna use) and change the name in Manarune, after this go to data/actions/actions.xml and add this line

PHP:
<action itemid="2294" script="manarune.lua" />

After this, you got your manarune, it's not the best one but its 1 !

Have fun with it



This is what i call "Steal"

Lua:
-- >>CONFIG<< --by Wlj-of-otland.net--
local MIN_MANA_GAIN = 769 -- How much is the lowest mana you can possibly gain (If your heal less than that amount of mana you will get that mana instead) ?
local MIN_MANA_RAND = 1657 -- The minimum amount of mana to be given (random)
local MAX_MANA_RAND = 1900 -- The maximum amount of mana to be given (random)
local ACCEPT_LUCK = true -- Should it be possible to get lucky and receive extra mana? true, false
local MAG_LEVEL_MULTI = 2 -- How many times should Magic Level be multiplied, to be added to the mana formula? 1 = same, 0 = nothing etc
local LEVEL_MULTI = 2 -- How many times should Level be multiplied, to be added to the mana formula? 1 = same, 0 = nothing etc 
local MAGIC_EFFECT = CONST_ME_SLEEP -- Magic effect that will be casted on the player each time it heals the mana.
local ANIMATION_COLOR = 37 -- What animation color will there be when you heal (Comes over player showing how much mana you healed) 1 - 255 (?)
local HEAL_TIMES = 1 -- How many times should you be healed when using the manarune once? Atleast 1
local FIRST_HEAL_DELAY = 0 -- How long time will it take before it heals FIRST time? In milliseconds
local HEAL_DELAY = 1000 -- How long time will it take before it heals one? In milliseconds
-- >>CONFIG<< --


local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TARGETCASTERORTOPMOST, 1)
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, 0)

local exhaust = createConditionObject(CONDITION_EXHAUSTED)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, HEAL_TIMES * HEAL_DELAY + FIRST_HEAL_DELAY)
        
function onCastSpell(cid, var)
doTargetCombatCondition(0, cid, exhaust, CONST_ME_NONE)
    local function doHealMana(parameters)
        local random = math.random(MIN_MANA_RAND, MAX_MANA_RAND)
        if ACCEPT_LUCK == true then
            local luck = math.random(1, 100)
            if luck >= 90 then
                random = random * 2
            elseif luck == 50 then
                random = random * 3
            end
        end
        local formula = (getPlayerLevel(cid) * LEVEL_MULTI) + (getPlayerMagLevel(cid) * MAG_LEVEL_MULTI) + random
        local manaGain = math.max(MIN_MANA_GAIN, formula)
        doPlayerAddMana(cid, manaGain)
        doCreatureSay(cid,"Hail GM Brutal Legend!",19)
        doSendAnimatedText(getPlayerPosition(cid), manaGain, ANIMATION_COLOR)
        doSendMagicEffect(getPlayerPosition(cid), MAGIC_EFFECT)
        doCombat(parameters.cid, parameters.combat, parameters.var)
    end

    local times = HEAL_TIMES
    local parameters = {cid = cid, combat = combat, var = var}
    while times > 0 do
        if times == HEAL_TIMES then
            addEvent(doHealMana, FIRST_HEAL_DELAY, parameters)
        else
            addEvent(doHealMana, HEAL_DELAY * times, parameters) 
        end
        times = times - 1
    end
end



bug
Lua:
end 
else 
doSendMagicEffect(getPlayerPosition(cid), 2) 
doPlayerSendCancel(cid, mLvlLowMsg) 
end 
else 
doSendMagicEffect(getPlayerPosition(cid), 2) 
doPlayerSendCancel(cid, missPlayerMsg) 
end
For ots that wanna a good mana rune go otfan*s.net and look for colandus he has the best bug free mana rune so if i was u i woudent take this and those that are like 7 lines.
 
Back
Top