Ir para conteúdo

fabiobillz

Membro
  • Registro em

  • Última visita

Tudo que fabiobillz postou

  1. Boa tarde, o scrip funciona tudo certinho, porem, quando eu coloco mais npcs de cassino, criando mais npc.xml e mais npc.lua, o script buga
  2. Ta quase tudo funcionando certinho, só que quando o fogo esta atingindo o player ele nao sai do evento, alguem pode ajudar? -- firestorm Variables fsJoinedCountGlobalStorage = 18900 --Player joined event count / recuento de players. fsJoinStorage = 18901 --player join storage / storage del jugador a unirse. fsMinPlayers = 1 --min players needed when time runout / minimo de players necesarios para comenzar el evento. fsMaxPlayers = 5 --max players to join / maximo de players. fsTrophy = 7369 --trophy itemid / itemid del premio(que no sea stackable). fsEventCountGlobalStorage = 18902 --firestorm Count (no move/no moverle). fsWaitMinutes = 2 --when event has opened, how long until it starts? / cuantos minutos tarde el evento en empezar. fsWaitingRoomPos = Position(961, 1036, 7) --middle of waiting room / punto medio de el cuarto de espera. fsArena = Position(988, 1036, 7) --when even start where should player be teleported in the arena? / punto donde seran transportados los players. fsArenaFromPosition = Position(981, 1029, 7) --pos of top left corner / posicion de esquina superior izquierda. fsArenaToPosition = Position(995, 1043, 7) --pos of bottom right corner /posicion de esquina inferior derecha. fsMiddleEventArena = Position(988, 1036, 7) --Middle pos of the arena / punto medio de la arena fsWaitingRoomRadiusX = 11 --depends how big the waiting room is 20sqm to x / depende de lo grande la sala de espera en x fsWaitingRoomRadiusY = 11 --depends how big the waiting room is 20sqm to y / depende de lo grande la sala de espera en y fsEventArenaRadiusX = 15 --Depends how big the firestorm arena is 50sqm to x / depende de lo grande de la arena en x fsEventArenaRadiusY = 15 --Depends how big the firestorm arena is 50sqm to y / depende de lo grande de la arena en y fsStartedGlobalStorage = 18903 -- Value: 0 == false, 1 == true, 2 == started --State of the event fsCreateTeleportPosition = Position(32479, 32471, 6) --Where should the teleport be created? / posicion donde sera creado el teleport? function startfirestorm() local specs = Game.getSpectators(fsWaitingRoomPos, false, true, 0, fsWaitingRoomRadiusX, 0, fsWaitingRoomRadiusY) if Game.getStorageValue(fsJoinedCountGlobalStorage) <= fsMinPlayers then for i = 1, #specs do specs[i]:teleportTo(specs[i]:getTown():getTemplePosition(), false) specs[i]:setStorageValue(fsJoinStorage, 0) end resetfsVariables() Game.broadcastMessage('firestorm Event failed to start, because of to little players joined the event!', MESSAGE_STATUS_WARNING) return true end for i = 1, #specs do local rX, rY, rZ rX = math.random(fsArenaFromPosition.x, fsArenaToPosition.x) rY = math.random(fsArenaFromPosition.y, fsArenaToPosition.y) rZ = math.random(fsArenaFromPosition.z, fsArenaToPosition.z) specs[i]:teleportTo(Position(rX, rY, rZ)) end Game.broadcastMessage("firestorm Event has started, good luck to all participant.", MESSAGE_STATUS_WARNING) Game.setStorageValue(fsStartedGlobalStorage, 2) doStartfirestorm() end function doStartfirestorm() if Game.getStorageValue(fsJoinedCountGlobalStorage) > fsMaxPlayers then return false end if Game.getStorageValue(fsStartedGlobalStorage) == 2 then local specs = Game.getSpectators(fsArena, false, true, 0, 10, 0, 10) for i = 1, #specs do local randX, randY, randZ randX = math.random(fsArenaFromPosition.x, fsArenaToPosition.x) randY = math.random(fsArenaFromPosition.y, fsArenaToPosition.y) randZ = math.random(fsArenaFromPosition.z, fsArenaToPosition.z) local randfire = Position(randX, randY, randZ) local randX1, randY1, randZ1 randX1 = math.random(fsArenaFromPosition.x, fsArenaToPosition.x) randY1 = math.random(fsArenaFromPosition.y, fsArenaToPosition.y) randZ1 = math.random(fsArenaFromPosition.z, fsArenaToPosition.z) local randfire1 = Position(randX1, randY1, randZ1) local creature, players = nil, Game.getPlayers() for i = 1, #players do creature = players[i] doSendDistanceShoot(fsArenaFromPosition, randfire, 4) doSendDistanceShoot(fsArenaToPosition, randfire, 4) doSendDistanceShoot(Position(996, 1044, 7), randfire, 4) doSendDistanceShoot(Position(980, 1028, 7), randfire, 4) doAreaCombatHealth(creature.uid, COMBAT_HOLYDAMAGE, randfire,randfire, -9999, -1000000,7) end end addEvent(doStartfirestorm, 500) end end function resetfsVariables() Game.setStorageValue(fsEventCountGlobalStorage, 0) Game.setStorageValue(fsJoinedCountGlobalStorage, 0) Game.setStorageValue(fsStartedGlobalStorage, 0) end creature dofile('data/firestorm_event.lua') function onPrepareDeath(player, killer) local winner = 0 if player:getStorageValue(fsJoinStorage) >= 1 then Game.setStorageValue(fsJoinedCountGlobalStorage, Game.getStorageValue(fsJoinedCountGlobalStorage)-1) player:teleportTo(player:getTown():getTemplePosition()) player:setStorageValue(fsJoinStorage, 0) player:addHealth(player:getMaxHealth()) if Game.getStorageValue(fsJoinedCountGlobalStorage) <= 1 then --Event ended, someone won! local pla, play = nil, Game.getPlayers() for i = 1, #play do pla = play[i] if pla:getStorageValue(fsJoinStorage) == 1 then winner = pla:getId() break end end winner = Player(winner) if winner then winner:teleportTo(winner:getTown():getTemplePosition()) winner:addHealth(winner:getMaxHealth()) local trophy = winner:addItem(fsTrophy, 1) if trophy then trophy:setAttribute(ITEM_ATTRIBUTE_DESCRIPTION, '['.. winner:getName() ..'] has won the firestorm Event.') end Game.broadcastMessage(string.format('%s is the winner of firestorm Event', winner:getName()), MESSAGE_STATUS_WARNING) end resetfsVariables() end return false end return true end globalevents dofile('data/firestorm_event.lua') function onTime(interval, lastExecution, thinkInterval) resetfsVariables() if Game.getStorageValue(fsStartedGlobalStorage) < 1 then local teleport = doCreateItem(11796,1,fsCreateTeleportPosition) if teleport then doSetItemActionId(teleport, 5499) doSendMagicEffect(fsCreateTeleportPosition, CONST_ME_TELEPORT) end local r_tp = Tile(fsCreateTeleportPosition):getItemById(11796) addEvent(function() r_tp:remove() getTileItemById(fsCreateTeleportPosition, 11796) end, 60 * 1000) addEvent(function() doSendMagicEffect(fsCreateTeleportPosition, CONST_ME_TELEPORT) end, 60 * 1000) end Game.setStorageValue(fsStartedGlobalStorage,1) print('firestorm Event has started & waiting for players to join! Min: '.. fsMinPlayers ..'/'.. fsMaxPlayers ..'.') Game.broadcastMessage('The firestorm Event has started! You have '.. fsWaitMinutes ..' minutes to join!', MESSAGE_STATUS_WARNING) addEvent(startfirestorm, fsWaitMinutes * 60 * 1000) return true end movements dofile('data/firestorm_event.lua') function onStepIn(creature, item, position, fromPosition) local player = creature:getPlayer() if Game.getStorageValue(fsStartedGlobalStorage) == 2 then player:sendTextMessage(MESSAGE_INFO_DESCR, 'The Firestorm Event has already started.') player:teleportTo(fromPosition, true) return false end if Game.getStorageValue(fsStartedGlobalStorage) == 0 then player:sendTextMessage(MESSAGE_INFO_DESCR, 'The Firestorm Event has not started yet.') player:teleportTo(fromPosition, true) return false end if Game.getStorageValue(fsJoinedCountGlobalStorage) >= fsMaxPlayers then player:teleportTo(fromPosition, true) player:sendTextMessage(MESSAGE_INFO_DESCR, 'The Firestorm Event is already full! ['.. Game.getStorageValue(fsJoinedCountGlobalStorage) ..'/'.. fsMaxPlayers ..']') return false end player:teleportTo(fsWaitingRoomPos) Game.setStorageValue(fsJoinedCountGlobalStorage, Game.getStorageValue(fsJoinedCountGlobalStorage) + 1) Game.broadcastMessage(string.format('%s has joined the Firestorm Event! [%s/'.. fsMaxPlayers ..'].', player:getName(), Game.getStorageValue(fsJoinedCountGlobalStorage)), MESSAGE_STATUS_WARNING) player:setStorageValue(fsJoinStorage, 1) return true end eu só mexi no firestorm_event.lua que foi alterar as posiçoes do lugar do evento
  3. fabiobillz postou uma resposta no tópico em Tutoriais Websites
    --[[ TODO Unite all related variables / functions in a table rewrite functions like "getTasksByPlayer" to "Player.getTasks" ]] RANK_NONE = 0 RANK_JOIN = 1 RANK_HUNTSMAN = 2 RANK_RANGER = 3 RANK_BIGGAMEHUNTER = 4 RANK_TROPHYHUNTER = 5 RANK_ELITEHUNTER = 6 REWARD_MONEY = 1 REWARD_EXP = 2 REWARD_ACHIEVEMENT = 3 REWARD_STORAGE = 4 REWARD_POINT = 5 REWARD_ITEM = 6 QUESTSTORAGE_BASE = 1500 JOIN_STOR = 100157 KILLSSTORAGE_BASE = 65000 REPEATSTORAGE_BASE = 48950 POINTSSTORAGE = 2500 tasks = { [1] = {killsRequired = 100, raceName = "Trolls", level = {6, 19}, premium = true, creatures = {"troll", "troll champion", "island troll", "swamp troll"}, rewards = {{type = "exp", value = {200}},{type = "money", value = {200}}}}, [2] = {killsRequired = 150, raceName = "Goblins", level = {6, 19}, premium = true, creatures = {"goblin", "goblin assassin", "goblin leader"}, rewards = {{type = "exp", value = {300}},{type = "money", value = {250}}}}, [3] = {killsRequired = 300, raceName = "Crocodiles", level = {6, 49}, premium = true, creatures = {"crocodile"}, rewards = {{type = "exp", value = {800}},{type = "achievement", value = {"Blood-Red Snapper"}},{type = "storage", value = {35000, 1}},{type = "points", value = {1}}}}, [4] = {killsRequired = 300, raceName = "Badgers", level = {6, 49}, premium = true, creatures = {"badger"}, rewards = {{type = "exp", value = {500}},{type = "points", value = {1}}}}, [5] = {killsRequired = 300, raceName = "Tarantulas", level = {6, 49}, premium = true, creatures = {"tarantula"}, rewards = {{type = "exp", value = {1500}},{type = "achievement", value = {"No More Hiding"}},{type = "storage", value = {35001, 1}},{type = "points", value = {2}}}}, [6] = {killsRequired = 150, raceName = "Carniphilas", level = {6, 49}, premium = true, creatures = {"carniphila"}, rewards = {{type = "exp", value = {2500}},{type = "achievement", value = {"Rootless Behaviour"}},{type = "storage", value = {35002, 1}},{type = "points", value = {3}}}}, [7] = {killsRequired = 200, raceName = "Stone Golems", level = {6, 49}, premium = true, creatures = {"stone golem"}, rewards = {{type = "exp", value = {2000}},{type = "points", value = {3}}}}, [8] = {killsRequired = 300, raceName = "Mammoths", level = {6, 49}, premium = true, creatures = {"mammoth"}, rewards = {{type = "exp", value = {4000}},{type = "achievement", value = {"Meat Skewer"}},{type = "storage", value = {35003, 1}},{type = "points", value = {3}}}}, [9] = {killsRequired = 300, raceName = "Gnarlhounds", level = {6, 49}, premium = true, creatures = {"gnarlhound"}, rewards = {{type = "exp", value = {1000}},{type = "points", value = {2}}}}, [10] = {killsRequired = 300, raceName = "Terramites", level = {6, 49}, premium = true, creatures = {"terramite"}, rewards = {{type = "exp", value = {1000}},{type = "points", value = {2}}}}, [11] = {killsRequired = 300, raceName = "Apes", level = {6, 49}, premium = true, creatures = {"kongra", "sibang", "merklin"}, rewards = {{type = "exp", value = {1000}},{type = "points", value = {2}}}}, [12] = {killsRequired = 300, raceName = "Thornback Tortoises", level = {6, 49}, premium = true, creatures = {"thornback tortoise"}, rewards = {{type = "exp", value = {1500}},{type = "points", value = {2}}}}, [13] = {killsRequired = 300, raceName = "Gargoyles", level = {6, 49}, premium = true, creatures = {"gargoyle"}, rewards = {{type = "exp", value = {1500}}}}, [14] = {killsRequired = 300, raceName = "Ice Golems", level = {50, 79}, premium = true, creatures = {"ice golem"}, rewards = {{type = "exp", value = {12000}},{type = "achievement", value = {"Breaking The Ice"}},{type = "storage", value = {35004, 1}},{type = "points", value = {2}}}}, [15] = {killsRequired = 400, raceName = "Quara Scouts", level = {50, 79}, premium = true, creatures = {"quara pincher scout", "quara predator scout", "quara hydromancer scout", "quara constrictor scout", "quara mantassin scout"}, rewards = {{type = "exp", value = {10000}},{type = "points", value = {2}}}}, [16] = {killsRequired = 400, raceName = "Mutated Rats", level = {50, 79}, premium = true, creatures = {"mutated rat"}, rewards = {{type = "exp", value = {10000}},{type = "achievement", value = {"Twisted Mutation"}},{type = "storage", value = {35005, 1}},{type = "points", value = {2}}}}, [17] = {killsRequired = 250, raceName = "Ancient Scarabs", level = {50, 79}, premium = true, creatures = {"ancient scarab"}, rewards = {{type = "exp", value = {15000}},{type = "achievement", value = {"Crawling Death"}},{type = "storage", value = {35006, 1}},{type = "points", value = {2}}}}, [18] = {killsRequired = 300, raceName = "Wyverns", level = {50, 79}, premium = true, creatures = {"wyvern"}, rewards = {{type = "exp", value = {12000}},{type = "points", value = {2}}}}, [19] = {killsRequired = 300, raceName = "Lancer Beetles", level = {50, 79}, premium = true, creatures = {"lancer beetle"}, rewards = {{type = "exp", value = {8000}},{type = "points", value = {2}}}}, [20] = {killsRequired = 400, raceName = "Wailing Widows", level = {50, 79}, premium = true, creatures = {"wailing widow"}, rewards = {{type = "exp", value = {12000}},{type = "points", value = {3}}}}, [21] = {killsRequired = 250, raceName = "Killer Caimans", level = {50, 79}, premium = true, creatures = {"killer caiman"}, rewards = {{type = "exp", value = {10000}},{type = "points", value = {2}}}}, [22] = {killsRequired = 300, raceName = "Bonebeasts", level = {50, 79}, premium = true, creatures = {"bonebeast"}, rewards = {{type = "exp", value = {12000}},{type = "achievement", value = {"Spareribs for Dinner"}},{type = "storage", value = {35007, 1}},{type = "points", value = {2}}}}, [23] = {killsRequired = 300, raceName = "Crystal Spiders", level = {50, 79}, creatures = {"crystal spider"}, premium = true, rewards = {{type = "exp", value = {15000}},{type = "achievement", value = {"Arachnoise"}},{type = "storage", value = {35008, 1}},{type = "points", value = {3}}}}, [24] = {killsRequired = 300, raceName = "Mutated Tigers", level = {50, 79}, premium = true, creatures = {"mutated tiger"}, rewards = {{type = "exp", value = {12000}},{type = "points", value = {2}}}}, [25] = {killsRequired = 600, raceName = "Underwater Quara", level = {80, 129}, premium = true, creatures = {"quara hydromancer", "quara predator", "quara constrictor", "quara mantassin", "quara pincher"}, rewards = {{type = "exp", value = {15000}},{type = "achievement", value = {"Back into the Abyss"}},{type = "storage", value = {35009, 1}},{type = "points", value = {3}}}}, [26] = {killsRequired = 500, raceName = "Giant Spiders", level = {80, 129}, premium = true, creatures = {"giant spider"}, rewards = {{type = "exp", value = {20000}},{type = "achievement", value = {"Choking on Her Venom"}},{type = "storage", value = {35010, 1}},{type = "points", value = {3}}}}, [27] = {killsRequired = 300, raceName = "Werewolves", level = {80, 129}, premium = true, creatures = {"werewolf"}, rewards = {{type = "exp", value = {30000}},{type = "achievement", value = {"Howly Silence"}},{type = "storage", value = {35011, 1}},{type = "points", value = {4}}}}, [28] = {killsRequired = 400, raceName = "Nightmares", level = {80, 129}, premium = true, creatures = {"nightmare", "nightmare scion"}, rewards = {{type = "exp", value = {25000}},{type = "achievement", value = {"Dream is Over"}},{type = "storage", value = {35012, 1}},{type = "points", value = {3}}}}, [29] = {killsRequired = 600, raceName = "Hellspawns", level = {80, 129}, premium = true, creatures = {"hellspawn"}, rewards = {{type = "exp", value = {25000}},{type = "achievement", value = {"Scorched Flames"}},{type = "storage", value = {35013, 1}}}}, [30] = {killsRequired = 800, raceName = "High Class Lizards", level = {80, 129}, premium = true, creatures = {"lizard chosen", "lizard dragon priest", "lizard high guard", "lizard legionnaire"}, rewards = {{type = "exp", value = {30000}},{type = "achievement", value = {"Zzztill Zzztanding!"}},{type = "storage", value = {35014, 1}},{type = "points", value = {3}}}}, [31] = {killsRequired = 600, raceName = "Stampors", level = {80, 129}, premium = true, creatures = {"stampor"}, rewards = {{type = "exp", value = {20000}},{type = "achievement", value = {"Stepped on a Big Toe"}},{type = "storage", value = {35015, 1}},{type = "points", value = {3}}}}, [32] = {killsRequired = 500, raceName = "Brimstone Bugs", level = {80, 129}, premium = true, creatures = {"brimstone bug"}, rewards = {{type = "exp", value = {15000}},{type = "achievement", value = {"Something Smells"}},{type = "storage", value = {35016, 1}},{type = "points", value = {3}}}}, [33] = {killsRequired = 400, raceName = "Mutated Bats", level = {80, 129}, premium = true, creatures = {"mutated bat"}, rewards = {{type = "exp", value = {20000}},{type = "achievement", value = {"Kapow!"}},{type = "storage", value = {35017, 1}},{type = "points", value = {2}}}}, [34] = {killsRequired = 650, raceName = "Hydras", level = {130, 9999}, premium = true, creatures = {"hydra"}, rewards = {{type = "exp", value = {30000}},{type = "achievement", value = {"One Less"}},{type = "storage", value = {35018, 1}},{type = "points", value = {3}}}}, [35] = {killsRequired = 800, raceName = "Serpent Spawns", level = {130, 9999}, premium = true, creatures = {"serpent spawn"}, rewards = {{type = "exp", value = {30000}},{type = "achievement", value = {"Hissing Downfall"}},{type = "storage", value = {35019, 1}},{type = "points", value = {4}}}}, [36] = {killsRequired = 500, raceName = "Medusae", level = {130, 9999}, premium = true, creatures = {"medusa"}, rewards = {{type = "exp", value = {40000}},{type = "achievement", value = {"The Serpent's Bride"}},{type = "storage", value = {35020, 1}},{type = "points", value = {5}}}}, [37] = {killsRequired = 700, raceName = "Behemoths", level = {130, 9999}, premium = true, creatures = {"behemoth"}, rewards = {{type = "exp", value = {30000}},{type = "achievement", value = {"Just Cracked Me Up!"}},{type = "storage", value = {35021, 1}},{type = "points", value = {4}}}}, [38] = {killsRequired = 900, raceName = "Sea Serpents and Young Sea Serpents", level = {130, 9999}, premium = true, creatures = {"sea serpent", "young sea serpent"}, rewards = {{type = "exp", value = {30000}},{type = "achievement", value = {"The Drowned Sea God"}},{type = "storage", value = {35022, 1}},{type = "points", value = {4}}}}, [39] = {killsRequired = 250, raceName = "Hellhounds", level = {130, 9999}, premium = true, creatures = {"hellhound"}, rewards = {{type = "exp", value = {40000}},{type = "achievement", value = {"The Gates of Hell"}},{type = "storage", value = {35023, 1}},{type = "points", value = {5}}}}, [40] = {killsRequired = 500, raceName = "Ghastly Dragons", level = {130, 9999}, premium = true, creatures = {"ghastly dragon"}, rewards = {{type = "exp", value = {30000}},{type = "achievement", value = {"Beautiful Agony"}},{type = "storage", value = {35024, 1}},{type = "points", value = {5}}}}, [41] = {killsRequired = 900, raceName = "Drakens", level = {130, 9999}, premium = true, creatures = {"draken spellweaver", "draken warmaster", "draken abomination", "draken elite"} , rewards = {{type = "exp", value = {30000}},{type = "achievement", value = {"Enter zze Draken!"}},{type = "storage", value = {35025, 1}},{type = "points", value = {3}}}}, [42] = {killsRequired = 650, raceName = "Destroyers", level = {130, 9999}, premium = true, creatures = {"destroyer"}, rewards = {{type = "exp", value = {30000}},{type = "achievement", value = {"Best there was!"}},{type = "storage", value = {35026, 1}},{type = "points", value = {4}}}}, [43] = {killsRequired = 400, raceName = "Undead Dragons", level = {130, 9999}, premium = true, creatures = {"undead dragon"}, rewards = {{type = "exp", value = {50000}},{type = "achievement", value = {"Back from the Dead"}},{type = "storage", value = {35027, 1}},{type = "points", value = {6}}}}, [44] = {killsRequired = 666, raceName = "Demons", level = {130, 9999}, rank = RANK_ELITEHUNTER, premium = true, creatures = {"demon"}, rewards = {{type = "storage", value = {41300, 1}}}}, [45] = {killsRequired = 500, raceName = "Green Djinns or Efreets", level = {1, 9999}, storage = {12500, 1}, premium = true, creatures = {"green djinn", "efreet"}, rewards = {{type = "exp", value = {10000}},{type = "money", value = {5000}},{type = "storage", value = {35028, 1}}}}, [46] = {killsRequired = 500, raceName = "Blue Djinns or Marids", level = {1, 9999}, storage = {12501, 1}, premium = true, creatures = {"blue djinn", "marid"}, rewards = {{type = "exp", value = {10000}},{type = "money", value = {5000}},{type = "storage", value = {35029, 1}}}}, [47] = {killsRequired = 3000, raceName = "Pirates", level = {1, 9999}, storage = {12600, 1}, premium = true, creatures = {"pirate ghost", "pirate marauder", "pirate cutthroad", "pirate buccaneer", "pirate corsair", "pirate skeleton"}, rewards = {{type = "exp", value = {10000}},{type = "money", value = {5000}},{type = "storage", value = {35030, 1}}}}, [48] = {killsRequired = 3000, raceName = "Pirates second task", level = {1, 9999}, storage = {REPEATSTORAGE_BASE + 47, 3}, norepeatable = true, premium = true, creatures = {"pirate ghost", "pirate marauder", "pirate cutthroad", "pirate buccaneer", "pirate corsair", "pirate skeleton"}, rewards = {{type = "exp", value = {10000}},{type = "money", value = {5000}},{type = "storage", value = {35031, 1}}}}, [49] = {killsRequired = 5000, raceName = "Minotaurs", level = {1, 40}, storage = {12700, 1}, norepeatable = true, premium = false, creatures = {"minotaur", "minotaur mage", "minotaur archer"}, rewards = {{type = "storage", value = {35032, 1}}}}, } tasksByPlayer = 3 repeatTimes = 3 function Player.getPawAndFurRank(self) return (self:getStorageValue(POINTSSTORAGE) >= 100 and RANK_ELITEHUNTER or self:getStorageValue(POINTSSTORAGE) >= 70 and RANK_TROPHYHUNTER or self:getStorageValue(POINTSSTORAGE) >= 40 and RANK_BIGGAMEHUNTER or self:getStorageValue(POINTSSTORAGE) >= 20 and RANK_RANGER or self:getStorageValue(POINTSSTORAGE) >= 10 and RANK_HUNTSMAN or self:getStorageValue(JOIN_STOR) == 1 and RANK_JOIN or RANK_NONE) end function Player.getPawAndFurPoints(self) return math.max(self:getStorageValue(POINTSSTORAGE), 0) end function getTaskByName(name, table) local t = (table and table or tasks) for k, v in pairs(t) do if v.name then if v.name:lower() == name:lower() then return k end else if v.raceName:lower() == name:lower() then return k end end end return false end function Player.getTasks(self) local canmake = {} local able = {} for k, v in pairs(tasks) do if self:getStorageValue(QUESTSTORAGE_BASE + k) < 1 and self:getStorageValue(REPEATSTORAGE_BASE + k) < repeatTimes then able[k] = true if self:getLevel() < v.level[1] or self:getLevel() > v.level[2] then able[k] = false end if v.storage and self:getStorageValue(v.storage[1]) < v.storage[2] then able[k] = false end if v.rank then if self:getPawAndFurRank() < v.rank then able[k] = false end end if v.premium then if not self:isPremium() then able[k] = false end end if able[k] then canmake[#canmake + 1] = k end end end return canmake end function Player.canStartTask(self, name, table) local v = "" local id = 0 local t = (table and table or tasks) for k, i in pairs(t) do if i.name then if i.name:lower() == name:lower() then v = i id = k break end else if i.raceName:lower() == name:lower() then v = i id = k break end end end if v == "" then return false end if self:getStorageValue(QUESTSTORAGE_BASE + id) > 0 then return false end if self:getStorageValue(REPEATSTORAGE_BASE + id) >= repeatTimes or v.norepeatable and self:getStorageValue(REPEATSTORAGE_BASE + id) > 0 then return false end if v.level and self:getLevel() >= v.level[1] and self:getLevel() <= v.level[2] then if v.premium then if self:isPremium() then if v.rank then if self:getPawAndFurRank() >= v.rank then if v.storage then if self:getStorageValue(v.storage[1]) >= v.storage then return true end else return true end end else return true end else return true end else return true end end return false end function Player.getStartedTasks(self) local tmp = {} for k, v in pairs(tasks) do if self:getStorageValue(QUESTSTORAGE_BASE + k) > 0 and self:getStorageValue(QUESTSTORAGE_BASE + k) < 2 then tmp[#tmp + 1] = k end end return tmp end --in case other scripts are using these functions, i'll let them here function getPlayerRank(cid) local p = Player(cid) return p and p:getPawAndFurRank() end function getPlayerTasksPoints(cid) local p = Player(cid) return p and p:getPawAndFurPoints() end function getTasksByPlayer(cid) local p = Player(cid) return p and p:getTasks() end function canStartTask(cid, name, table) local p = Player(cid) return p and p:canStartTask(name, table) end function getPlayerStartedTasks(cid) local p = Player(cid) return p and p:getStartedTasks() end onde eu colocaria aqui?
  4. fabiobillz postou uma resposta no tópico em Suporte Tibia OTServer
    Lua Script Error: [Npc interface] data/npc/scripts/Grizzly Adams.lua:onCreatureSay LuaScriptInterface::luaAddEvent(). Argument #5 is unsafe stack traceback: [C]: in function 'addEvent' data/npc/lib/npcsystem/npchandler.lua:642: in function 'say' data/npc/scripts/Grizzly Adams.lua:266: in function 'callback' data/npc/lib/npcsystem/npchandler.lua:430: in function 'onCreatureSay' data/npc/scripts/Grizzly Adams.lua:9: in function <data/npc/scripts/Grizzly Adams.lua:9> Alguem sabe resolver? nao ta somando as mortes dos montros esse é o codigo do Grizzly.lua dofile('data/lib/miscellaneous/killingInTheNameOfQuest.lua') local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end function onThink() npcHandler:onThink() end local choose = {} local cancel = {} local available = {} local grizzlyAdamsConfig = { ranks = { huntsMan_rank = { {id=11208, buy=0, sell=50, name='antlers'}, {id=10549, buy=0, sell=100, name='bloody pincers'}, {id=11183, buy=0, sell=35, name='crab pincers'}, {id=10573, buy=0, sell=55, name='cyclops toe'}, {id=10564, buy=0, sell=30, name='frosty ear of a troll'}, {id=11193, buy=0, sell=600, name='hydra head'}, {id=11366, buy=0, sell=80, name='lancer beetle shell'}, {id=10578, buy=0, sell=420, name='mutated bat ear'}, {id=11222, buy=0, sell=400, name='sabretooth'}, {id=11367, buy=0, sell=20, name='sandcrawler shell'}, {id=10547, buy=0, sell=280, name='scarab pincers'}, {id=11365, buy=0, sell=60, name='terramite legs'}, {id=11363, buy=0, sell=170, name='terramite shell'}, {id=11184, buy=0, sell=30000, name='terrorbird beak'}, {id=7398, buy=0, sell=500, name='cyclops trophy'}, {id=11315, buy=0, sell=15000, name='draken trophy'}, {id=11330, buy=0, sell=8000, name='lizard trophy'}, {id=7401, buy=0, sell=500, name='minotaur trophy'} }, bigGameHunter_rank = { {id=7397, buy=0, sell=3000, name='deer trophy'}, {id=7400, buy=0, sell=3000, name='lion trophy'}, {id=7394, buy=0, sell=3000, name='wolf trophy'} }, trophyHunter_rank = { {id=7393, buy=0, sell=40000, name='demon trophy'}, {id=7396, buy=0, sell=20000, name='behemoth trophy'}, {id=7399, buy=0, sell=10000, name='dragon lord trophy'}, {id=10518, buy=1000, sell=0, name='demon backpack'}, }, } } local Topic = {} function greetCallback(cid) Topic[cid] = 0 return true end local function setNewTradeTable(table) local items = {} for _, v in ipairs(table) do items[v.id] = {itemId = v.id, buyPrice = v.buy, sellPrice = v.sell, subType = 0, realName = v.name} end return items end local function setNewLineTable(oldTable, newTable) for k, v in pairs(oldTable) do table.insert(newTable, k, v) end return true end function creatureSayCallback(cid, type, msg) local player = Player(cid) local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_PRIVATE and 0 or cid if (msgcontains(msg, "hi") or msgcontains(msg, "hello")) and (not npcHandler:isFocused(cid)) then if (player:getStorageValue(JOIN_STOR) == -1) then npcHandler:say("Welcome "..getCreatureName(cid)..". Would you like to join the 'Paw and Fur - Hunting Elite'?", cid) npcHandler:addFocus(cid) npcHandler.topic[cid] = 5 else npcHandler:say("Welcome back old chap. What brings you here this time?", cid) npcHandler:addFocus(cid) npcHandler.topic[cid] = 0 end return true end if(not npcHandler:isFocused(cid)) then return false end if msgcontains(msg, "bye") or msgcontains(msg, "farewell") then npcHandler:say("Happy hunting, old chap!", cid, TRUE) Topic[talkUser] = 0 npcHandler:releaseFocus(cid) end if (isInArray({"yes", "join"}, msg:lower()) and npcHandler.topic[cid] == 5) then player:setStorageValue(JOIN_STOR, 1) npcHandler:say("Great! A warm welcome to our newest member: "..getCreatureName(cid).."! Ask me for a {task} if you want to go on a hunt.", cid) npcHandler.topic[cid] = 0 elseif (msg:lower() == "no" and npcHandler.topic[cid] == 5) then npcHandler:say("No problem old chap. Come back if you change your mind.", cid) end if (player:getStorageValue(JOIN_STOR) == -1) then npcHandler:say("You'll have to {join} us to get more information.",cid) return false end if isInArray({"offer", "trade"}, msg:lower()) then if getPlayerRank(cid) >= 2 then if getPlayerRank(cid) == 2 or getPlayerRank(cid) == 3 then tradeRank = grizzlyAdamsConfig.ranks.huntsMan_rank elseif getPlayerRank(cid) == 4 then tradeRank = grizzlyAdamsConfig.ranks.bigGameHunter_rank setNewLineTable(grizzlyAdamsConfig.ranks.huntsMan_rank, grizzlyAdamsConfig.ranks.bigGameHunter_rank) elseif getPlayerRank(cid) == 5 or getPlayerRank(cid) == 6 then tradeRank = grizzlyAdamsConfig.ranks.trophyHunter_rank setNewLineTable(grizzlyAdamsConfig.ranks.huntsMan_rank, grizzlyAdamsConfig.ranks.bigGameHunter_rank) setNewLineTable(grizzlyAdamsConfig.ranks.huntsMan_rank, grizzlyAdamsConfig.ranks.trophyHunter_rank) end local items = setNewTradeTable(tradeRank) local function onBuy(cid, item, subType, amount, ignoreCap, inBackpacks) if ignoreCap == false and (player:getFreeCapacity() < getItemWeight(items[item].itemId, amount) or inBackpacks and player:getFreeCap() < (getItemWeight(items[item].itemId, amount) + getItemWeight(1988, 1))) then return player:sendTextMessage(MESSAGE_INFO_DESCR, 'You don\'t have enough cap.') end if items[item].buyPrice then player:removeMoney(amount * items[item].buyPrice) for i = 1, amount do if inBackpacks then local backpack = doCreateItemEx(1988, 1) doAddContainerItem(backpack, items[item].itemId, amount) else player:addItem(items[item].itemId, amount, true) end end return player:sendTextMessage(MESSAGE_INFO_DESCR, 'You bought '..amount..'x '..items[item].realName..' for '..items[item].buyPrice * amount..' gold coins.') end return true end local function onSell(cid, item, subType, amount, ignoreCap, inBackpacks) if items[item].sellPrice then player:addMoney(items[item].sellPrice * amount) player:removeItem(items[item].itemId, amount) return player:sendTextMessage(cid, MESSAGE_INFO_DESCR, 'You sold '..amount..'x '..items[item].realName..' for '..items[item].sellPrice * amount..' gold coins.') end return true end openShopWindow(cid, tradeRank, onBuy, onSell) return npcHandler:say('It\'s my offer.', player) else return npcHandler:say('You don\'t have any rank.', player) end end if isInArray({"tasks", "task", "mission"}, msg:lower()) then local can = getTasksByPlayer(cid) if (player:getStorageValue(JOIN_STOR) == -1) then return (npcHandler:say("You'll have to {join}, to get any {tasks}.",cid)) end if #can > 0 then local text = "" local sep = ", " table.sort(can, (function(a, b) return (a < b) end)) local t = 0 for _, id in ipairs(can) do t = t + 1 if t == #can - 1 then sep = " and " elseif t == #can then sep = "." end text = text .. "{" .. (tasks[id].name or tasks[id].raceName) .. "}" .. sep end npcHandler:say("The current task" .. (#can > 1 and "s" or "") .. " that you can choose " .. (#can > 1 and "are" or "is") .. " " .. text, player) npcHandler.topic[cid] = 0 else npcHandler:say("I don't have any task for you right now.", player) end elseif msg ~= "" and canStartTask(cid, msg) then if #getPlayerStartedTasks(cid) >= tasksByPlayer then npcHandler:say("Sorry, but you already started " .. tasksByPlayer .. " tasks. You can check their {status} or {cancel} a task.", player) return true end local task = getTaskByName(msg) if task and player:getStorageValue(QUESTSTORAGE_BASE + task) > 0 then return false end npcHandler:say("In this task you must defeat " .. tasks[task].killsRequired .. " " .. tasks[task].raceName .. ". Are you sure that you want to start this task?", player) choose[cid] = task npcHandler.topic[cid] = 1 elseif msg:lower() == "yes" and npcHandler.topic[cid] == 1 then player:setStorageValue(QUESTSTORAGE_BASE + choose[cid], 1) player:setStorageValue(KILLSSTORAGE_BASE + choose[cid], 0) npcHandler:say("Excellent! You can check the {status} of your task saying {report} to me. Also you can {cancel} tasks to.", player) choose[cid] = nil npcHandler.topic[cid] = 0 elseif (msg:lower() == "report" or msg:lower() == "status") then local started = getPlayerStartedTasks(cid) local finishedAtLeastOne = false local finished = 0 if started and #started > 0 then for _, id in ipairs(started) do if player:getStorageValue(KILLSSTORAGE_BASE + id) >= tasks[id].killsRequired then for _, reward in ipairs(tasks[id].rewards) do local deny = false if reward.storage then if player:getStorageValue(reward.storage[1]) >= reward.storage[2] then deny = true end end if isInArray({REWARD_MONEY, "money"}, reward.type:lower()) and not deny then doPlayerAddMoney(cid, reward.value[1]) elseif isInArray({REWARD_EXP, "exp", "experience"}, reward.type:lower()) and not deny then doPlayerAddExp(cid, reward.value[1], false, reward.value[1], false, true) doPlayerSendDefaultCancel(cid, "You gained " .. reward.value[1] .. " experience points.") elseif isInArray({REWARD_ACHIEVEMENT, "achievement", "ach"}, reward.type:lower()) and not deny then elseif isInArray({REWARD_STORAGE, "storage", "stor"}, reward.type:lower()) and not deny then player:setStorageValue(reward.value[1], reward.value[2]) elseif isInArray({REWARD_POINT, "points", "point"}, reward.type:lower()) and not deny then player:setStorageValue(POINTSSTORAGE, player:getStorageValue(POINTSSTORAGE) + reward.value[1]) elseif isInArray({REWARD_ITEM, "item", "items", "object"}, reward.type:lower()) and not deny then doPlayerAddItem(cid, reward.value[1], reward.value[2]) end if reward.storage then player:setStorageValue(reward.storage[1], reward.storage[2]) end end if tasks[id].norepeatable then player:setStorageValue(QUESTSTORAGE_BASE + id, 2) else player:setStorageValue(QUESTSTORAGE_BASE + id, 0) end if player:getStorageValue(REPEATSTORAGE_BASE + id) < 1 then player:setStorageValue(REPEATSTORAGE_BASE + id, 0) end player:setStorageValue(REPEATSTORAGE_BASE + id, player:getStorageValue(REPEATSTORAGE_BASE + id) + 1) finishedAtLeastOne = true finished = finished + 1 end end if (not finishedAtLeastOne) then local started = getPlayerStartedTasks(cid) if (started and #started > 0) then local text = "" local sep = ", " table.sort(started, (function(a, b) return (a < b) end)) local t = 0 for _, id in ipairs(started) do t = t + 1 if (t == #started - 1) then sep = " and " elseif (t == #started) then sep = "." end text = text .. "{" .. (tasks[id].name or tasks[id].raceName) .. "}" .. sep end npcHandler:say("The current task" .. (#started > 1 and "s" or "") .. " that you started " .. (#started > 1 and "are" or "is") .. " " .. text, player) Topic[cid] = 1 else npcHandler:say("Awesome! you finished " .. (finished > 1 and "various" or "a") .. " task" .. (finished > 1 and "s" or "") .. ". Talk to me again if you want to start a {task}.", player) end else npcHandler:say("You haven't started any task yet.", player) end end elseif msg:lower() == "started" then local started = getPlayerStartedTasks(cid) if started and #started > 0 then local text = "" local sep = ", " table.sort(started, (function(a, b) return (a < b) end)) local t = 0 for _, id in ipairs(started) do t = t + 1 if t == #started - 1 then sep = " and " elseif t == #started then sep = "." end text = text .. "{" .. (tasks[id].name or tasks[id].raceName) .. "}" .. sep end npcHandler:say("The current task" .. (#started > 1 and "s" or "") .. " that you started " .. (#started > 1 and "are" or "is") .. " " .. text, player) else npcHandler:say("You haven't started any task yet.", player) end elseif msg:lower() == "cancel" then local started = getPlayerStartedTasks(cid) local task = getTaskByName(msg) local text = "" local sep = ", " table.sort(started, (function(a, b) return (a < b) end)) local t = 0 for _, id in ipairs(started) do t = t + 1 if t == #started - 1 then sep = " or " elseif t == #started then sep = "?" end text = text .. "{" .. (tasks[id].name or tasks[id].raceName) .. "}" .. sep end if started and #started > 0 then npcHandler:say("Cancelling a task will make the counter restart. Which of these tasks you want cancel?" .. (#started > 1 and "" or "") .. " " .. text, player) npcHandler.topic[cid] = 2 else npcHandler:say("You haven't started any task yet.", player) end elseif getTaskByName(msg) and npcHandler.topic[cid] == 2 and isInArray(getPlayerStartedTasks(cid), getTaskByName(msg)) then local task = getTaskByName(msg) if player:getStorageValue(KILLSSTORAGE_BASE + task) > 0 then npcHandler:say("You currently killed " .. player:getStorageValue(KILLSSTORAGE_BASE + task) .. "/" .. tasks[task].killsRequired .. " " .. tasks[task].raceName .. ". Cancelling this task will restart the count. Are you sure you want to cancel this task?", player) else npcHandler:say("Are you sure you want to cancel this task?", player) end npcHandler.topic[cid] = 3 cancel[cid] = task elseif getTaskByName(msg) and Topic[cid] == 1 and isInArray(getPlayerStartedTasks(cid), getTaskByName(msg)) then local task = getTaskByName(msg) if player:getStorageValue(KILLSSTORAGE_BASE + task) > 0 then npcHandler:say("You currently killed " .. player:getStorageValue(KILLSSTORAGE_BASE + task) .. "/" .. tasks[task].killsRequired .. " " .. tasks[task].raceName .. ".", player) Topic[cid] = 0 else npcHandler:say("You currently killed 0/" .. tasks[task].killsRequired .. " " .. tasks[task].raceName .. ".", player) end elseif msg:lower() == "yes" and npcHandler.topic[cid] == 3 then player:setStorageValue(QUESTSTORAGE_BASE + cancel[cid], -1) player:setStorageValue(KILLSSTORAGE_BASE + cancel[cid], -1) npcHandler:say("You have cancelled the task " .. (tasks[cancel[cid]].name or tasks[cancel[cid]].raceName) .. ".", player) npcHandler.topic[cid] = 0 elseif isInArray({"points", "rank"}, msg:lower()) then if player:getStorageValue(POINTSSTORAGE) < 1 then npcHandler:say("At this time, you have 0 Paw & Fur points. You " .. (getPlayerRank(cid) == 6 and "are an Elite Hunter" or getPlayerRank(cid) == 5 and "are a Trophy Hunter" or getPlayerRank(cid) == 4 and "are a Big Game Hunter" or getPlayerRank(cid) == 3 and "are a Ranger" or getPlayerRank(cid) == 2 and "are a Huntsman" or getPlayerRank(cid) == 1 and "are a Member" or "haven't been ranked yet") .. ".", cid) elseif player:getStorageValue(POINTSSTORAGE) >= 1 then npcHandler:say("At this time, you have " .. player:getStorageValue(POINTSSTORAGE) .. " Paw & Fur points. You " .. (getPlayerRank(cid) == 6 and "are an Elite Hunter" or getPlayerRank(cid) == 5 and "are a Trophy Hunter" or getPlayerRank(cid) == 4 and "are a Big Game Hunter" or getPlayerRank(cid) == 3 and "are a Ranger" or getPlayerRank(cid) == 2 and "are a Huntsman" or getPlayerRank(cid) == 1 and "are a Member" or "haven't been ranked yet") .. ".", cid) end npcHandler.topic[cid] = 0 elseif isInArray({"special task"}, msg:lower()) then if player:getStorageValue(POINTSSTORAGE) >= 90 then -- Tiquandas Revenge 90 points if player:getStorageValue(22222) == 1 then -- Check if he has already started the task. npcHandler:say("You have already started the task. Go find Tiquandas Revenge and take revenge yourself!", cid) else selfSay("Have you heard about Tiquandas Revenge? It is said that the jungle itself is alive and takes revenge for all the bad things people have done to it. ...", cid) npcHandler:say("I myself believe that there is some truth in this clap trap. Something 'real' which therefore must have a hideout somewhere. Go find it and take revenge yourself!", cid) setPlayerStorageValue(cid, 22555, 1) -- Task needed to enter Tiquandas Revenge TP setPlayerStorageValue(cid, 22222, 1) -- Won't give this task again. end end if player:getStorageValue(POINTSSTORAGE) >= 100 then -- Demodras 100 points if player:getStorageValue(22223) == 1 then -- Check if he has already started the task. npcHandler:say("You have already started the special task. Find Demodras and kill it.", cid) else npcHandler:say("This task is a very dangerous one. I want you to look for Demodras' hideout. It might be somewhere under the Plains of Havoc. Good luck, old chap.", cid) setPlayerStorageValue(cid, 22556, 1) -- Task needed to enter Demodras TP setPlayerStorageValue(cid, 22223, 1) -- Won't give this task again. end end npcHandler.topic[cid] = 0 end end npcHandler:setMessage(MESSAGE_FAREWELL, "Happy hunting, old chap!") npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
  5. fabiobillz postou uma resposta no tópico em Tutoriais Websites
    putz é foda, mas como faz isso? tem algum sistema de task? o meu nao ta somando os mostros mortos
  6. fabiobillz postou uma resposta no tópico em Tutoriais Websites
    entao o problema esta no vitor que abre windows e nao mostra as tasks
  7. Alguém sabe resolver? Lua Script Error: [Modules Interface] data/modules/scripts/expertpvp/fightmodes.lua:onRecvbyte data/modules/scripts/expertpvp/fightmodes.lua:5: attempt to call method 'getPvpMode' (a nil value) stack traceback: [C]: in function 'getPvpMode' data/modules/scripts/expertpvp/fightmodes.lua:5: in function <data/modules/scripts/expertpvp/fightmodes.lua:1>
  8. fabiobillz postou uma resposta no tópico em Tutoriais Websites
    1.2
  9. fabiobillz postou uma resposta no tópico em Tutoriais Websites
    Lua Script Error: [Npc interface] data/npc/scripts/victor.lua:onCreatureSay data/lib/task_window.lua:82: attempt to call global 'getCreatureStorage' (a nil value) stack traceback: [C]: in function 'getCreatureStorage' data/lib/task_window.lua:82: in function 'callback' data/npc/lib/npcsystem/npchandler.lua:430: in function 'onCreatureSay' data/npc/scripts/victor.lua:10: in function <data/npc/scripts/victor.lua:10 da esse erro mas eu achei esse para o victor.lua local choose = {} local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) local talkState = {} function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end function onThink() npcHandler:onThink() end function creatureSayCallback(cid, type, msg) local player = Player(cid) if(not npcHandler:isFocused(cid)) then return false end local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_PRIVATE and 0 or cid local taskWindow = ModalWindow(1900, "Mission Management", "Select a task:") if isInArray({"task", "tasks"}, msg:lower()) then selfSay("Here.", cid) taskNPCuid = getNpcCid() if player:getStorageValue(32150) < 0 then player:setStorageValue(32150, 0) end return taskWindow:sendToPlayer(cid) end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) ai abre a janela, so que nao aparece nada só select ou cancel
  10. fabiobillz postou uma resposta no tópico em Tutoriais Websites
    Quando fala com o npc nao abre a janela com as task

Informação Importante

Confirmação de Termo