removedfrom map, /rRemoved where and how?
removedfrom map, /rRemoved where and how?
<globalevent name="CursedChestSpawner" interval="43200000‬" script="cursed_chest_spawner.lua"/>
CURSED_CHESTS_AID = 4283
CURSED_CHESTS_SPAWNS = {
[1] = {
pos = Position(980, 1080, 7),
size = 10,
chests = {1}
},
[2] = {
pos = Position(1060, 1085, 7),
size = 10,
chests = {1}
},
[3] = {
pos = Position(1090, 1050, 7),
size = 10,
chests = {1}
}
}
function _onThink(cid, interval, lastExecution)
for spawnId, data in ipairs(CURSED_CHESTS_SPAWNS) do
if not data.spawned then
local from = Position(data.pos.x - data.size, data.pos.y - data.size, data.pos.z)
local to = Position(data.pos.x + data.size, data.pos.y + data.size, data.pos.z)
local chestId = math.random(1, #data.chests)
local spawnPos = Position(math.random(from.x, to.x), math.random(from.y, to.y), data.pos.z)
local tile = Tile(spawnPos)
local spawnTest = 0
while spawnTest < 100 do
if isBadTile(tile) then
spawnPos = Position(math.random(from.x, to.x), math.random(from.y, to.y), data.pos.z)
tile = Tile(spawnPos)
spawnTest = spawnTest + 1
else
break
end
end
if spawnTest < 100 then
local rarity = nil
for i = #CURSED_CHESTS_TIERS, 1, -1 do
rarity = CURSED_CHESTS_TIERS[i]
if math.random(1, 100) <= rarity.chance then
break
end
end
if rarity ~= nil then
local chest = Game.createItem(rarity.item, 1, spawnPos)
chest:setActionId(CURSED_CHESTS_AID)
spawnPos:sendMagicEffect(CONST_ME_GROUNDSHAKER)
local chestData = {}
chestData.pos = spawnPos
chestData.spawnId = spawnId
chestData.wave = 0
chestData.monsters = {}
chestData.active = 0
chestData.finished = false
chestData.container = chest
chestData.chest = CURSED_CHESTS_CONFIG[chestId]
chestData.rarity = rarity
CURSED_CHESTS_DATA[#CURSED_CHESTS_DATA + 1] = chestData
data.spawned = true
end
end
end
end
return true
end
function onThink(cid, interval, lastExecution)
addEvent(_onThink, 43200000)
return true
end
update your tfs, it has to be in your source:bump
Not really, at least not now, I'm too busy, sorry.Can you help me do it?
It's your sprite that's not positioned properly, not the text.How do I change the position of the message: "Epic Cursed Chest?"
I changed the sprite from the chest and it is no longer centralized.
View attachment 43939
Huh? Just check examples inWhat if ill add more waves and last one will be with boss monsters? but how to make that last wave will spawn just one monster, or how to make different monsters for each box, thats issue i cant manage to fix
data\actions\scripts\custom\cursed_chest.lua
. Last wave is boss, only 1.Well, you can't do that.i think he means how do you change the monsters that spawn with each rarity, so for example rare boxes have X monsters, epic have X, each with different bosses.