hello, someone convert this script to tfs 1.x
Lua:local t = { monsters = {"Demon Vip", "Rat Vip"}, -- caso tenha mais de um monstro, será aleatório monstersCount = 8, -- quantidade de monstros que serão sumonados intervalToSummon = {30, "sec"}, -- intervalo para os monstros serem sumonados novamente timeForReuse = {1, "min"}, -- tempo para sumonar novamente pisando no tile storage = 76760 -- só modifique se necessário } tileSummonEvent = {} local function isWalkableCheck(cid, pos) pos.stackpos = 0 if getTileThingByPos(pos).uid ~= 0 then local n = getTileInfo(pos) if n.protection == false and n.house == false and getTopCreature(pos).uid == 0 and doTileQueryAdd(cid, pos) == RETURNVALUE_NOERROR then return true end end end local function getMyMonsters(cid) local p, summons = getPlayerPosition(cid), 0 for x = -7, 7 do for y = -7, 7 do local pos = {x = p.x + x, y = p.y + y, z = p.z} local creature = getTopCreature(pos) if creature then if isMonster(creature.uid) then if getPlayerStorageValue(creature.uid, t.storage) == getPlayerGUID(cid) then summons = summons + 1 end end end end end return summons end local function doPlayerSummonOwnMonsters(cid, monster_count) local p, m, range = getPlayerPosition(cid), 0, (monster_count <= 8 and 1 or 2) for x = -range, range do for y = -range, range do local pos = {x = p.x + x, y = p.y + y, z = p.z} if isWalkableCheck(cid, pos) then if m < monster_count then local monster = doCreateMonster(t.monsters[math.random(1, #t.monsters)], pos, false, true) if isCreature(monster) then doSendMagicEffect(getCreaturePosition(monster), CONST_ME_TELEPORT) setPlayerStorageValue(monster, t.storage, getPlayerGUID(cid)) m = m + 1 end end end end end end local function doKeepPlayerSummoning(cid, tile_pos) if isPlayer(cid) then if doComparePositions(getPlayerPosition(cid), tile_pos) then local myMonsters = t.monstersCount - getMyMonsters(cid) if myMonsters > 0 then doPlayerSummonOwnMonsters(cid, myMonsters) doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Monstros sumonados!") setPlayerStorageValue(cid, t.storage, mathtime(t.timeForReuse) + os.time()) end tileSummonEvent[getPlayerGUID(cid)] = addEvent(doKeepPlayerSummoning, mathtime(t.intervalToSummon) * 1000, cid, tile_pos) end end end function onStepIn(cid, item, position, fromPosition) if not isPlayer(cid) then return true end local check = getPlayerStorageValue(cid, t.storage) - os.time() if check > 0 then return doPlayerSendCancel(cid, "Aguarde "..check.." segundo"..(check > 1 and "s" or "").." para sumonar os monstros novamente.") end if getMyMonsters(cid) >= t.monstersCount then return doPlayerSendCancel(cid, "Existem muitos monstros sumonados por você, derrote-os primeiro!") end local eventId = tileSummonEvent[getPlayerGUID(cid)] if eventId then stopEvent(eventId) eventId = nil end doPlayerSummonOwnMonsters(cid, t.monstersCount - getMyMonsters(cid)) doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Monstros sumonados!") setPlayerStorageValue(cid, t.storage, mathtime(t.timeForReuse) + os.time()) addEvent(doKeepPlayerSummoning, mathtime(t.intervalToSummon) * 1000, cid, position) return true end function mathtime(table) -- by dwarfer local unit = {"sec", "min", "hour", "day"} for i, v in pairs(unit) do if v == table[2] then return table[1]*(60^(v == unit[4] and 2 or i-1))*(v == unit[4] and 24 or 1) end end return error("Bad declaration in mathtime function.") end