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

Lua tfs 0.4 Add soul

LegacyOT

New Member
Joined
Sep 7, 2023
Messages
10
Reaction score
0
Helloo, I need a script that adds 10 souls when pressed like a manarune
Lua:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_MANADRAIN)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, false)
setCombatParam(combat, COMBAT_PARAM_TARGETCASTERORTOPMOST, true)
setHealingFormula(combat, COMBAT_FORMULA_LEVELMAGIC, 0.45, 0.40, 15, 20)
-- setHealingFormula(combat, COMBAT_FORMULA_LEVELMAGIC, 0.15, 0.15, 4, 5)

function onCastSpell(cid, var)
doCreatureSay(cid, "Ahhh...", TALKTYPE_ORANGE_1, cid)
    return doCombat(cid, combat, var)
end

it's currently on manarune, could someone modify it to add 10 souls?
 
Lua:
function onCastSpell(cid, var)
    if getPlayerSoul(cid) > 199 then
        doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, 'You got max soul')
        return false
    end
    doPlayerAddSoul(cid, 10)
    doSendMagicEffect(cid, CONST_ME_FIREAREA)
    return true
end

Do you want to add the soul inside the manarune script?
Next time use luascript.cpp to find functions
 
Last edited:
Works! Cool thanks,
and can it be added so that the item disappears after one use?

You can edit that in spells.xml as "charges = 1" or something like this forgot it
And here if you dont want it as a spell
actionScript

Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
    if getPlayerSoul(cid) > 199 then
        doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, 'You got max soul')
        return true
    end
    doPlayerAddSoul(cid, 10)
    doSendMagicEffect(cid, CONST_ME_FIREAREA)
    doRemoveItem(item.uid, 1)
    return true
end
 
okey, great i have one problem

Lua:
[17:32:33.182] [Error - Spell Interface]
[17:32:33.183] data/spells/scripts/healing/soul stone.lua:onCastSpell
[17:32:33.185] Description:
[17:32:33.185] attempt to index a number value
[17:32:33.186] stack traceback:
[17:32:33.188]  [C]: in function 'doSendMagicEffect'
[17:32:33.189]  data/spells/scripts/healing/soul stone.lua:10: in function <data/spells/scripts/healing/soul stone.lua:4
 
okey, great i have one problem

Lua:
[17:32:33.182] [Error - Spell Interface]
[17:32:33.183] data/spells/scripts/healing/soul stone.lua:onCastSpell
[17:32:33.185] Description:
[17:32:33.185] attempt to index a number value
[17:32:33.186] stack traceback:
[17:32:33.188]  [C]: in function 'doSendMagicEffect'
[17:32:33.189]  data/spells/scripts/healing/soul stone.lua:10: in function <data/spells/scripts/healing/soul stone.lua:4
Change line 7 to
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_FIREAREA)
 
Change line 7 to
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_FIREAREA)

Perfect works, thanks!
Post automatically merged:

You can edit that in spells.xml as "charges = 1" or something like this forgot it
And here if you dont want it as a spell
actionScript

Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
    if getPlayerSoul(cid) > 199 then
        doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, 'You got max soul')
        return true
    end
    doPlayerAddSoul(cid, 10)
    doSendMagicEffect(cid, CONST_ME_FIREAREA)
    doRemoveItem(item.uid, 1)
    return true
end
script doesn't work either with Remove Item I change spells.xml charges ="1" and nothing
id item 5809 - soul stone :/
 

Similar threads

Back
Top