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

Send damage upon players from item

Nemphis

Veteran OT User
Joined
Jun 22, 2009
Messages
699
Reaction score
441
Location
Sweden
10.77
TFS 1.2

So i have made this chest that goes away from existence after an X amount of time after first use.
(WORKS)

After that it starts an addEvent(WORKS) that will remove the chest(WORKS) and cast a spell upon its foes.(DOES NOT WORK!)

So far no good. This is what I've come to and it doesnt work at all..

Code:
local closeEpicId = 18473
local openEpicId = 24376

local area = createCombatArea({
   {1, 1, 1},
   {1, 3, 1},
   {1, 1, 1}
})

local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_FIREDAMAGE)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_FIREAREA)
combat:setFormula(COMBAT_FORMULA_SKILL, 0, 0, 1, 0)
combat:setArea(area)

local function boom(player, toPos)
   local item = Tile(toPos):getItemById(openEpicId)
   if item then
     toPos:sendMagicEffect(CONST_ME_FIREAREA)
     item:remove()
     combat:execute(player, item)
   end
end

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
   --local itemPos = item:getPosition()
   if item:getId() == closeEpicId then
     item:transform(openEpicId)
     
     player:say("Detonation set to 5 seconds.", TALKTYPE_MONSTER_SAY, false, false, toPosition)
     addEvent(boom, 5000, player:getId(), toPosition)
   end
   return true
end


Apprieciate all the help i can get
 
I am not familiar with latest TFS's but I am almost sure it is

Code:
combat:execute(player, Variant(toPos))

also you should check if player still exist in the event
 
It works splendid. Thank you kind sir. I'll give a couple of tries to add the damage aswell, if i cant get it to work i'll post here again.
thanks, Jano!!
 
Back
Top