Postado Janeiro 3, 2015 10 anos Desculpe estar revivendo o tópico, mas preciso muito desse evento, todos que testei não deu certo, sempre dava erro. Enfim apliquei esse script no meu servidor de dragon ball, porém deixei como zombie event mesmo... Deu tudo certo, porém ele não sumona os monsters, fiquei la um bom tempo e nada dos zombies aparecerem, até tentei da goto com o ADM porém não se encontra no mapa, coloquei as cordenadas certinho... =/ Obs: Criei o zombie event, apliquei no monsters.xml e também alterei esta parte do script monsters = {'Zombie Event'}, Editado Janeiro 3, 2015 10 anos por bhelliip (veja o histórico de edições)
Postado Março 2, 2015 10 anos Diretor Fala galerinha do TK, tudo bem? Recebi alguns pedidos para fazer um evento estilo Zombie, só que no modo de Pokemon (PÍÍÍKAAAAAAAAAAAAAAAAAAACHUUUUUU) rs. Enfim, vamos a instalação, depois ensinarei a configurar. Em data/mods crie um arquivo com o nome de pikachuevent.xml com o conteúdo: <?xml version="1.0" encoding="UTF-8"?> <mod name="PikachuEvent" version="1.0" author="Absolute" contact="tibiaking.com" enabled="yes"> <config name="config_pikachu_event"> <![CDATA[ configPikachuEvent = { storages = { main = 'PikachuEventMain', -- set free storage player = 'PikachuEventPlayer', -- set free storage joining = 'PikachuEventJoining', -- set free storage kills = 'PikachuEventKills', -- set free storage exhaust = 'PikachuEventExhaust', -- set free storage countEvent = 'PikachuEventCountEvent' -- set free storage }, position = {x=890,y=193,z=7}, -- position to which player is teleporting room = { from = {x=678,y=980,z=7}, -- left top corner of event room to = {x=678,y=1089,z=7} -- right bottom corner of event room }, rewards = {7958, 11366}, -- reward id which player can win (reward is random) players = { max = 50, -- max players in event min = 2, -- min players to event start minLevel = 50, -- min level to join to event pvpEnabled = false -- can players hit theirselfs }, days = { ['Tuesday'] = {'22:00:00'}, ['Thursday'] = {'22:00:00'}, ['Friday'] = {'22:00:00'}, ['Sunday'] = {'22:00:00'} }, spawnDelay = 2000, -- miliseconds amountCreatingMonsters = 5, monsters = {'Pikachu', 'Ash'}, -- name of monsters which is creating in event delayTime = 5.0, -- time in which players who joined to event are teleporting to teleport position [miuntes] startEvent = 1, -- time from teleport to start event [seconds] stopEvent = 19200, -- [seconds] text = '-PL-\nAby wygrac i otrzymac nagrode, zabij jak najwieksza liczbe pikachu przez 20min lub pozostan sam na arenie.\n\n-ENG-\nTo win and get a reward, kill as many pikachus for 20 minutes or stay the same in the arena.' } ]]> </config> <lib name="lib_pikachu_event"> <![CDATA[ function doStopPikachuEvent() if getStorage(configPikachuEvent.storages.main) > 0 then local playerTable, creatureTable = {}, {} for x = configPikachuEvent.room.from.x, configPikachuEvent.room.to.x do for y = configPikachuEvent.room.from.y, configPikachuEvent.room.to.y do local n, i = getTileInfo({x=x, y=y, z=configPikachuEvent.room.from.z}).creatures, 1 if n ~= 0 then local v = getThingfromPos({x=x, y=y, z=configPikachuEvent.room.from.z, stackpos=i}).uid while v ~= 0 do if isPlayer(v) then table.insert(playerTable, v) if n == #playerTable then break end elseif isMonster(v) then table.insert(creatureTable, v) if n == #creatureTable then break end end i = i + 1 v = getThingfromPos({x=x, y=y, z=configPikachuEvent.room.from.z, stackpos=i}).uid end end end end if #playerTable > 1 then table.sort(playerTable, function(a, b) return (getCreatureStorage(a, configPikachuEvent.storages.kills)) > (getCreatureStorage(b, configPikachuEvent.storages.kills)) end) local prize = math.random(#configPikachuEvent.rewards) doTeleportThing(playerTable[1], getTownTemplePosition(getPlayerTown(playerTable[1]))) doCreatureSetStorage(playerTable[1], configPikachuEvent.storages.kills, 0) doPlayerAddItem(playerTable[1], configPikachuEvent.rewards[prize], 1) doCreatureAddHealth(playerTable[1], getCreatureMaxHealth(playerTable[1]) - getCreatureHealth(playerTable[1])) doCreatureAddMana(playerTable[1], getCreatureMaxMana(playerTable[1]) - getCreatureMana(playerTable[1])) doPlayerSendTextMessage(playerTable[1], MESSAGE_EVENT_ADVANCE, 'You win! You have received '..getItemNameById(configPikachuEvent.rewards[prize])..' as reward.') doBroadcastMessage('Pikachu Plague Attack has finished. The winner is '..getCreatureName(playerTable[1])..'. Congratulations!') doSetStorage(configPikachuEvent.storages.main, -1) db.query("INSERT INTO `events` (`event_name`, `winner_name`, `won_item`, `time_win`) VALUES (\"Pikachu\", \"" .. getCreatureName(playerTable[1]) .. "\", \"" .. getItemNameById(configPikachuEvent.rewards[prize]) .. "\", " .. getStorage(configPikachuEvent.storages.countEvent) ..");") for i = 2, #playerTable do doCreatureAddHealth(playerTable[i], getCreatureMaxHealth(playerTable[i]) - getCreatureHealth(playerTable[i])) doCreatureAddMana(playerTable[i], getCreatureMaxMana(playerTable[i]) - getCreatureMana(playerTable[i])) doTeleportThing(playerTable[i], getTownTemplePosition(getPlayerTown(playerTable[i]))) doPlayerSendTextMessage(playerTable[i], MESSAGE_EVENT_ADVANCE, 'You loss.') doSendMagicEffect(getThingPos(playerTable[i]), CONST_ME_STUN) doCreatureSetStorage(playerTable[i], configPikachuEvent.storages.kills, 0) end for i = 1, #creatureTable do if isMonster(creatureTable[i]) then doRemoveCreature(creatureTable[i]) end end doSetStorage(configPikachuEvent.storages.countEvent, getStorage(configPikachuEvent.storages.countEvent) + 1) elseif #playerTable == 0 then for i = 1, #creatureTable do if isMonster(creatureTable[i]) then doRemoveCreature(creatureTable[i]) end end doBroadcastMessage('No one win in Pikachu Plague Attack.') doSetStorage(configPikachuEvent.storages.main, -1) doSetStorage(configPikachuEvent.storages.countEvent, getStorage(configPikachuEvent.storages.countEvent) + 1) end end end function doStartPikachuEvent() doSetStorage(configPikachuEvent.storages.joining, -1) if configPikachuEvent.players.min <= doCountPlayersPikachuEvent() then for _, cid in ipairs(getPlayersOnline()) do if getCreatureStorage(cid, configPikachuEvent.storages.player) > 0 then doCreatureSetStorage(cid, configPikachuEvent.storages.player, -1) doTeleportThing(cid, configPikachuEvent.position) doCreatureSetNoMove(cid, false) doRemoveCondition(cid, CONDITION_INFIGHT) doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, 'Get ready. Pikachus Plague Attack starts in '..configPikachuEvent.startEvent..' seconds.') end end addEvent(doSetStorage, configPikachuEvent.startEvent * 1000, configPikachuEvent.storages.main, 1) addEvent(doStopPikachuEvent, configPikachuEvent.stopEvent * 1000) addEvent(doRepeatCheckPikachuEvent, configPikachuEvent.startEvent * 1000 + 2000) doBroadcastMessage('Pikachu Plague Attack has started. LET\'S GO!') else for _, cid in ipairs(getPlayersOnline()) do if getCreatureStorage(cid, configPikachuEvent.storages.player) > 0 then doCreatureSetNoMove(cid, false) doRemoveCondition(cid, CONDITION_INFIGHT) end end doBroadcastMessage('Pikachu Plague Attack hasn\'t started beacuse there were not enough players.') end end function doRepeatCheckPikachuEvent() if getStorage(configPikachuEvent.storages.main) > 0 then local playerTable, creatureTable, xTable, yTable = {}, {}, {}, {} for x = configPikachuEvent.room.from.x, configPikachuEvent.room.to.x do for y = configPikachuEvent.room.from.y, configPikachuEvent.room.to.y do local n, i = getTileInfo({x=x, y=y, z=configPikachuEvent.room.to.z}).creatures, 1 if n ~= 0 then local v = getThingfromPos({x=x, y=y, z=configPikachuEvent.room.to.z, stackpos=i}).uid while v ~= 0 do if isPlayer(v) then table.insert(playerTable, v) if n == #playerTable then break end elseif isMonster(v) then table.insert(creatureTable, v) if n == #creatureTable then break end end i = i + 1 v = getThingfromPos({x=x, y=y, z=configPikachuEvent.room.to.z, stackpos=i}).uid end end table.insert(xTable, x) table.insert(yTable, y) end end if #playerTable == 1 then local prize = math.random(#configPikachuEvent.rewards) addEvent(doTeleportThing, 200, playerTable[1], getTownTemplePosition(getPlayerTown(playerTable[1])), true) doPlayerAddItem(playerTable[1], configPikachuEvent.rewards[prize], 1) doCreatureSetStorage(playerTable[1], configPikachuEvent.storages.kills, 0) doCreatureAddHealth(playerTable[1], getCreatureMaxHealth(playerTable[1]) - getCreatureHealth(playerTable[1])) doCreatureAddMana(playerTable[1], getCreatureMaxMana(playerTable[1]) - getCreatureMana(playerTable[1])) doPlayerSendTextMessage(playerTable[1], MESSAGE_EVENT_ADVANCE, 'You win! You have received '..getItemNameById(configPikachuEvent.rewards[prize])..' as reward.') doBroadcastMessage('Pikachu Plague Attack has finished. The winner is '..getCreatureName(playerTable[1])..'. Congratulations.') db.query("INSERT INTO `events` (`event_name`, `winner_name`, `won_item`, `time_win`) VALUES (\"Pikachu\", \"" .. getCreatureName(playerTable[1]) .. "\", \""..getItemNameById(configPikachuEvent.rewards[prize]).."\", "..getStorage(configPikachuEvent.storages.countEvent)..");") for i = 1, #creatureTable do if isMonster(creatureTable[i]) then doRemoveCreature(creatureTable[i]) end end doSetStorage(configPikachuEvent.storages.main, -1) doSetStorage(configPikachuEvent.storages.countEvent, getStorage(configPikachuEvent.storages.countEvent) + 1) return elseif #playerTable == 0 then for i = 1, #creatureTable do if isMonster(creatureTable[i]) then doRemoveCreature(creatureTable[i]) end end doBroadcastMessage('No one win in Pikachu Plague Attack.') doSetStorage(configPikachuEvent.storages.main, -1) doSetStorage(configPikachuEvent.storages.countEvent, getStorage(configPikachuEvent.storages.countEvent) + 1) return end local pos = {x=xTable[math.random(#xTable)], y=yTable[math.random(#yTable)], z=7} for i = 1, configPikachuEvent.amountCreatingMonsters do doCreateMonster(configPikachuEvent.monsters[math.random(#configPikachuEvent.monsters)], pos, false, false, false) doSendMagicEffect(pos, CONST_ME_BATS) end addEvent(doRepeatCheckPikachuEvent, configPikachuEvent.spawnDelay) end end function doCountPlayersPikachuEvent() local x = 0 for _, cid in ipairs(getPlayersOnline()) do if getCreatureStorage(cid, configPikachuEvent.storages.player) > 0 then x = x + 1 end end return x end function doStartCountingPikachuEvent(x) if configPikachuEvent.delayTime-x > 0 then doBroadcastMessage('Pikachu Plague Attack is going to start in '..configPikachuEvent.delayTime-x..' minutes. You can join to the event by saying "!pikachu join".') addEvent(doStartCountingPikachuEvent, 60*1000, x+1) end end ]]> </lib> <talkaction words="!pikachu" event="script"> <![CDATA[ domodlib("config_pikachu_event") function onSay(cid, words, param) if getStorage(configPikachuEvent.storages.joining) ~= 1 then return doPlayerSendCancel(cid, 'Pikachu Plague Attack hasn\'t started yet.') elseif param == '' then return doPlayerSendCancel(cid, 'Command param required (say: "!pikachu join" or "!pikachu leave.").') elseif getPlayerLevel(cid) < configPikachuEvent.players.minLevel then return doPlayerSendCancel(cid, 'You can\'t join to the event if you don\'t have a require '..configPikachuEvent.players.minLevel..' level.') elseif getTileInfo(getThingPos(cid)).protection ~= true then return doPlayerSendCancel(cid, 'You can\'t join to the event if you aren\'t in protection zone.') elseif exhaustion.check(cid, configPikachuEvent.storages.exhaust) ~= false then return doPlayerSendCancel(cid, 'You must wait '..exhaustion.get(cid, configPikachuEvent.storages.exhaust)..' seconds to use this command again.') end if param == 'join' then if getCreatureStorage(cid, configPikachuEvent.storages.player) > 0 then return doPlayerSendCancel(cid, 'You have arleady joined to event. Wait patiently for start.') elseif doCountPlayersPikachuEvent() == configPikachuEvent.players.max then return doPlayerSendCancel(cid, 'Max players in the event have been reached.') end doCreatureSetNoMove(cid, true) doPlayerPopupFYI(cid, configPikachuEvent.text) doCreatureSetStorage(cid, configPikachuEvent.storages.player, 1) doAddCondition(cid, createConditionObject(CONDITION_INFIGHT, -1)) doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, 'You have joined to Pikachu Plague Attack. You can\'t move until event don\'t start. Wait patiently for the event start.') doPlayerSendTextMessage(cid, MESSAGE_EVENT_ORANGE, 'You have joined to Pikachu Plague Attack.') elseif param == 'leave' then if getCreatureStorage(cid, configPikachuEvent.storages.player) <= 0 then return doPlayerSendCancel(cid, 'You can\'t leave from the event if you don\'t join.') end doCreatureSetNoMove(cid, false) doCreatureSetStorage(cid, configPikachuEvent.storages.player, -1) doRemoveCondition(cid, CONDITION_INFIGHT) doPlayerSendTextMessage(cid, MESSAGE_EVENT_ORANGE, 'You have left from the Pikachu Plague Attack.') end exhaustion.set(cid, configPikachuEvent.storages.exhaust, 5) return true end ]]> </talkaction> <talkaction words="!startpikachu" access="5" event="script"> <![CDATA[ domodlib("config_pikachu_event") domodlib("lib_pikachu_event") function onSay(cid, words, param) if getStorage(configPikachuEvent.storages.main) > 0 then return doPlayerSendCancel(cid, 'Pikachu Plague Attack is already running.') end doStartCountingPikachuEvent(0) for _, pid in ipairs(getPlayersOnline()) do if getCreatureStorage(pid, configPikachuEvent.storages.player) > 0 then doCreatureSetStorage(pid, configPikachuEvent.storages.player, -1) doTeleportThing(pid, getTownTemplePosition(getPlayerTown(pid)), true) doCreatureSetStorage(pid, configPikachuEvent.storages.kills, 0) end end doSetStorage(configPikachuEvent.storages.joining, 1) addEvent(doStartPikachuEvent, configPikachuEvent.delayTime * 60 * 1000) return true end ]]> </talkaction> <talkaction words="!stoppikachu" access="5" event="script"> <![CDATA[ domodlib("config_pikachu_event") domodlib("lib_pikachu_event") function onSay(cid, words, param) if getStorage(configPikachuEvent.storages.main) > 0 then doStopPikachuEvent() else doPlayerSendCancel(cid, 'You can not do it if Pikachu Plague Attack is not enabled.') end return true end ]]> </talkaction> <globalevent name="Pikachu_Event_Days" interval="1000" event="script"> <![CDATA[ domodlib("config_pikachu_event") domodlib("lib_pikachu_event") local daysOpen = {} for k, v in pairs(configPikachuEvent.days) do table.insert(daysOpen, k) end function onThink(interval) if isInArray(daysOpen, os.date('%A')) then if isInArray(configPikachuEvent.days[os.date('%A')], os.date('%X', os.time())) then if getStorage(configPikachuEvent.storages.joining) ~= 1 then doStartCountingPikachuEvent(0) for _, pid in ipairs(getPlayersOnline()) do if getCreatureStorage(pid, configPikachuEvent.storages.player) > 0 then doCreatureSetStorage(pid, configPikachuEvent.storages.player, -1) doTeleportThing(pid, getTownTemplePosition(getPlayerTown(pid)), true) doCreatureSetStorage(pid, configPikachuEvent.storages.kills, 0) end end doSetStorage(configPikachuEvent.storages.joining, 1) addEvent(doStartPikachuEvent, configPikachuEvent.delayTime * 60 * 1000) end end end return true end ]]> </globalevent> <event type="statschange" name="Pikachu_Event_Dead" event="script"> <![CDATA[ domodlib("config_pikachu_event") function onStatsChange(cid, attacker, type, combat, value) if type == 1 and getCreatureHealth(cid) <= value then if isInRange(getThingPos(cid), configPikachuEvent.room.from, configPikachuEvent.room.to) then if isPlayer(cid) then doCreatureAddHealth(cid, getCreatureMaxHealth(cid) - getCreatureHealth(cid)) doCreatureAddMana(cid, getCreatureMaxMana(cid) - getCreatureMana(cid)) doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid))) doPlayerSendTextMessage(cid, MESSAGE_EVENT_ORANGE, 'You loss due to attack.') doSendAnimatedText(getThingPos(cid), value, TEXTCOLOR_RED) doSendMagicEffect(getThingPos(cid), CONST_ME_TELEPORT) doCreatureSetStorage(cid, configPikachuEvent.storages.kills, 0) return false end end elseif configPikachuEvent.players.pvpEnabled ~= true and isInArray({1,3}, type) and isPlayer(attacker) and isPlayer(cid) then if isInRange(getThingPos(cid), configPikachuEvent.room.from, configPikachuEvent.room.to) then return false end end return true end ]]> </event> <event type="kill" name="Pikachu_Event_Kill" event="script"> <![CDATA[ domodlib("config_pikachu_event") function onKill(cid, target, damage, flags) if isInRange(getThingPos(cid), configPikachuEvent.room.from, configPikachuEvent.room.to) then if isInArray(configPikachuEvent.monsters, getCreatureName(target)) then doCreatureSetStorage(cid, configPikachuEvent.storages.kills, math.max(0, getCreatureStorage(cid, configPikachuEvent.storages.kills) + 1)) end end return true end ]]> </event> <event type="login" name="Pikachu_Event_Login" event="script"> <![CDATA[ domodlib("config_pikachu_event") function onLogin(cid) if getCreatureStorage(cid, configPikachuEvent.storages.player) > 0 then doCreatureSetStorage(cid, configPikachuEvent.storages.player, -1) doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)), true) doCreatureSetNoMove(cid, false) doRemoveCondition(cid, CONDITION_INFIGHT) doCreatureSetStorage(cid, configPikachuEvent.storages.player.kills, 0) end registerCreatureEvent(cid, 'Pikachu_Event_Dead') registerCreatureEvent(cid, 'Pikachu_Event_Kill') return true end ]]> </event> <globalevent name="Pikachu_Event_Start" type="startup" event="script"> <![CDATA[ domodlib("config_pikachu_event") function onStartup() doSetStorage(configPikachuEvent.storages.main, -1) doSetStorage(configPikachuEvent.storages.joining, -1) return true end ]]> </globalevent> </mod> Salve e feche. Em data/monsters/monster.xml adicione a linha: <monster name="Pikachu" file="pikachu"/> Em data/monters/scripts crie um arquivo com o nome de pikachu.xml com o conteúdo: <?xml version="1.0" encoding="UTF-8"?> <monster name="Pikachu" nameDescription="Pikachu" race="undead" experience="10500" speed="800" manacost="0"> <health now="200000" max="200000"/> <look type="88" head="20" body="30" legs="40" feet="50" corpse="6031"/> <targetchange interval="10000" chance="10"/> <strategy attack="100" defense="0"/> <flags> <flag summonable="1"/> <flag attackable="1"/> <flag hostile="1"/> <flag illusionable="1"/> <flag convinceable="1"/> <flag pushable="0"/> <flag canpushitems="1"/> <flag canpushcreatures="1"/> <flag targetdistance="1"/> <flag staticattack="90"/> <flag runonhealth="0"/> </flags> <attacks> <attack name="melee" interval="1200" range="1" min="-2000" max="-5000"/> </attacks> <defenses armor="25" defense="30"> </defenses> <voices interval="5000" chance="10"> <voice sentence="PIKAAAA PIKAAAAAA CHU DE ABSOLUTE."/> <voice sentence="PIKACHU EU ESCOLHO VC."/> </voices> <loot> <item id="2160" countmax="1" chance="50000"/> </loot> </monster> Crie a sprite a seu gosto. Explicação básica: position = {x=890,y=193,z=7}, -- Aqui a posição do centro da sua ARENA PIKACHU! from = {x=678,y=980,z=7}, -- Posição do final do canto esquerdo da sua arena to = {x=678,y=1089,z=7} -- Posição do final do canto direito da sua arena rewards = {7958, 11366}, -- Aqui a recompensa que o último player que restar na arena vai ganhar, no caso é RANDOM (ALEATÓRIA), pode ser ou um ou outro, caso queira deixar apenas uma recompensa deixe: rewards = {7958} players = { max = 50, -- Máximo de players que poderão participar min = 2, -- Mínimo de players pra começar o evento, claro 2 ou mais. minLevel = 50, -- level mínimo pra entrar no evento pvpEnabled = false -- PVP DESATIVADO DENTRO DA ARENA, para ativar deixe = true. days = { ['Tuesday'] = {'22:00:00'} -- Dias e hora que ocorrerão o evento automático. (ENGLISH) - Aí no caso está para terça-feira ás 22h (Lembrando que tem de ser o horário da máquina). Para dar inicio ao evento manualmente, basta digitar com o seu ADM: !startpikachu Então os players irão digitar !pikachu para participar. Observação: O Comando só pode ser executado sem battle e em área PZ (Pós usar o player ficará imóvel esperando o evento começar) Quando começa Absolute? - Quando atingir o número máximo de players ou 5 minutos. Observação: Crie um map do seu estilo, como quiser e comfigure com as posições. Caso tenha críticas construtivas, poste. Lembrando que fiz este evento devido a pedidos que houve nas seções destinadas de scripting. Qualquer dúvida não deixe de perguntar, ninguém nasceu sabendo Créditos: - Virrages (Event Base) - Absolute (Modificação, funções, adaptações e transformação) Espero ver este evento em vários derivados. Abraços! Absolute. fiz o mapa, vou testar Rep +
Postado Dezembro 22, 2016 8 anos DESCULPEM POR REVIVER O TÓPICO, MAS PRECISO DE AJUDA. Então @Absolute, eu tentei usar o seu script no meu servidor (PDA) e acabou dando esse error, você poderia me ajudar ou me dizer pq aconteceu isso? Spoiler > Loading pikachuevent.xml...[Error - ScriptingManager::loadFromXml] Cannot load mod mods/pikachuevent.xml Line: 44, Info: Input is not proper UTF-8, indicate encoding ! Bytes: 0xE7 0x6F 0x75 0x2C failed! @login12, @Subyth se algum de vocês poderem me ajudar também agradeço Editado Dezembro 22, 2016 8 anos por Arthasz Walker (veja o histórico de edições)
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.