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

Mana rune

mimsol

New Member
Joined
Mar 18, 2020
Messages
83
Reaction score
2
because im new in scripting i hope you can help me i found that script for a manarune

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
local level = player:getLevel()
local magLevel = player:getMagicLevel()
local min = (level * 2) + (magLevel * 1) - 50
local max = (level * 3) + (magLevel * 1)
player:addMana(math.random(min, max))
player:getPosition():sendMagicEffect(CONST_ME_MAGIC_BLUE)
player:say("Uhhhh...", TALKTYPE_MONSTER_SAY)
return true
end

but i want to change that math random *3/*2
i want that the rune heal 20% of the mana and 15% health
is that possible to script that in percentage ?
 
Lua:
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
local mana = ((player:getMaxMana()/100)*20)
player:addMana(mana)
player:getPosition():sendMagicEffect(CONST_ME_MAGIC_BLUE)
player:say("Uhhhh...", TALKTYPE_MONSTER_SAY)
return true
end
never played around with newer tfs but try this one.
It should give 20% of player's max mana
Post automatically merged:

btw. what tfs are you using?
Post automatically merged:

let me know if it works so we can add health to it as well
 
tfs 1.3
worked
one problem more if i spam hotkey with the manarune i get kicked you know how to solve it btw :D ?
you may have a script that is preventing people from spamming things. (assuming there is no error in console)
 
[Warning - Event::checkScript] Can not load script: scripts/tools/skinning.lua
cannot open data/actions/scripts/tools/skinning.lua: No such file or directory
[Warning - Event::checkScript] Can not load script: scripts/tools/skinning.lua
cannot open data/actions/scripts/tools/skinning.lua: No such file or directory
[Warning - Event::checkScript] Can not load script: scripts/other/dice.lua
data/actions/scripts/other/dice.lua:94: ')' expected near 'then'
#example.lua [disabled]

only these errors
 
Increase this in your config.lua to avoid getting kicked when spamming.
Lua:
maxPacketsPerSecond
 
yeah. config should solve this.
also to repair these errors you have to delete the lines in actions.xml or add the files with the names shown in console to the right folders
 
and this is the whole script for hp and mana
Lua:
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
local mana = ((player:getMaxMana()/100)*20)
local health = ((player:getMaxHealth()/100)*15)
player:addMana(mana)
player:addHealth(health)
player:getPosition():sendMagicEffect(CONST_ME_MAGIC_BLUE)
player:say("Uhhhh...", TALKTYPE_MONSTER_SAY)
return true
end
Post automatically merged:

200 packets enough ?

i have again a problem with the 80 port its blocked again :;D
50 should be enough
 
by the way you could just add a 1 second delay on it so you don't need to change your packets per second setting:
Lua:
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if player:getStorageValue(1234) >= os.time() then
        player:sendCancelMessage(RETURNVALUE_YOUCANNOTUSEOBJECTSTHATFAST)
        return false
    end
    player:setStorageValue(1234, os.time() + 1)
    player:addMana((player:getMaxMana()/100) * 20)
    player:addHealth((player:getMaxHealth()/100) * 15)
    player:getPosition():sendMagicEffect(CONST_ME_MAGIC_BLUE)
    player:say("Uhhhh...", TALKTYPE_MONSTER_SAY)
    return true
end
 
by the way you could just add a 1 second delay on it so you don't need to change your packets per second setting:
Lua:
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if player:getStorageValue(1234) >= os.time() then
        player:sendCancelMessage(RETURNVALUE_YOUCANNOTUSEOBJECTSTHATFAST)
        return false
    end
    player:setStorageValue(1234, os.time() + 1)
    player:addMana((player:getMaxMana()/100) * 20)
    player:addHealth((player:getMaxHealth()/100) * 15)
    player:getPosition():sendMagicEffect(CONST_ME_MAGIC_BLUE)
    player:say("Uhhhh...", TALKTYPE_MONSTER_SAY)
    return true
end
there is not exhaustion.set in 1.3?
 
there is not exhaustion.set in 1.3?
nope because you can do exactly the same by using getStorage/setStorage

Lua:
    if player:getStorageValue(1234) >= os.time() then
        player:sendCancelMessage(RETURNVALUE_YOUCANNOTUSEOBJECTSTHATFAST)
        return false
    end
    player:setStorageValue(1234, os.time() + 1)

but there are alternatives:
 
Back
Top