-
Total de itens
482 -
Registro em
-
Última visita
-
Dias Ganhos
38
Posts postados por Dwarfer
-
-
@ADM Alef Como sugestão, uma solução mais rápida, para não precisar fazer isso em todos os NPCS: apenas troque o "cost" para false
O que era assim:
travelKeyword:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = true, cost = cost, discount = 'postman', destination = destination}, nil, action)
Fica assim:
travelKeyword:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = true, cost = false, discount = 'postman', destination = destination}, nil, action)
-
Coloquei a fórmula da magia como no exura sio que você deixou. Qualquer coisa é só trocar a fórmula ali como você quiser.
local spellConfig = { healCount = 12, -- número de vezes que vai curar healInterval = 75 -- intervalo da cura em milisegundos } local combat = Combat() combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_HEALING) combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE) combat:setParameter(COMBAT_PARAM_AGGRESSIVE, 0) combat:setParameter(COMBAT_PARAM_DISPEL, CONDITION_PARALYZE) function onGetFormulaValues(player, level, maglevel) local div = 1 / spellConfig.healCount local min = div * ((level / 5) + (maglevel * 10)) local max = div * ((level / 5) + (maglevel * 14)) return min, max end combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues") local function sendHealingEffect(cid, var, target, healcounter) local player = Player(cid) if not player then return end local targetPlayer = Player(target) if not targetPlayer then return end combat:execute(player, var) local targetPos = targetPlayer:getPosition() local randPos = Position(targetPos.x + math.random(-4, 3), targetPos.y + math.random(-3, 2), targetPos.z) randPos:sendMagicEffect(CONST_ME_ASSASSIN) randPos:sendDistanceEffect(targetPos, CONST_ANI_SMALLHOLY) targetPos:sendMagicEffect(CONST_ME_MAGIC_BLUE) if healcounter == 0 then targetPos:sendMagicEffect(CONST_ME_HOLYAREA) end end function onCastSpell(creature, var) local target = Player(var:getNumber()) if not target then return end local healcounter, interval = spellConfig.healCount, spellConfig.healInterval local playerId = creature:getId() local targetId = target:getId() creature:say(string.format('Brothers, heal %s now!', target:getName()), TALKTYPE_MONSTER_SAY) for i = 1, healcounter do addEvent(sendHealingEffect, (i-1) * interval, playerId, var, targetId, healcounter - i) end return false end
Pega a tag do exura sio no spells.xml e coloca para sua magia.
Vai ficar assim:
-
Pelo que entendi da sua magia, já que não tive como testar, primeiro é recomendável que você adicione na tag da magia no spells.xml o seguinte:
needweapon="1"
Para que não dê mais erros, deixe a magia assim:
Dessa maneira, caso o player desequipe a arma ou troque o tipo de arma em relação ao tipo que estava equipado quando soltou a magia (ex.: solta com sword e depois equipa um axe), a magia vai parar. Lembrando que do jeito que sua magia está, ele ainda vai poder desequipar a arma e caso volte a equipá-la dentro do tempo de duração da magia, a magia voltará a atacar. Não sei se isso foi proposital, se é pra funcionar assim mesmo...
Ajuste o tempo de duração da magia com o cooldown para soltar novamente e vai funcionar corretamente.
-
local leverCooldown = {1, "hour"} -- Configure o tempo para usar novamente. Ex.: {30, "sec"}, {2, "min"}, {5, "hour"}, {3, "day"} local cooldownStorage = 91801 -- só modifique se necessário local items = { {pos = {x = 431, y = 285, z = 7}, itemid = 2129}, {pos = {x = 441, y = 284, z = 7}, itemid = 5943}, {pos = {x = 440, y = 290, z = 7}, itemid = 2363}, } local monsters = { {pos = {x = 436, y = 285, z = 7}, name = "Wolf"}, } local config = { onSpawnMonster = CONST_ME_TELEPORT, -- efeito lançado quando monstro é criado onRemoveItem = CONST_ME_BLOCKHIT, -- efeito lançado quando item é removido missingItem = CONST_ME_POFF, -- efeito lançado quando não encontrou o item para remover } -- 255 faz com que não lance efeito algum local function mathtime(table) -- by dwarfer if table[1] == 0 then return 0 end 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 end function onUse(cid, item, frompos, item2, topos) if getGlobalStorageValue(cooldownStorage) > os.time() then doPlayerSendCancel(cid, "Espere 1h para usar a alavanca novamente.") return true end local missing_items, remove_items = false, {} for _, itemcheck in pairs (items) do local i = getTileItemById(itemcheck.pos, itemcheck.itemid).uid if i < 1 then missing_items = true if tonumber(config.missingItem) and config.missingItem ~= 255 then doSendMagicEffect(itemcheck.pos, config.missingItem) end else table.insert(remove_items, i) end end if missing_items then return doPlayerSendCancel(cid, "Está faltando algum item.") else for _, iuid in pairs (remove_items) do if tonumber(config.onRemoveItem) and config.onRemoveItem ~= 255 then doSendMagicEffect(getThingPos(iuid), config.onRemoveItem) end doRemoveItem(iuid) end for _, monsterinfo in pairs (monsters) do local m = doCreateMonster(monsterinfo.name, monsterinfo.pos, false) if isCreature(m) and tonumber(config.onSpawnMonster) and config.onSpawnMonster ~= 255 then doSendMagicEffect(getThingPos(m), config.onSpawnMonster) end end setGlobalStorageValue(cooldownStorage, mathtime(leverCooldown) + os.time()) end return true end
-
- ####################################### -- ####### Developed by MaXwEllDeN ####### -- ####### Level Points System ####### -- ####### Version: 1.0 ####### -- ####################################### local function addMagLevel(cid, amount) local amount = amount or 1 for i = 1, amount do doPlayerAddSpentMana(cid, getPlayerRequiredMana(cid, getPlayerMagLevel(cid, true) + 1) - getPlayerSpentMana(cid), false) end return true end function onSay(cid, words, param) if not (L_LvlPoints.vocPoints[getPlayerVocation(cid)]) then return false end local param = param:lower() local p2 = string.explode(param, ",") if (getPlayerStorageValue(cid, 14574) < 0) then setPlayerStorageValue(cid, 14574, 0) end local skillids = { ["shielding"] = 5, ["sword"] = 2, ["axe"] = 3, ["club"] = 1, ["distance"] = 4, } if (param == "check") then doPlayerPopupFYI(cid, "~*~*~ Level Points System by MaXwEllDeN ~*~*~\n\nPontos disponíveis: ".. getPlayerStorageValue(cid, 14574) .."\nPontos por level: ".. L_LvlPoints.vocPoints[getPlayerVocation(cid)]) elseif (p2[1] and p2[1] == "add") and (L_LvlPoints.attributes[p2[2]]) and (tonumber(p2[3])) then if (getPlayerStorageValue(cid, 14574) < tonumber(p2[3]) * L_LvlPoints.attributes[p2[2]].np) then doPlayerSendCancel(cid, "Você não tem pontos suficientes para distribuir!") return doSendMagicEffect(getThingPos(cid), 2) end if (p2[2] == "vitalidade") then setCreatureMaxHealth(cid, getCreatureMaxHealth(cid) + L_LvlPoints.attributes[p2[2]].vl * tonumber(p2[3])) doCreatureAddHealth(cid, L_LvlPoints.attributes[p2[2]].vl * tonumber(p2[3])) elseif (p2[2] == "energy") then setCreatureMaxMana(cid, getCreatureMaxMana(cid) + L_LvlPoints.attributes[p2[2]].vl * tonumber(p2[3])) doCreatureAddMana(cid, L_LvlPoints.attributes[p2[2]].vl * tonumber(p2[3])) elseif (p2[2] == "magic" then) addMagLevel(cid, L_LvlPoints.attributes[p2[2]].vl * tonumber(p2[3])) elseif(skillids[p2[2]]) then for a = 1, tonumber(p2[3]) do doPlayerAddSkillTry(cid, skillids[p2[2]], getPlayerRequiredSkillTries(cid, skillids[p2[2]], getPlayerSkillLevel(cid, skillids[p2[2]]) + 1) - getPlayerSkillTries(cid, skillids[p2[2]]), false) end end doSendMagicEffect(getThingPos(cid), 29) doSendMagicEffect(getThingPos(cid), 30) doSendAnimatedText(getThingPos(cid), "-" .. tonumber(p2[3]) * L_LvlPoints.attributes[p2[2]].np, 180) setPlayerStorageValue(cid, 14574, getPlayerStorageValue(cid, 14574) - tonumber(p2[3]) * L_LvlPoints.attributes[p2[2]].np) else local msgx = "" for i, v in pairs(L_LvlPoints.attributes) do local add = (v.np > 1) and "s" or "" msgx = msgx .. string.upper(i:sub(1,1)) .. i:sub(2, #i) .. " - ".. v.np .. " ponto".. add .. " ~ " .. v.vl .. " ".. v.nm .. "\n" end doPlayerPopupFYI(cid, "Pontos necessários para aumentar os stats:\n\n".. msgx .. "\nExemplo de uso: ".. words .." add, vitalidade, 5\n\nPontos disponíveis: ".. getPlayerStorageValue(cid, 14574)) end return true end
- matheuspeixoto12 reagiu a isso
-
1
-
@Lisbeky Não tive como testar, mas se você configurar certinho creio que funcionará.
1. Adicione o NPC
Em data/npc, adicione o arquivo.xml. As falas, o nome do NPC bem como o looktype são apenas para exemplo, configure como quiser.
<?xml version="1.0" encoding="UTF-8"?> <npc name="Ghoster" script="default.lua" walkinterval="2000" floorchange="0"> <health now="100" max="100"/> <look type="48"/> <voices> <voice text="Annnnnnkkkhhhhhhhhh" interval2="50"/> <voice text="Boo!" interval2="50"/> <voice text="Why are you scared?" interval2="50"/> </voices> </npc>
2. Em data/actions/scripts crie um arquivo.lua e cole isto dentro:
No actions.xml adicione a tag e edite o id do item:
<action itemid="1111" script="NOMEDOARQUIVO.lua" />
3. No arquivo do monstro, adicione antes de </monster>, o seguinte:
<script> <event name = "GhostBossDeath"/> </script>
4. Em data/creaturescripts/scripts, crie um arquivo.lua e cole isto dentro:
Edite o storage para os valores da sua quest. Lembrando que só ganharão o storage aqueles que causarem dano ao boss.
No creaturescripts.xml, adicione a tag:
<event type="death" name="GhostBossDeath" event="script" value="NOMEDOARQUIVO.lua"/>
É isso.
-
- Spooky Ghost reagiu a isso
-
1
-
como eu faço pra utilizar a restrição de players ?
digo, nao preciso dos 5 players para fazer, se tiver só 1 ja vai, mas o maximo é 5 mesmo.
local t = { players = { [1] = Position(1,1,1), [2] = Position(1,1,1), [3] = Position(1,1,1), [4] = Position(1,1,1), [5] = Position(1,1,1) }, boss = {name = "Dwarf Guard", create_pos = Position(1,1,1)}, destination = Position(1,1,1), cooldown = {20, "hour"}, storage = 56482 } function onUse(player, item, fromPosition, target, toPosition, isHotkey) local players, tab = {}, t.players for i = 1, #tab do local tile = Tile(tab[i]) if tile then local p = Player(tile:getTopCreature()) if p then if p:getStorageValue(t.storage) <= os.time() then players[#players + 1] = p:getId() end end end end if #players == 0 then player:sendCancelMessage("None of the players did not wait " .. getStrTime(t.cooldown) .. " to go again.") return true end for i = 1, #tab do local playerTile = Tile(tab[i]) local playerToGo = Player(playerTile:getTopCreature()) if playerToGo then if isInArray(players, playerToGo:getId()) then playerToGo:setStorageValue(t.storage, mathtime(t.cooldown) + os.time()) playerTile:relocateTo(t.destination) tab[i]:sendMagicEffect(CONST_ME_POFF) end end end t.destination:sendMagicEffect(CONST_ME_TELEPORT) Game.createMonster(t.boss.name, t.boss.create_pos) item:transform(item.itemid == 1945 and 1946 or 1945) 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 function getStrTime(table) -- by dwarfer local unit = {["sec"] = "second",["min"] = "minute",["hour"] = "hour",["day"] = "day"} return tostring(table[1].." "..unit[table[2]]..(table[1] > 1 and "s" or "")) end
-
Se você utilizar a mesma lib que enviou, o mesmo npc e substituir o script de movements que você tem pelo que eu enviei, vai resolver. Siga o que eu falei aí sobre os uniqueids.
Ele deixa repetir a task, desde que na Lib não esteja com o:
norepeatable = true,
'true' a task não pode ser repetida, 'false' a task pode ser repetida.
Se sair da sala do boss ele não some, mas se outra pessoa foi entrar, o boss que estava lá vai ser removido e será criado outro boss. É assim que está o script que você enviou e que eu acho que dá no mesmo que ele sumir assim que o player sair.
-
local moneyRate = 50 -- % de dinheiro que será perdida local sendMoneyMsg = true -- 'true' para enviar mensagem de quanto dinheiro foi perdido, 'false' para não enviar function onDeath(cid, corpse, killer, frompos) if not isPlayer(cid) then return true end local check_killer = killer[1] local playerKiller = isCreature(check_killer) and (isPlayer(check_killer) and check_killer or getCreatureMaster(check_killer)) or nil if not playerKiller then return true end local victimName, victimLevel, killerName, killerLevel = getPlayerName(cid), getPlayerLevel(cid), getPlayerName(playerKiller), getPlayerLevel(playerKiller) local victimMoney = getPlayerMoney(cid) if victimMoney > 0 then local money = math.ceil(.01 * moneyRate * victimMoney) if money > 0 then doPlayerRemoveMoney(cid, money) doPlayerAddMoney(playerKiller, money) if sendMoneyMsg then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, string.format("You lost %d gold coin%s due to this death.", money, (money > 1 and "s" or ""))) doPlayerSendTextMessage(playerKiller, MESSAGE_STATUS_CONSOLE_ORANGE, string.format("You earned %d gold coin%s for this kill.", money, (money > 1 and "s" or ""))) end end end doBroadcastMessage(string.format("O jogador %s (Level: %d) foi morto pelo jogador %s (Level: %d).", victimName, victimLevel, killerName, killerLevel), MESSAGE_STATUS_CONSOLE_RED) return true end
-
- Guilherme HP reagiu a isso
-
1
-
@guhcast Não fique com dúvidas, pergunte mesmo. Podem ter outras pessoas com a mesma dúvida que a sua.
<stage minlevel="1" maxlevel="7" multiplier="12" /> <stage minlevel="8" maxlevel="50" multiplier="10" /> <stage minlevel="51" maxlevel="80" multiplier="8" /> <stage minlevel="81" maxlevel="100" multiplier="6" /> <stage minlevel="101" maxlevel="140" multiplier="1.5" /> <stage minlevel="141" maxlevel="200" multiplier="0.5" /> <stage minlevel="201" multiplier="0.05" />
Exemplifiquei os três últimos.
-
@nanomeyer, ao que parece você pegou um script qualquer de teleporte para os bosses sem que ele tivesse relação com o sistema de task que você tá utilizando. Por isso não funciona.
Substitua o que tem no arquivo data/movements/scripts/tasks.lua, por esse:
Exemplifiquei para o The Snapper, perceba na linha:
[16691] = {monsters = {"The Snapper"}, telePos = {x = 32610, y = 32724, z = 8}, spawnPos = {x = 32611, y = 32727, z = 8}, from = {x = 32606, y = 32720, z = 8}, to = {x = 32620, y = 32733, z = 8}},
Entre [ ] é o uniqueid que você colocará no teleporte. Esse uniqueid deve ser igual ao storage configurado no arquivo data/lib/104-KillingInTheNameOf.lua:
Veja para a task dos crocodilos:
[3] = {killsRequired = 1, raceName = "Crocodiles", level = {6, 49}, premium = true, creatures = {"crocodile"}, rewards = { {type = "exp", value = {11000}}, {type = "achievement", value = {"Blood-Red Snapper"}}, {type = "storage", value = {16691, 1}}, {type = "points", value = {1}} }},
Em:
{type = "storage", value = {16691, 1}},
Em "value", sempre deixe o segundo valor igual a 1.
Agora é com você pra colocar os storages em uma sequência e deixar os uniqueids mais organizados. Ou então deixa tudo bagunçado mesmo. ?♂️
-
Existem várias maneiras de fazer isso. Uma delas é a seguinte:
No outfits.xml, adicione a storage necessária para que o jogador possua o outfit.
Exemplo:
<outfit id="1" storageId="1111" storageValue="1"> <list gender="0" lookType="136" name="Citizen"/> <list gender="1" lookType="128" name="Citizen"/> </outfit>
Utilizei como exemplo o storage 1111, modifique para o seu.
Em data/creaturescripts/scripts crie um arquivo.lua e cole isto dentro:
local vocations = {1,2,3,4,5,6} -- ids das vocações que terão permissão de utilizar o outfit local storage = 1111 -- storage do outfit (mesmo storage configurado para o outfit no outfits.xml) function onLogin(cid) if getPlayerStorageValue(cid, storage) == 1 then return true end if not isInArray(vocations, getPlayerVocation(cid)) then return true end setPlayerStorageValue(cid, storage, 1) return true end
No creaturescripts.xml, adicione a tag:
<event type="login" name="CitizenLogin" event="script" value="NOMEDOARQUIVO.lua"/>
-
Bom dia,
Apenas alterei o ID da placa e das pedras para as que são da versão original do Tibia.
Porem quando dei use da placa na stone, deu este erro no console:
Obrigado!
Colocou a lib corretamente? Se sim, vê se não tem algum bug de formatação que geralmente tá surgindo ao copiar o conteúdo do fórum e colar.
-
MARAVILHOOOOOOSOS, como vocês estão? Espero que estejam bem. ?
Esses dias fuçando as profundezas sombrias do meu computador encontrei essa quest, a Barbarian Test Quest, do tibia global e agora compartilho-a com vocês. Para quem não conhece, é aquela quest que dá alguns acessos na cidade de Svargrond do tibia global.
Mais informações, visite o link: https://www.tibiawiki.com.br/wiki/Barbarian_Test_Quest
As falas do NPC estão 99% iguais ao do tibia global, salvo algumas pequenas modificações/adaptações feitas por mim dando o meu toque, é claro ?.
(todos gostam do meu toque)Obviamente, a quest se aplica melhor para servidores de tibia clássico, mas deixei os id's dos itens facilmente editáveis para você adaptar para o seu servidor, seja ele de qual tipo for, para TFS 0.4 ou OTX 2.x.Configuração:
1) Em data/lib, crie um arquivo chamado Barbarian Test Quest.lua e cole isto dentro:
2) Em data/npc/scripts, crie um arquivo chamado Sven.lua e cole isto dentro:
O arquivo.xml do NPC Sven, em data/npc é o seguinte:
<?xml version="1.0" encoding="UTF-8"?> <npc name="Sven" script="Sven.lua" walkinterval="2000" floorchange="0"> <health now="100" max="100"/> <look type="143" head="76" body="100" legs="132" feet="97" addons="3" mount="0"/> </npc>
3) Em data/actions/scripts, aconselho criar uma pasta chamada barbarian_test para colocar os arquivos referentes à quest. Dentro dessa pasta, um por um, coloque os arquivos com os nomes abaixo:
bucketmead.lua
meadhorn.lua
mammothpushing.lua
Em data/actions.xml adicione as tags abaixo: (caso altere os ids dos itens para adaptar ao seu servidor, lembre de alterá-los nas tags também)
<action actionid="8952" script="barbarian_test/bucketmead.lua" /> <action itemid="7140;7141" script="barbarian_test/meadhorn.lua" /> <action itemid="7176" script="barbarian_test/mammothpushing.lua" />
Coloque o actionid 8952 (ou o valor que desejar, lembrando de modificar na tag no actions.xml) no balde de rum localizado próximo ao NPC.
Lembre de colocar um NPC adicional ao lado do NPC Sven que venda "rum" para que o jogador possa ficar bêbado e realizar a última missão (missão do mammoth).
OBS: Ao finalizar a quest, o jogador receberá a storage 87345 igual a 1. Essa informação pode ser útil para dar acesso a determinadas áreas somente após terminar a quest, por exemplo.
É isso. Espero que seja útil ao servidores que desejam ter um pouquinho mais de RPG. GRANDE ABRAÇO! ?
Esse script faz parte de um conjunto de quests do tibia global que pretendo ir fazendo aos poucos a depender do feedback do pessoal.
Veja também:
- luanluciano93, Agaka, Pedro. e 1 outro reagiu a isso
-
4
-
- luanluciano93, Pedro. e MatCollier reagiu a isso
-
3
-
-
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 items_needed = {{5922,50},{2492,1},{2488,1},{2536,1},{2123,1}} local outfit_storage = 65535 function outfit(cid, message, keywords, parameters, node) if(not npcHandler:isFocused(cid)) then return false end if getPlayerStorageValue(cid, outfit_storage) ~= -1 then npcHandler:say('You have already received this outfit.', cid) else local total_count, check = #items_needed, true for i = 1, total_count do local itemId, itemCount = items_needed[i][1], items_needed[i][2] if getPlayerItemCount(cid, itemId) < itemCount then check = false break end end if not check then npcHandler:say('You do not have all the items I need to make this outfit.', cid) else for i = 1, total_count do local itemId, itemCount = items_needed[i][1], items_needed[i][2] doPlayerRemoveItem(cid, itemId, itemCount) end doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_GREEN) setPlayerStorageValue(cid, outfit_storage, 1) end end end local node1 = keywordHandler:addKeyword({'outfit'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I need the items, {50 holy orchids, ring of the sky, crown legs, dragon scale mail and medusa shield}. Do you have?.'}) node1:addChildKeyword({'yes'}, outfit, {npcHandler = npcHandler, onlyFocus = true, reset = true}) node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Stop being rude!!!', reset = true}) npcHandler:addModule(FocusModule:new())
-
-
Obviamente, se a vocação que você tá testando pode aprender a magia, já não tem a magia aprendida, o needlearn lá no spells.xml tá igual a 1, vai funcionar. Testei aqui e tá tudo certo, configure corretamente.
-
-
local t = { [128] = {addon1 = true, addon2 = true}, -- [looktype outfit] = {addon1 = 'true' para dar o addon1, 'false' para não dar, addon2 (mesma coisa)} [129] = {addon1 = true, addon2 = true}, } function onUse(player, item, fromPosition, target, toPosition, isHotkey) if player:getStorageValue(10001) == -1 then local check = false for looktype, addontab in pairs(t) do if player:hasOutfit(looktype) then check = true for i = 1, 2 do player:addOutfitAddon(looktype, i == 1 and (addontab.addon1 and 1) or (addontab.addon2 and 2)) end end end if check then player:sendTextMessage(MESSAGE_INFO_DESCR, "You have received new addons!") player:getPosition():sendMagicEffect(CONST_ME_HOLYAREA) end player:setStorageValue(10001, 1) item:transform(item:getId() == 1945 and 1946 or 1945) end return true end
Adicione as demais linhas para os outros looktypes conforme os exemplos.
-
Em data/creaturescripts/scripts, crie um arquivo.lua e cole isto dentro:
local t = { ["rotworm"] = {name = "light", level = 8}, ["dwarf"] = {name = "haste", level = 15}, ["dwarf soldier"] = {name = "heal friend", level = 10} } function onKill(creature, target) local targetMonster = target:getMonster() if not targetMonster then return true end if isSummon(target:getId()) then return true end local m = t[targetMonster:getName():lower()] if not m then return true end local player = creature:getPlayer() if not player then return true end if player:canLearnSpell(m.name) and not player:hasLearnedSpell(m.name) then if player:getLevel() >= m.level then player:learnSpell(m.name) player:getPosition():sendMagicEffect(CONST_ME_HOLYAREA) player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have learnt the spell '" .. m.name .. "'. Open your spellbook and the check the words.") end end return true end
No creaturescripts.xml, adicione a tag:
<event type="kill" name="MonsterSpell" script="NOMEDOARQUIVO.lua" />
Em data/creaturescripts/scripts/login.lua, adicione a linha:
player:registerEvent("MonsterSpell")
Não tive como testar, mas creio que funcionará. Edite o nome do monstro, o nome da magia e o level mínimo para aprender a magia conforme os exemplos que deixei.
(Resolvido)Npc de Troca
em Suporte Tibia OTServer (Resolvidos)
Postado
@isac001