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

Special rune

gaku

New Member
Joined
Nov 27, 2007
Messages
33
Reaction score
0
Hi guys, i was wondering if its possible to make a rune that you can only use on yourself, but not on others. Just like mana fluid but as rune.
Would be nice
Thx
 
pretty simple if you add it to actions

Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
        if itemEx.uid == cid then
             your code here
        end
end
 
Or simply:
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
        if itemEx.uid ~= cid then
             doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
             return doPlayerSendCancel(cid, "You can only use this rune on yourself.")
        end
        -- your code here
end
 
I did try it but could not do it :S
I wanted to add it in spells to. Here is the rune:

--calculed by ta4e--
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_HEALING)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
setCombatParam(combat, COMBAT_PARAM_TARGETCASTERORTOPMOST, 1)
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, 0)
setCombatParam(combat, COMBAT_PARAM_DISPEL, CONDITION_PARALYZE)


function onGetFormulaValues(cid, level, maglevel)
min = (level * 2 + maglevel * 3) * 2.1 - 30
max = (level * 2 + maglevel * 3) * 3

if min < 250 then
min = 250
end

return min, max
end

setCombatCallback(combat, CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")

function onCastSpell(cid, var)
return doCombat(cid, combat, var)
end

edit: Can you show me where I have to add the function which you said up? Ty
 
Code:
--calculed by ta4e--
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_HEALING)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
setCombatParam(combat, COMBAT_PARAM_TARGETCASTERORTOPMOST, 1)
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, 0)
setCombatParam(combat, COMBAT_PARAM_DISPEL, CONDITION_PARALYZE)


function onGetFormulaValues(cid, level, maglevel)
min = (level * 2 + maglevel * 3) * 2.1 - 30
max = (level * 2 + maglevel * 3) * 3

if min < 250 then
min = 250
end

return min, max
end

setCombatCallback(combat, CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")

function onCastSpell(cid, var)
    if variantToNumber(var) ~= cid then
        doPlayerSendCancel(cid, "You can only use this rune on yourself.")
        return LUA_ERROR
    end
    return doCombat(cid, combat, var)
end
 
Nice it works but:
- if I use the hotkey, it works ver fine
- if I use the mouse and "strg" it says, you can only use it on yourself and it waste 1 uh :S
 
Still cant use it with mouse. Only per hotkeys. If its not possible to change, I could be fine with it, but If its possible it would be nice ^^
 
It should work now, if you took my updated code :eek:

Try again, if it really doesn't then try this:
Code:
--calculed by ta4e--
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_HEALING)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
setCombatParam(combat, COMBAT_PARAM_TARGETCASTERORTOPMOST, 1)
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, 0)
setCombatParam(combat, COMBAT_PARAM_DISPEL, CONDITION_PARALYZE)


function onGetFormulaValues(cid, level, maglevel)
min = (level * 2 + maglevel * 3) * 2.1 - 30
max = (level * 2 + maglevel * 3) * 3

if min < 250 then
min = 250
end

return min, max
end

setCombatCallback(combat, CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")

function onCastSpell(cid, var)
    if variantToNumber(var) == cid then
        return doCombat(cid, combat, var)
    end
    doPlayerSendCancel(cid, "You can only use this rune on yourself.")
end
 
Aff, I have to post again ^^.
I tried it now, but I did notice that if you use "use on target" in hotkey, the player will be healed by you :S. So still bugged.
 
Are you sure you tested the updated code at first page? And then AFTER that, the new one in this page? Because, when returning LUA_ERROR, the spell is cancelled.

Try the one at page 1 again please?
 
I did but still it says, only on yourself by mouse.
Btw. forgot say, I am using "theforgottenserver-v0.2-win32gui"
Its for 8.21
 
Back
Top