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

Burning Heart TFS 1.1 SCRIPT! HELP

Cygan123

Member
Joined
Jan 1, 2022
Messages
35
Reaction score
8
Hello, I need a script for an item that will be healed when clicking on it, so called Burning Heart ..
I wish it had infinite uses and add random lives from 300 to 600, exthaused 1
 
XML:
<action itemid="2353" script="burning_heart.lua" />
Lua:
local config = {
    minHeal = 300,
    maxHeal = 600,
    exhaust = 1000, -- milliseconds
    infiniteItem = true
}
local exhaustedCreatures = {}    

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    local playerId = player:getId()
    local currentTime = os.mtime()
    
    -- check exhaust
    if exhaustedCreatures[playerId] and exhaustedCreatures[playerId] > currentTime then
        player:sendTextMessage(MESSAGE_STATUS_SMALL, "You are exhausted.")
        return true
    end
    -- add exhaust
    exhaustedCreatures[playerId] = currentTime + config.exhaust
    
    -- heal player
    local healAmount = math.random(config.minHeal, config.maxHeal)
    player:addHealth(healAmount)

    -- remove item, if not infinite
    if not config.infiniteItem then
        item:remove(1)
    end
    return true
end
 
Hello. Super, everything works! Could you add a line when I click is effect CONST_ME_MAGIC_RED ?
And so that they can be put on where arrow are given.
 
Last edited:
And so that they can be put on where arrow are given.
Need to edit items.xml to equip for arrow slot
and add it to movements.xml

Hello. Super, everything works! Could you add a line when I click is effect CONST_ME_MAGIC_RED ?
Lua:
local config = {
    minHeal = 300,
    maxHeal = 600,
    exhaust = 1000, -- milliseconds
    effect = CONST_ME_MAGIC_RED,
    infiniteItem = true
}
local exhaustedCreatures = {}    

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    local playerId = player:getId()
    local currentTime = os.mtime()
    
    -- check exhaust
    if exhaustedCreatures[playerId] and exhaustedCreatures[playerId] > currentTime then
        player:sendTextMessage(MESSAGE_STATUS_SMALL, "You are exhausted.")
        return true
    end
    -- add exhaust
    exhaustedCreatures[playerId] = currentTime + config.exhaust
    
    -- heal player
    local healAmount = math.random(config.minHeal, config.maxHeal)
    player:addHealth(healAmount)
    player:getPosition():sendMagicEffect(config.effect)
    
    -- remove item, if not infinite
    if not config.infiniteItem then
        item:remove(1)
    end
    return true
end
 
Thank you the effect works :)

What exactly should I edit in movements.xml?

In Items.xml I edited like this:
<item id="2353" article="a" name="burning heart">
<attribute key="description" value="<3" />
<attribute key="weight" value="400" />
<attribute key="weaponType" value="ammunition" />
<attribute key="ammoType" value="arrow" />
<attribute key="decayTo" value="0" />
<attribute key="duration" value="86400" />
 
Thank you the effect works :)

What exactly should I edit in movements.xml?

In Items.xml I edited like this:
items.xml
XML:
<item id="2353" article="a" name="burning heart">
<attribute key="description" value="<3" />
<attribute key="slotType" value="ammo" />
<attribute key="weight" value="400" />

If you don't have armor / regen / transform on the item, you can ignore movements.xml
 
Back
Top