adrenyslopez
Member
- Joined
- Dec 22, 2015
- Messages
- 201
- Reaction score
- 15
Someone help me with this scripts, when passing the monster through the vortex "38626" after passing it it is believed to be "17868"
me use otbr tfs 1.3
me use otbr tfs 1.3
Lua:
local config = {
["Weak Soul"] = {id = 38626, effect = CONST_ME_ICEATTACK, type = COMBAT_ICEDAMAGE},
["Soulsnatcher"] = {id = 38626, effect = CONST_ME_FIREAREA, type = COMBAT_FIREDAMAGE},
}
local area = createCombatArea(AREA_CIRCLE2X2)
local monsters = {"Soulsnatcher", "Weak Soul"}
local soulVortex = MoveEvent()
function soulVortex.onStepIn(creature, item, position, fromPosition)
if creature:isPlayer() or creature:getMaster() then
return true
end
local name = creature:getName()
if not isInArray(monsters, name) then
return true
end
local data = config[name]
position:sendMagicEffect(CONST_ME_MORTAREA)
local gred = Creature("Goshnar's Greed")
if not gred then
return true
end
if data.id == item:getId() then
local oldStorage = gred:getStorageValue(69813)
gred:setStorageValue(69813, oldStorage + 1)
-- remove -1 from storage after 20seconds:
addEvent(function(cid, storage)
local mob = Creature(cid)
if not mob then return end
mob:setStorageValue(69813, storage - 1)
end, 10 * 1000, gred:getId(), oldStorage + 1)
else
if math.random(2) == 2 then
doAreaCombatHealth(creature, data.type, creature:getPosition(), area, -750, -1250, data.effect)
else
doTargetCombatHealth(0, gred, COMBAT_HEALING, 3500, 5500, CONST_ME_NONE)
end
end
creature:remove()
return true
end
soulVortex:type("stepin")
local idsRegistered = {}
for index, value in pairs(config) do
if not table.contains(idsRegistered, value.id) then
soulVortex:id(value.id)
table.insert(idsRegistered, value.id)
end
end
soulVortex:register()