its way different of what i want , unless it may be edited in my needs, but im not programmer at all so its unknown maze for meWhen you click on the item, it is removed and heals an amount of MP/HP every time interval, correct?
Found it here, it should work for you. It's a revscript made by Xikini.
potion of the gods
PI need it to work as follows: When using the potion, the character receives charges of 20% of mana and total life, every 5 seconds for 1 minute When using the potion it must be removed and 50 souls will be needed to use the potion, which will also be removed when used The potion cannot be used...otland.net
i learned to read abit a script and edit abit in this time + i had many years brakes from tibia working, but honestly all who knows me , knows i hate programing, i dont like it... codes is worst part for me in working in my projects... sicne its the sizif stone for me...View attachment 78002
joined nov22, 2008.
We have to try to learn some things a little, right? Or at least try. Come on, don't be discouraged, you can learn something, or at least have tried.
But you can take this script and adapt it according to your needs. Yes, it can adapt. Try to learn more, it will work. Good luck!its way different of what i want , unless it may be edited in my needs, but im not programmer at all so its unknown maze for me
local config = {
position = Position(100, 100, 7), -- floor pos where player need to stand
healthRegen = 10, -- life gain/interval
manaRegen = 10, -- mana gain/interval
soulRegen = 1, -- soul gain/interval
interval = 2 -- interval in seconds
}
local function regeneratePlayer(cid)
local player = Player(cid)
if not player then
return
end
if player:getPosition() == config.position then
player:addHealth(config.healthRegen)
player:addMana(config.manaRegen)
player:addSoul(config.soulRegen)
player:getPosition():sendMagicEffect(CONST_ME_MAGIC_BLUE)
addEvent(regeneratePlayer, config.interval * 1000, player:getId())
end
end
local moveevent = MoveEvent()
function moveevent.onStepIn(creature, item, position, fromPosition)
if creature:isPlayer() then
addEvent(regeneratePlayer, config.interval * 1000, creature:getId())
end
return true
end
moveevent:position(config.position)
moveevent:register()
seems epic , thanks alot, but can you please remake it so if player stand on item id XXXX this effect is happpening, and if item dissapear not anymore under player heals stops ofc.@Lbtg
try this code, change config to match what you want
Lua:local config = { position = Position(100, 100, 7), -- floor pos where player need to stand healthRegen = 10, -- life gain/interval manaRegen = 10, -- mana gain/interval soulRegen = 1, -- soul gain/interval interval = 2 -- interval in seconds } local function regeneratePlayer(player) if player and player:getPosition() == config.position then player:addHealth(config.healthRegen) player:addMana(config.manaRegen) player:addSoul(config.soulRegen) player:getPosition():sendMagicEffect(CONST_ME_MAGIC_BLUE) addEvent(regeneratePlayer, config.interval * 1000, player) end end local moveevent = MoveEvent() function moveevent.onStepIn(creature, item, position, fromPosition) if creature:isPlayer() then addEvent(regeneratePlayer, config.interval * 1000, creature) end return true end moveevent:position(config.position) moveevent:register()
so, its an item?seems epic , thanks alot, but can you please remake it so if player stand on item id XXXX this effect is happpening, and if item dissapear not anymore under player heals stops ofc.
now it looks like you set up an x/y/z location that on this location this boost happens
local config = {
itemId = 1234, -- ID of the item that activates the regeneration
healthRegen = 10, -- life gain/interval
manaRegen = 10, -- mana gain/interval
soulRegen = 1, -- soul gain/interval
interval = 2 -- interval in seconds
}
local function regeneratePlayer(cid)
local player = Player(cid)
if not player then
return
end
if Tile(player:getPosition()):getItemById(config.itemId) then
player:addHealth(config.healthRegen)
player:addMana(config.manaRegen)
player:addSoul(config.soulRegen)
player:getPosition():sendMagicEffect(CONST_ME_MAGIC_BLUE)
addEvent(regeneratePlayer, config.interval * 1000, player:getId())
end
end
local moveevent = MoveEvent()
function moveevent.onStepIn(creature, item, position, fromPosition)
if creature:isPlayer() and item:getId() == config.itemId then
addEvent(regeneratePlayer, config.interval * 1000, creature:getId())
end
return true
end
moveevent:id(config.itemId)
moveevent:register()
yeah,so, its an item?
Lua:local config = { itemId = 1234, -- ID of the item that activates the regeneration healthRegen = 10, -- life gain/interval manaRegen = 10, -- mana gain/interval soulRegen = 1, -- soul gain/interval interval = 2 -- interval in seconds } local function regeneratePlayer(player) if player and Tile(player:getPosition()):getItemById(config.itemId) then player:addHealth(config.healthRegen) player:addMana(config.manaRegen) player:addSoul(config.soulRegen) player:getPosition():sendMagicEffect(CONST_ME_MAGIC_BLUE) addEvent(regeneratePlayer, config.interval * 1000, player) end end local moveevent = MoveEvent() function moveevent.onStepIn(creature, item, position, fromPosition) if creature:isPlayer() and item:getId() == config.itemId then addEvent(regeneratePlayer, config.interval * 1000, creature) end return true end moveevent:id(config.itemId) moveevent:register()
so, its an item?
Lua:local config = { itemId = 1234, -- ID of the item that activates the regeneration healthRegen = 10, -- life gain/interval manaRegen = 10, -- mana gain/interval soulRegen = 1, -- soul gain/interval interval = 2 -- interval in seconds } local function regeneratePlayer(player) if player and Tile(player:getPosition()):getItemById(config.itemId) then player:addHealth(config.healthRegen) player:addMana(config.manaRegen) player:addSoul(config.soulRegen) player:getPosition():sendMagicEffect(CONST_ME_MAGIC_BLUE) addEvent(regeneratePlayer, config.interval * 1000, player) end end local moveevent = MoveEvent() function moveevent.onStepIn(creature, item, position, fromPosition) if creature:isPlayer() and item:getId() == config.itemId then addEvent(regeneratePlayer, config.interval * 1000, creature) end return true end moveevent:id(config.itemId) moveevent:register()
I've never tested an addEvent script with that time, you can try using 0.5 instead of 1, but I don't know if its safe or not.yeah,
i want to make a rune simmilar to magic wall rune, so like player shot on ground and make item xxx and that item xx does this healings.
btw interval can be set to 0.1 or 0.5 etc ?
aha oky, so it doesnt work, i stand on xxx id and nothing happens, tho i cannot seee now if there is any errors(console got spammed by another bug with trying to fix..)I've never tested an addEvent script with that time, you can try using 0.5 instead of 1, but I don't know if its safe or not.
about rune, just copy your magicwall rune script and change the id
oh, you don't have the item with decay? yes, you can use items.xml to make it decay
you mean with half time? or script doesnt work with 1 second or more?aha oky, so it doesnt work, i stand on xxx id and nothing happens, tho i cannot seee now if there is any errors(console got spammed by another bug with trying to fix..)
creature
to addEvent
config.lua
like:warnUnsafeScripts = false
convertUnsafeScripts = false
local function doSomething(cid)
local player = Player(cid)
if not player then
return
end
player:addHealth(100)
end
local cid = player:getId()
addEvent(doSomething, 5000, cid)
made the necessary changes, thanks.You shouldn't pass disposable objects (userdata) likecreature
toaddEvent
Try execute this script and immediately logout/klick that player to make event execute once player is no longer there.
withconfig.lua
like:
Lua:warnUnsafeScripts = false convertUnsafeScripts = false
Results might surprise you
do it like that instead:
Lua:local function doSomething(cid) local player = Player(cid) if not player then return end player:addHealth(100) end local cid = player:getId() addEvent(doSomething, 5000, cid)