Postado Setembro 6, 2018 6 anos Diga em poucas palavras a base utilizada (Nome do servidor ou nome do website). TFS 0.4 Base: Fir3Element Qual erro está surgindo/O que você procura? Procuro alguém que me ajude a completar o script. Utilizo ele, mas tive uma ideia melhor e queria alguém pra me ajudar pois to meio enferrujado nos script kkkk ele funciona assim, é um movement onde cada vez que o player pisa, cria um monstro para ele matar. ali tem configurado o tempo que ele pode usar novamente, mas pensei em algo do tipo, ele fica em cima do piso e a cada x segundos vai criando os bixos sem a necessidade de sair e pisar novamente. alguém consegue ajudar? Você tem o código disponível? Se tiver publique-o aqui: Spoiler function onStepIn(cid, item, position, fromPosition) local maxSummons = 1 -- máximo de summons permitidos por player local timeForReuse = 1 -- segundos para usar novamente local dirPref = {EAST, WEST} local monsters = { -- tabela com monstros, e a quantidade que vai sumonar ["Demon Vip"] = 1, } if delay[0] and delay[0] - os.time() > 0 then doTeleportThing(cid, fromPosition) return doPlayerSendCancel(cid, "Espere "..(delay[0] - os.time()).." segundos para puxar a alavanca novamente.") end local monsterCount = 0 local guid = getPlayerGUID(cid) if delay[guid] then for _, mid in pairs(delay[guid]) do if isCreature(mid) then monsterCount = monsterCount + 1 else delay[guid][_] = nil end end else delay[guid] = {} end if monsterCount >= maxSummons then doTeleportThing(cid, fromPosition) return doPlayerSendCancel(cid, "Há muitos monstros sumonados por você, mate-os primeiro!") end delay[0] = os.time() + timeForReuse monsterCount = 0 local dir = 1 for monsterName, number in pairs(monsters) do for _ = 1, number do local range = 1 local pos = getPosByDir(getThingPos(cid), dirPref[dir], range) local loops = 0 while doTileQueryAdd(cid, pos, 0, false) ~= 1 and loops <= #dirPref * 2 do dir = (dir + 1) > #dirPref and 1 or dir + 1 if dir == 1 then range = range + 1 end pos = getPosByDir(getThingPos(cid), dirPref[dir], range) loops = loops + 1 end if doTileQueryAdd(cid, pos, 0, false) ~= 1 then pos = getClosestFreeTile(cid, getThingPos(cid), true) end local newMonster = doCreateMonster(monsterName, pos, false) if isCreature(newMonster) then monsterCount = monsterCount + 1 table.insert(delay[guid], newMonster) doSendMagicEffect(getThingPos(newMonster), CONST_ME_TELEPORT) if monsterCount >= maxSummons then return true end end end end return true end Você tem alguma imagem que possa auxiliar no problema? Se sim, coloque-a aqui. não mas seria mais ou menos, 1 piso e os outros 8 quadrados em volta criaria os bixos enquanto ele estivesse em cima. Scriptszinhos: Spoiler [CREATURESCRIPT] Auto TP depois de matar boss [ACTION] Clean Area [TALKACTION] !FelizAnoNovo [ACTION + MOVEMENT] Cartas ao GOD [CREATURESCRIPT] Always Emblem System [ACTION] Anihi simples [TALKACTIONS] Urinar / fazer xixi Não abandone seu tópico, quando você tiver a dúvida resolvida sozinho tente ensinar aos outros como resolve-la (você pode não ser o único com o problema) e quando ela for resolvida por outra pessoa não se esqueça de marcar como melhor resposta e deixar o gostei.
Postado Setembro 7, 2018 6 anos Solução Vê se assim te serve, não tive como testá-lo: Spoiler 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 Contato: Email: [email protected] Discord: Dwarfer#2715
Postado Setembro 10, 2018 6 anos Autor @Dwarfer Foi mal a demora, mas funcionou sim! Obrigado! Ficou show de bola!!! Scriptszinhos: Spoiler [CREATURESCRIPT] Auto TP depois de matar boss [ACTION] Clean Area [TALKACTION] !FelizAnoNovo [ACTION + MOVEMENT] Cartas ao GOD [CREATURESCRIPT] Always Emblem System [ACTION] Anihi simples [TALKACTIONS] Urinar / fazer xixi Não abandone seu tópico, quando você tiver a dúvida resolvida sozinho tente ensinar aos outros como resolve-la (você pode não ser o único com o problema) e quando ela for resolvida por outra pessoa não se esqueça de marcar como melhor resposta e deixar o gostei.
Participe da conversa
Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.