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

Manarune heal friend

Hashirama479

World of Ninja
Joined
Dec 19, 2016
Messages
536
Solutions
6
Reaction score
74
Can someone make the script work so I can heal my friends with that manarune? Its a Action Script and im using tfs 0.4 xD thanks

Lua:
local exhaust = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, 750) -- time in seconds x1000

function onUse(cid, item, fromPosition, itemEx, toPosition)

local manamax = getPlayerMaxMana(cid)
local min = 15
local max = 15
local mana_add = math.random((manamax * (min/100)), (manamax * (max/100)))

if(hasCondition(cid, CONDITION_EXHAUST)) then
return true
end
local pos = getThingPos(cid)
local kolor = 210 -- kolor napisu
doPlayerAddMana(cid, mana_add)
doSendMagicEffect(getThingPos(cid), CONST_ME_HOLYAREA)
doSendAnimatedText(getPlayerPosition(cid),mana_add,kolor)
doAddCondition(cid, exhaust)
return true
end
 
Solution
Change all the cid variables to itemEx
But add an if statment below the function
Lua:
if not isPlayer(itemEx.uid) then
    -- error message
end
Change all the cid variables to itemEx
But add an if statment below the function
Lua:
if not isPlayer(itemEx.uid) then
    -- error message
end
 
Solution
I dont understand at all what I must change so the parts wheres "cid" needs to get changed to "itemEx" ?

Yeah, I've never seen it done this way but if I understand correctly he's saying like this. If it doesn't work this way, try removing the .uid parts other than where Wibbenz specified.

Lua:
local exhaust = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, 750) -- time in seconds x1000

function onUse(cid, item, fromPosition, itemEx, toPosition)
    local manamax = getPlayerMaxMana(cid)
    local min = 15
    local max = 15
    local mana_add = math.random((manamax * (min/100)), (manamax * (max/100)))

    if hasCondition(cid, CONDITION_EXHAUST) then
        return true
    end

    if not isPlayer(itemEx.uid) then
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You may only use this on players!")
        return true
    end

    local pos = getThingPos(itemEx.uid)
    local kolor = 210 -- kolor napisu
    doPlayerAddMana(itemEx.uid, mana_add)
    doSendMagicEffect(getThingPos(itemEx.uid), CONST_ME_HOLYAREA)
    doSendAnimatedText(getPlayerPosition(itemEx.uid),mana_add,kolor)
    doAddCondition(cid, exhaust)
    return true
end
 
I dont understand at all what I must change so the parts wheres "cid" needs to get changed to "itemEx" ?

If you look at the code you see cid in a couple of diffrent places, replace those
Cid = creature id aka the player that is using the item.
ItemEx = the thing we using it at, if you use it with an hotkey and "use with" or "use on yourself" etc

Pretty much what @Apollos did for you.
 
LOL so nice is it possible to do 1 more thing on it? Also healing working but just if you stand next to the player :x I want it like distance healing xD
 
XML:
<action itemid="YOURitemID" event="script" value="script.lua" allowfaruse="1"/>
allowfaruse="1"
 
Back
Top