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

[Action] Spirit rune

Himii

Premium User
Premium User
Joined
Jan 19, 2011
Messages
1,268
Solutions
5
Reaction score
188
Location
Sweden
Hello guys

Shuld need some help with a script
Can you make this script but like a spirit potion
PHP:
local runes = {
	[2270] = {
		voc = {4, 8, 12},
		min = 'level * 4 + maglv * 2 - 3',
		max = 'level * 6 + maglv * 4'
	}
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
	local i = runes[item.itemid]
	if isInArray(i.voc, getPlayerVocation(cid)) then
		if isPlayer(itemEx.uid) then
			level, maglv = getPlayerLevel(cid), getPlayerMagLevel(cid)
			doCreatureAddHealth(cid, math.random(loadstring('return '..i.min)(), loadstring('return '..i.max)()))
			doSendMagicEffect(getThingPos(itemEx.uid), CONST_ME_MAGIC_BLUE)
			doCreatureSay(itemEx.uid, "Undead Uh..", TALKTYPE_ORANGE_1)
			doRemoveItem(item.uid, 0)
		else
			doPlayerSendDefaultCancel(cid, RETURNVALUE_CANONLYUSETHISRUNEONCREATURES)
		end
	else
		doPlayerSendCancel(cid, 'Your vocation cannot use this rune.')
	end
	return true
end

Repp++
 
Last edited:
Errr?

You could just add the spirit potion id? on the actions.xml

The script i showed is not a spirit potion.
and the spirit potion heals like the same all the time and i want a rune who on some ots is callen an mixed rune who changes after which magiclvl u have
 
Hello guys

Shuld need some help with a script
Can you make this script but like a spirit potion
PHP:
local runes = {
	[2270] = {
		voc = {4, 8, 12},
		min = 'level * 4 + maglv * 2 - 3',
		max = 'level * 6 + maglv * 4'
	}
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
	local i = runes[item.itemid]
	if isInArray(i.voc, getPlayerVocation(cid)) then
		if isPlayer(itemEx.uid) then
			level, maglv = getPlayerLevel(cid), getPlayerMagLevel(cid)
			doCreatureAddHealth(cid, math.random(loadstring('return '..i.min)(), loadstring('return '..i.max)()))
			doSendMagicEffect(getThingPos(itemEx.uid), CONST_ME_MAGIC_BLUE)
			doCreatureSay(itemEx.uid, "Undead Uh..", TALKTYPE_ORANGE_1)
			doRemoveItem(item.uid, 0)
		else
			doPlayerSendDefaultCancel(cid, RETURNVALUE_CANONLYUSETHISRUNEONCREATURES)
		end
	else
		doPlayerSendCancel(cid, 'Your vocation cannot use this rune.')
	end
	return true
end

Repp++
what is your problem on this script?
 
i think you need this one? :S
if it's i didn't test it so test it and reply back ;s
LUA:
function onUse(cid, item, frompos, item2, topos)
mag = getPlayerMagLevel(cid)
if mag >= 3 then
doSendMagicEffect(topos,1)
doCreatureSay(cid,"Super Manarune",19)
mini = (getPlayerLevel(cid) * 3.5 + getPlayerMagLevel(cid) * 3) * 4.6 - 25
maxi = (getPlayerLevel(cid) * 3.5 + getPlayerMagLevel(cid) * 3) * 5.2
doPlayerAddHealth(cid, math.random(mini, maxi))
doPlayerAddMana(cid, math.random(mini, maxi))
if item.type > 1 then
end
else
doSendMagicEffect(frompos,2)
doPlayerSendCancel(cid,"You don't have the required magic level to use that rune.")
end
return 1
end
 
i think you need this one? :S
if it's i didn't test it so test it and reply back ;s
LUA:
function onUse(cid, item, frompos, item2, topos)
mag = getPlayerMagLevel(cid)
if mag >= 3 then
doSendMagicEffect(topos,1)
doCreatureSay(cid,"Super Manarune",19)
mini = (getPlayerLevel(cid) * 3.5 + getPlayerMagLevel(cid) * 3) * 4.6 - 25
maxi = (getPlayerLevel(cid) * 3.5 + getPlayerMagLevel(cid) * 3) * 5.2
doPlayerAddHealth(cid, math.random(mini, maxi))
doPlayerAddMana(cid, math.random(mini, maxi))
if item.type > 1 then
end
else
doSendMagicEffect(frompos,2)
doPlayerSendCancel(cid,"You don't have the required magic level to use that rune.")
end
return 1
end


2 Things can you make it work only for paladins and i want it to heal :P, Thx
 
try this
LUA:
function onUse(cid, item, frompos, item2, topos)
mag = getPlayerMagLevel(cid)
if mag >= 3 then
doSendMagicEffect(topos,1)
doCreatureSay(cid,"Mixed Rune",19)
mini = (getPlayerLevel(cid) * 2.5 + getPlayerMagLevel(cid) * 3) * 4.6 - 25
maxi = (getPlayerLevel(cid) * 2.5 + getPlayerMagLevel(cid) * 3) * 5.2
doPlayerAddMana(cid, math.random(mini, maxi))
if item.type > 1 then
end
doPlayerAddHealth(cid, math.random(mini, maxi))
if item.type > 1 then
end
else
doSendMagicEffect(frompos,2)
doPlayerSendCancel(cid,"You don't have the required magic level to use that rune.")
end
return 1
end

- - - Updated - - -

yo?
 
try this
LUA:
function onUse(cid, item, frompos, item2, topos)
mag = getPlayerMagLevel(cid)
if mag >= 3 then
doSendMagicEffect(topos,1)
doCreatureSay(cid,"Mixed Rune",19)
mini = (getPlayerLevel(cid) * 2.5 + getPlayerMagLevel(cid) * 3) * 4.6 - 25
maxi = (getPlayerLevel(cid) * 2.5 + getPlayerMagLevel(cid) * 3) * 5.2
doPlayerAddMana(cid, math.random(mini, maxi))
if item.type > 1 then
end
doPlayerAddHealth(cid, math.random(mini, maxi))
if item.type > 1 then
end
else
doSendMagicEffect(frompos,2)
doPlayerSendCancel(cid,"You don't have the required magic level to use that rune.")
end
return 1
end

- - - Updated - - -

yo?

It´s not healing Hp only mana
and can you make it only paladin?

---Edit---

[16/12/2012 18:20:58] [Error - Action Interface]
[16/12/2012 18:20:58] data/actions/scripts/undead runes/undead spirit.lua:onUse
[16/12/2012 18:20:58] Description:
[16/12/2012 18:20:58] data/actions/scripts/undead runes/undead spirit.lua:11: attempt to call global 'doPlayerAddHealth' (a nil value)
[16/12/2012 18:20:58] stack traceback:
[16/12/2012 18:20:58] data/actions/scripts/undead runes/undead spirit.lua:11: in function <data/actions/scripts/undead runes/undead spirit.lua:1>
 
Last edited:
Well, now i did all your request , this script for paladins only , and healing mana+health
I Tested it..
LUA:
local vocations = {3,7} 

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

if isInArray(vocations,getPlayerVocation(cid)) then

doSendMagicEffect(topos,1)
doCreatureSay(cid,"Mixed Rune",19)
mini = (getPlayerLevel(cid) * 2.5 + getPlayerMagLevel(cid) * 3) * 4.6 - 25
maxi = (getPlayerLevel(cid) * 2.5 + getPlayerMagLevel(cid) * 3) * 5.2

    if doCreatureAddHealth(cid, math.random(mini, maxi)) == LUA_ERROR or doPlayerAddMana(cid, math.random(mini, maxi)) == LUA_ERROR then
        return FALSE
    end
else

        doPlayerSendCancel(cid, 'Only Paladins can use this item.')
end
    return true
end
Rep++ If It Helpful For You..
 
Well, now i did all your request , this script for paladins only , and healing mana+health
I Tested it..
LUA:
local vocations = {3,7} 

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

if isInArray(vocations,getPlayerVocation(cid)) then

doSendMagicEffect(topos,1)
doCreatureSay(cid,"Mixed Rune",19)
mini = (getPlayerLevel(cid) * 2.5 + getPlayerMagLevel(cid) * 3) * 4.6 - 25
maxi = (getPlayerLevel(cid) * 2.5 + getPlayerMagLevel(cid) * 3) * 5.2

    if doCreatureAddHealth(cid, math.random(mini, maxi)) == LUA_ERROR or doPlayerAddMana(cid, math.random(mini, maxi)) == LUA_ERROR then
        return FALSE
    end
else

        doPlayerSendCancel(cid, 'Only Paladins can use this item.')
end
    return true
end
Rep++ If It Helpful For You..

Works perfect rep++
 
Here is one i made with promoted chars only able to use it not just pallys but all: Made for TFS 0.3.7 but should work on 0.3.6
LUA:
local vocations = {7,8,5,6} 
local exhaust = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, (getConfigInfo('timeBetweenExActions') - 1000)) -- time in seconds x1000

function onUse(cid, item, fromPosition, itemEx, toPosition)
 
 
if isInArray(vocations,getPlayerVocation(cid)) then

local level = getPlayerLevel(cid)
local mlevel = getPlayerMagLevel(cid)
local min = level + (mlevel * 2) + 10
local max = level + (mlevel * 3) + 20
local mana_add = math.random(min, max)
local health_add = math.random(min, max)
 
	if(getCreatureCondition(cid, CONDITION_EXHAUST_HEAL) == TRUE) then
        	doSendMagicEffect(getThingPos(cid), CONST_ME_POFF) 
		return doPlayerSendCancel(cid, "You are exhausted")
	end
	doPlayerAddMana(cid, mana_add)
	doCreatureAddHealth(cid, health_add)
    doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE) 
	doCreatureSay(cid, "Health" .. health_add, TALKTYPE_ORANGE_1)
	doCreatureSay(cid, "Mana" .. mana_add, TALKTYPE_ORANGE_1)
	doAddCondition(cid, exhaust)
	else
	doPlayerSendCancel(cid, "Only Promoted Characters can use this Rune.")
	end
	return true
end
 
Back
Top