Ir para conteúdo

Linus

Membro
  • Registro em

  • Última visita

Tudo que Linus postou

  1. Linus postou uma resposta no tópico em Scripts tfs 0.4 (OLD)
    Descrição : Você precisa de 2 pessoas para este mini-game. Você se posiciona sobre os azulejos e puxa a alavanca. Dentro da arena cada jogador irá receber um montro invocado, que irá, em seguida, atacar o inimigo e o monstro. O jogador mata o outro monstro ganha e será recompensada. Map: Mediafire: http://www.mediafire.com/download/qnnqj1rmilmrd5a/monsterarena.otbm actions.xml <action actionid="1500" script="monsterarena.lua"/> actions/scripts/monsterarena.lua MonsterArena = { fromPosition = { Position(1022, 1030, 7), Position(1024, 1030, 7) }, toPosition = { Position(1020, 1021, 7), Position(1022, 1021, 7) }, spawnPosition = { Position(1020, 1022, 7), Position(1022, 1020, 7) }, area = { from = Position(1015, 1016, 7), to = Position(1027, 1026, 7) }, exitPosition = Position(1022, 1028, 7), reward = {itemId = 2160, count = 10}, blockItemId = 3402, -- Only convincable / summonable monsters -- You can create custom monsters which are stronger and convincable monsters = {'Troll', 'Rat', 'Tortoise', 'Orc Berserker', 'Minotaur'}, event = 'MonsterArenaDeath', players = {} } function MonsterArena.hasPlayer(player) local position = player:getPosition() return position.x >= MonsterArena.area.from.x and position.y >= MonsterArena.area.from.y and position.x <= MonsterArena.area.to.x and position.y <= MonsterArena.area.to.y and position.z == MonsterArena.area.from.z end function MonsterArena.isOccupied() for _, pid in ipairs(MonsterArena.players) do local player = Player(pid) if player and MonsterArena.hasPlayer(player) then return true end end return false end function MonsterArena.clean() for i = 1, #MonsterArena.players do MonsterArena.players[i] = nil end end function onUse(player, item, fromPosition, target, toPosition, isHotkey) if item.itemid ~= 1945 then item:transform(1946) return true end if MonsterArena.isOccupied() then player:sendCancelMessage('The monster arena is currently occupied.') return true end local players = {} for _, fromPosition in ipairs(MonsterArena.fromPosition) do local creature = Tile(fromPosition):getTopCreature() if not creature or not creature:isPlayer() then player:sendCancelMessage('You need another player for the monster arena.') return true end table.insert(players, creature) end MonsterArena.clean() local summons = {} for i, player in ipairs(players) do player:teleportTo(MonsterArena.toPosition[i]) MonsterArena.fromPosition[i]:sendMagicEffect(CONST_ME_POFF) MonsterArena.toPosition[i]:sendMagicEffect(CONST_ME_TELEPORT) local monsterName = MonsterArena.monsters[math.random(#MonsterArena.monsters)] local monster = Game.createMonster(monsterName, MonsterArena.spawnPosition[i], true) monster:setMaster(player) monster:registerEvent(MonsterArena.event) table.insert(summons, monster) Game.createItem(MonsterArena.blockItemId, 1, MonsterArena.spawnPosition[i]) player:sendTextMessage(MESSAGE_INFO_DESCR, string.format('A %s is fighting for you this round!', monsterName)) table.insert(MonsterArena.players, player.uid) end players[1]:setTarget(summons[2]) players[2]:setTarget(summons[1]) item:transform(1945) return true end creaturescripts.xml <event type="death" name="MonsterArenaDeath" script="monsterarenadeath.lua"/> creaturescripts/scripts/monsterarenadeath.lua function onDeath(monster, corpse, killer, mostDamageKiller, unjustified, mostDamageUnjustified) local winnerPlayer = killer:getMaster() local loserPlayer = monster:getMaster() local reward = MonsterArena.reward if reward then winnerPlayer:sendTextMessage(MESSAGE_INFO_DESCR, 'Your monster won the fight and earned a reward for you!') winnerPlayer:addItem(reward.itemId, reward.count) else winnerPlayer:sendTextMessage(MESSAGE_INFO_DESCR, 'Your monster won the fight!') end loserPlayer:sendTextMessage(MESSAGE_INFO_DESCR, 'Your monster lost the fight!') winnerPlayer:teleportTo(MonsterArena.exitPosition) loserPlayer:teleportTo(MonsterArena.exitPosition) MonsterArena.exitPosition:sendMagicEffect(CONST_ME_MAGIC_BLUE) for _, position in ipairs(MonsterArena.spawnPosition) do local item = Tile(position):getItemById(MonsterArena.blockItemId) if item then item:remove() end end killer:remove() return true end Créditos : Summ
  2. Pronto : local cfg = { kina= {2421, idsword}, pala = 2421, sorc = 2421, drui = 2421, } function onUse(cid, item) if getPlayerStorageValue(cid, 38493) ~= 1 then if getPlayerVocation(cid) == 4 or getPlayerVocation(cid) == 8 then doPlayerAddItem(cid, cfg.kina[1], 1) doPlayerAddItem(cid, cfg.kina[2], 1) doPlayerSendTextMessage(cid, 25, "Congratulations!!") doPlayerSetStorageValue(cid, 38493, 1) elseif getPlayerVocation(cid) == 1 or getPlayerVocation(cid) == 5 then doPlayerAddItem(cid, cfg.sorc, 1) doPlayerSendTextMessage(cid, 25, "Congratulations!!") doPlayerSetStorageValue(cid, 38493, 1) elseif getPlayerVocation(cid) == 2 or getPlayerVocation(cid) == 6 then doPlayerAddItem(cid, cfg.drui, 1) doPlayerSendTextMessage(cid, 25, "Congratulations!!") doPlayerSetStorageValue(cid, 38493, 1) elseif getPlayerVocation(cid) == 3 or getPlayerVocation(cid) == 7 then doPlayerAddItem(cid, cfg.pala, 1) doPlayerSendTextMessage(cid, 25, "Congratulations!!") doPlayerSetStorageValue(cid, 38493, 1) end else doPlayerSendCancel(cid, "It's empty.") end return true end
  3. Pronto editei tente agora, lembrando que é necessário 2 items em cada voc ... e não vai entregar mais que 2, se for usar mais de 2 avisa que eu edito.
  4. local coin = 1967 local lever = { [6004] = {1,12698}, [6005] = {1,12713}, [6006] = {1,12723}, [6007] = {1,12751}, } function onUse(cid,item,fromPosition,itemEx,toPosition) if getPlayerStorageValue(cid, 78944) == 1 then doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "Só é possivel utilizar uma vez...") return true end if doPlayerRemoveItem(cid,coin,lever[item.actionid][1]) == FALSE then return doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "você precisa de "..lever[item.actionid][1].." " ..getItemNameById(coin)) end doPlayerAddItem(cid,lever[item.actionid][2]) doPlayerSendTextMessage(cid,22,"você pegou o " .. getItemNameById(lever[item.actionid][2])) doSendMagicEffect(getCreaturePosition(cid), math.random(14,14)) setPlayerStorageValue(cid, 78944, 1) return true end
  5. Tenta ai, dei uma simplificada no script. local tb = { [3088] = {9776, 1, "You've found a yalahari armor."}, [3089] = {9778, 1, "You've found a yalahari mask."}, [3090] = {9777, 1, "You've found a yalahari leg piece."} } function onUse(cid, item) local player = Player(cid) if player:getStorageValue(10012) == 1 then doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "The chest is empty.") return true end for bau, v in pairs(tb) do if item.uid == bau then if player:getStorageValue(30) == 53 then player:AddItem(v[1], v[2]) player:setStorageValue(30, 54) player:setStorageValue(12021, 5) -- StorageValue for Questlog "Mission 10: The Final Battle" player:sendTextMessage(MESSAGE_INFO_DESCR, v[3]) break end end end player:addExperience(20000) player:setStorageValue(10012, 1) return true end
  6. /\ Onde tem "itemid" basta coloca o id do item que tu quer que tal voc receba, se quiser adicionar mais, só colocar "," e adicionar outro ID. local vocQ = { ["1-5"] = {item = {2421, itemid}}, ["2-6"] = {item = {2421, itemid}}, ["3-7"] = {item = {2421, itemid}}, ["4-8"] = {item = {2421, itemid}}, } function onUse(cid, item, toPosition, itemEx, fromPosition) if getPlayerStorageValue(cid, 38493) ~= 1 then for voc, items in pairs(vocQ) do local v = string.explode(voc, "-") if getPlayerVocation(cid) == tonumber(v[1]) or getPlayerVocation(cid) == tonumber(v[2]) then doPlayerAddItem(cid, items.item[1], 1) doPlayerAddItem(cid, items.item[2], 1) doPlayerSendTextMessage(cid, 25, "Congratulations!!") doPlayerSetStorageValue(cid, 38493, 1) break end end else doPlayerSendCancel(cid, "It's empty.") end return true end
  7. Troquei a storage tenta agora.
  8. local questChestStorage = 74654 local vocQ = { ["1-5"] = {item = {{2421, 1}, {itemid, count}}}, ["2-6"] = {item = {{2421, 1}, {itemid, count}}}, ["3-7"] = {item = {{2421, 1}, {itemid, count}}}, ["4-8"] = {item = {{2421, 1}, {itemid, count}}}, } function onUse(cid, item, toPosition, itemEx, fromPosition) if getPlayerStorageValue(cid, questChestStorage) == 1 then doPlayerSendCancel(cid, "It's empty.") return true end for i, v in pairs(vocQ) do local voc = string.explode(i, "-") if getPlayerVocation(cid) == voc[1] or getPlayerVocation(cid) == voc[2] then for x = 1, #v.item do doPlayerAddItem(cid, v.item[x][1], v.item[x][2]) end setPlayerStorageValue(cid, questChestStorage, 1) doPlayerSendTextMessage(cid, 25, "Congratulations!!") break end end return true end <action actionid="5500" event="script" value="questvocation.lua"/> Comecei a programar em lua a pouco tempo, se tiver algo errado podem me corrigir.
  9. Quando sobrar um tempo eu faço sim.
  10. Linus postou uma resposta no tópico em Ouvidoria
    Não mostra nos tópicos recentes os tópicos que eu crio lá na aprovação de conteúdo, e mesmo dps de aprovado ainda fica sem mostrar ... dat bug
  11. Linus postou uma resposta no tópico em Scripts tfs 0.4 (OLD)
    Ah duas versões do script, em globalevent ou talkaction use a que preferir. -- GLOBALEVENT -- globalevents.xml : <globalevent type="startup" name="RainItems" script="rainitems.lua"/> rainitems.lua local config = { items = {{8306,1}, {2157,2}, {7735,1}, {8306,1}, {2184,1}, {9932,1}, {8306,1}, {9693,1}, {2148, 100}}, interval = 1000, -- time between checks areas = { [1] = { startHour = 19, startMin = 15, waves = 10, interval = 10000, chancePerTile = 10, -- % maxItemsPerWave = 15, from = {x = 1021, y = 994, z = 7}, to = {x = 1024, y = 998, z = 7} }, [2] = { startHour = 18, startMin = 43, waves = 10, interval = 10000, chancePerTile = 10, maxItemsPerWave = 15, from = {x = 1026, y = 995, z = 7}, to = {x = 1028, y = 1001, z = 7} } } } local executed = {} function Position.isPathable(pos) local tile = Tile(pos) if tile == nil then return false end return not tile:hasFlag(TILESTATE_BLOCKSOLID) end function rainWave(arena) local from = config.areas[arena].from local to = config.areas[arena].to local items_spawned = 0 for x = from.x, to.x do for y = from.y, to.y do for z = from.z, to.z do if math.random(1, 100) < config.areas[arena].chancePerTile and items_spawned < config.areas[arena].maxItemsPerWave then local pos = {x = x, y = y, z = z} if Position(pos):isPathable() then local item = math.random(1, #config.items) doCreateItem(config.items[item][1], math.random(1, config.items[item][2]), pos) Position(pos):sendMagicEffect(CONST_ME_MAGIC_RED) items_spawned = items_spawned + 1 end end end end end end function startRain(arena) broadcastMessage("Rain item event begins!") for i = 1, config.areas[arena].waves do if i == 1 then rainWave(arena) else addEvent(rainWave, config.areas[arena].interval * (i - 1), arena) end end addEvent(broadcastMessage, config.areas[arena].interval * (config.areas[arena].waves - 1), "Rain items event ended.") end function checkRain() local hour = tonumber(os.date("%H")) local min = tonumber(os.date("%M")) if not executed[hour] then executed[hour] = {} end for i = 1, #config.areas do if hour == config.areas[i].startHour and min == config.areas[i].startMin then if not executed[hour][min] then startRain(i) addEvent(checkRain, config.interval) executed[hour][min] = true end end if tonumber(os.date("%H", os.time() + (30 * 60))) == config.areas[i].startHour and tonumber(os.date("%M", os.time() + (30 * 60))) == config.areas[i].startMin then if not executed[hour][min] then broadcastMessage("Rain items event will start in 30 minutes.") addEvent(checkRain, config.interval) executed[hour][min] = true end end if tonumber(os.date("%H", os.time() + (1 * 60))) == config.areas[i].startHour and tonumber(os.date("%M", os.time() + (1 * 60))) == config.areas[i].startMin then if not executed[hour][min] then broadcastMessage("Rain items event will start in 1 minute.") addEvent(checkRain, config.interval) executed[hour][min] = true end end end addEvent(checkRain, config.interval) end function onStartup() addEvent(checkRain, 100) end -- TALKACTION -- talkactions.xml <talkaction words="/rainitems" separator=" " script="rainitems_command.lua"/> rainitems_command.lua local config = { items = {{8306,1}, {2157,2}, {7735,1}, {8306,1}, {2184,1}, {9932,1}, {8306,1}, {9693,1}, {2148, 100}}, interval = 1000, -- time between checks areas = { [1] = { waves = 10, interval = 10000, chancePerTile = 10, -- % maxItemsPerWave = 15, from = {x = 1021, y = 994, z = 7}, to = {x = 1024, y = 998, z = 7} }, [2] = { waves = 10, interval = 10000, chancePerTile = 10, maxItemsPerWave = 15, from = {x = 1026, y = 995, z = 7}, to = {x = 1028, y = 1001, z = 7} } } } function Position.isPathable(pos) local tile = Tile(pos) if tile == nil then return false end return not tile:hasFlag(TILESTATE_BLOCKSOLID) end function rainWave(arena) local from = config.areas[arena].from local to = config.areas[arena].to local items_spawned = 0 for x = from.x, to.x do for y = from.y, to.y do for z = from.z, to.z do if math.random(1, 100) < config.areas[arena].chancePerTile and items_spawned < config.areas[arena].maxItemsPerWave then local pos = {x = x, y = y, z = z} if Position(pos):isPathable() then local item = math.random(1, #config.items) doCreateItem(config.items[item][1], math.random(1, config.items[item][2]), pos) Position(pos):sendMagicEffect(CONST_ME_MAGIC_RED) items_spawned = items_spawned + 1 end end end end end end function startRain(arena) broadcastMessage("Rain item event begins!") for i = 1, config.areas[arena].waves do if i == 1 then rainWave(arena) else addEvent(rainWave, config.areas[arena].interval * (i - 1), arena) end end addEvent(broadcastMessage, config.areas[arena].interval * (config.areas[arena].waves - 1), "Rain items event ended.") end function onSay(player, words, param) if not player:getGroup():getAccess() then return false end if tonumber(param) then startRain(tonumber(param)) else player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, words .. " eventid") end return false end Créditos zbisu.
  12. Linus postou uma resposta no tópico em Playground (Off-topic)
    Obrigado a todos, espero aprender e ajudar aqui no fórum. Na verdade Linus é o nome de um programador que eu curto bastante.
  13. Pronto... se ainda não tiver dentro dos padrões, pode mover pra lixeira
  14. Colocar em spoiler buga a identação ... e não quero dar tudo na mão dos cara, pra eles ao menos ter o bom-senso de procurar aprender ou até mesmo de perguntar caso haja alguma dúvida e se isso acontecer eu estarei ensinando.
  15. Tag spells.XML(configure a gosto, use o mesmo para todos os scripts acima) : <instant name="NAME" words="NAME" lvl="1" mana="1" prem="0" aggressive="1" selftarget="0" exhaustion="1" group="attack" groupcooldown="1" needlearn="0" script="ARQUIVO.lua"> <vocation name="VOCATION NAME"/> </instant> Para adicionar a spell, só ir em data/spells/scripts criar um arquivo .lua para o script e adicionálo e dps ir em spells.XML colocando a tag, configurada de acordo com a spell em questão. Créditos Printer.
  16. Linus postou uma resposta no tópico em Playground (Off-topic)
    Olá meu nome é Gabriel, comecei a pouco tempo cursar ciências da computação e com indicações de um amigo vim parar aqui, se possível espero que me ajudem a aprender lua e as demais linguagens que vocês usam pra criação de otserv. um grande abraço e nos vemos por aí.

Informação Importante

Confirmação de Termo