Postado Abril 29, 2020 5 anos Boas Pessoal do Tibia King Gostaria de adicionar um sistema de Creature boost no meu baiak 8.6 TFS 0.4 Funcionaria da seguinte forma: a cada 24h 1 monstro aleatorio iria dropar mais loot e mais xp do que o normal! Alguem tem ou me pode ajudar com esse sistema? origado pela ajuda desde ja. Citar Algo deste genero! Editado Abril 29, 2020 5 anos por bellatrikz (veja o histórico de edições)
Postado Abril 30, 2020 5 anos Solução @bellatrikz Boa noite, veja se é isso que voce quer data/lib crie um arquivo chamado boostedMonster.lua e cole isto dentro: monster_name_backup = 74812 -- nao mexer monster_exp_backup = 74813 -- nao mexer monster_loot_backup = 74814 -- nao mexer config_boosted = { ["00:00:00"] = { -- Horario de cada dia que irá ocorrer a troca dos monstros pos_monster = {x=161,y=58,z=7, stackpos = 253}, -- a posição aonde ficara o monstro informando a quantidade de exp e loot time_effects = 2 -- tempo em segundos que ficará saindo os efeitos } } monsters_boosteds = { -- Configuracao dos monstros que irão ter exp e loot aumentados [1] = {monster_name = "Dwarf", exp = 5, loot = 7}, [2] = {monster_name = "Goblin", exp = 15, loot = 5}, [3] = {monster_name = "Orc", exp = 25, loot = 15}, [4] = {monster_name = "Dwarf Soldier", exp = 35, loot = 10}, --[5] = {monster_name = "NOME DO MONSTRO", exp = "PORCENTAGEM DE EXP", loot = "PORCENTAGEM DO LOOT"}, } agora em data/globalevents/scripts crie um arquivo chamado boosted.lua e cole isto dentro: function onThink(interval, lastExecution) local current_hour = os.date("%X") if config_boosted[current_hour] then local time = config_boosted[current_hour] local monster = getTopCreature(time.pos_monster).uid local random_monster = monsters_boosteds[math.random(1, #monsters_boosteds)] if (monster >= 1) then doRemoveCreature(monster) end SummonMonster(time, random_monster) setGlobalStorageValue(monster_name_backup, random_monster.monster_name) setGlobalStorageValue(monster_exp_backup, random_monster.exp) setGlobalStorageValue(monster_loot_backup, random_monster.loot) end return true end function SummonMonster(time, monster) doCreateMonster(monster.monster_name, time.pos_monster) effectsMonster(time, monster) end function effectsMonster(time, monster) effectLoot(time.pos_monster, monster) effectExp(time.pos_monster, monster) doSendMagicEffect(time.pos_monster, 30) doSendAnimatedText(time.pos_monster, "Boosted", COLOR_DARKYELLOW) addEvent(function() effectsMonster(time, monster) end, time.time_effects * 1000) end function effectLoot(pos, monster) local pos_effect = {x=pos.x, y=pos.y-1, z=pos.z} doSendMagicEffect(pos_effect, 29) doSendAnimatedText(pos_effect, "Loot +"..monster.loot.."%", COLOR_DARKYELLOW) end function effectExp(pos, monster) local pos_effect = {x=pos.x, y=pos.y+1, z=pos.z} doSendMagicEffect(pos_effect, 29) doSendAnimatedText(pos_effect, "EXP +"..monster.exp.."%", COLOR_DARKYELLOW) end Em globalevents.xml registre esta tag: <globalevent name="boosted" interval="1000" event="script" value="boosted.lua"/> Agora em data/creatureevents/scripts crie um arquivo chamado boosted.lua e cole isto dentro: function onKill(cid, target, damage, flags) if not (isMonster(target)) then return true end if (string.lower(getCreatureName(target)) == string.lower(getGlobalStorageValue(monster_name_backup))) then local exp = tonumber(getGlobalStorageValue(74813)) doPlayerSetRate(cid, SKILL__LEVEL, getExperienceStage(getPlayerLevel(cid))*(getGlobalStorageValue(monster_exp_backup) / 1000)) addLoot(getCreaturePosition(target), getCreatureName(target), {}) else doPlayerSetRate(cid, SKILL__LEVEL, 1) end return true end function addLoot(position, name, ignoredList) local check = false for i = 0, 255 do position.stackpos = i corpse = getTileThingByPos(position) if corpse.uid > 0 and isCorpse(corpse.uid) then check = true break end end if check == true then local newRate = (1 + (getGlobalStorageValue(monster_loot_backup)/100)) * getConfigValue("rateLoot") local mainbp = doCreateItemEx(1987, 1) local monsterLoot = getMonsterLootList(name) for i, loot in pairs(monsterLoot) do if math.random(1, 100000) <= newRate * loot.chance then if #ignoredList > 0 then if (not isInArray(ignoredList, loot.id)) then doAddContainerItem(mainbp, loot.id, loot.countmax and math.random(1, loot.countmax) or 1) end else doAddContainerItem(mainbp, loot.id, loot.countmax and math.random(1, loot.countmax) or 1) end end end doAddContainerItemEx(corpse.uid, mainbp) end end Em creatureevent.xml registre esta tag: <event type="kill" name="BoostedMonster" event="script" value="boosted.lua"/> Por ultimo abra o arquivo login.lua na mesma pasta (creatureevents/scripts) e cole esta linha antes do ultimo return true: registerCreatureEvent(cid, "BoostedMonster") OBS: A explicação de como adicionar os monstros etc.. Esta no arquivo boostedMonster.lua em data/lib.
Postado Abril 30, 2020 5 anos Autor 8 horas atrás, MatteusDeli disse: @bellatrikz Boa noite, veja se é isso que voce quer data/lib crie um arquivo chamado boostedMonster.lua e cole isto dentro: monster_name_backup = 74812 -- nao mexer monster_exp_backup = 74813 -- nao mexer monster_loot_backup = 74814 -- nao mexer config_boosted = { ["00:00:00"] = { -- Horario de cada dia que irá ocorrer a troca dos monstros pos_monster = {x=161,y=58,z=7, stackpos = 253}, -- a posição aonde ficara o monstro informando a quantidade de exp e loot time_effects = 2 -- tempo em segundos que ficará saindo os efeitos } } monsters_boosteds = { -- Configuracao dos monstros que irão ter exp e loot aumentados [1] = {monster_name = "Dwarf", exp = 5, loot = 7}, [2] = {monster_name = "Goblin", exp = 15, loot = 5}, [3] = {monster_name = "Orc", exp = 25, loot = 15}, [4] = {monster_name = "Dwarf Soldier", exp = 35, loot = 10}, --[5] = {monster_name = "NOME DO MONSTRO", exp = "PORCENTAGEM DE EXP", loot = "PORCENTAGEM DO LOOT"}, } agora em data/globalevents/scripts crie um arquivo chamado boosted.lua e cole isto dentro: function onThink(interval, lastExecution) local current_hour = os.date("%X") if config_boosted[current_hour] then local time = config_boosted[current_hour] local monster = getTopCreature(time.pos_monster).uid local random_monster = monsters_boosteds[math.random(1, #monsters_boosteds)] if (monster >= 1) then doRemoveCreature(monster) end SummonMonster(time, random_monster) setGlobalStorageValue(monster_name_backup, random_monster.monster_name) setGlobalStorageValue(monster_exp_backup, random_monster.exp) setGlobalStorageValue(monster_loot_backup, random_monster.loot) end return true end function SummonMonster(time, monster) doCreateMonster(monster.monster_name, time.pos_monster) effectsMonster(time, monster) end function effectsMonster(time, monster) effectLoot(time.pos_monster, monster) effectExp(time.pos_monster, monster) doSendMagicEffect(time.pos_monster, 30) doSendAnimatedText(time.pos_monster, "Boosted", COLOR_DARKYELLOW) addEvent(function() effectsMonster(time, monster) end, time.time_effects * 1000) end function effectLoot(pos, monster) local pos_effect = {x=pos.x, y=pos.y-1, z=pos.z} doSendMagicEffect(pos_effect, 29) doSendAnimatedText(pos_effect, "Loot +"..monster.loot.."%", COLOR_DARKYELLOW) end function effectExp(pos, monster) local pos_effect = {x=pos.x, y=pos.y+1, z=pos.z} doSendMagicEffect(pos_effect, 29) doSendAnimatedText(pos_effect, "EXP +"..monster.exp.."%", COLOR_DARKYELLOW) end Em globalevents.xml registre esta tag: <globalevent name="boosted" interval="1000" event="script" value="boosted.lua"/> Agora em data/creatureevents/scripts crie um arquivo chamado boosted.lua e cole isto dentro: function onKill(cid, target, damage, flags) if not (isMonster(target)) then return true end if (string.lower(getCreatureName(target)) == string.lower(getGlobalStorageValue(monster_name_backup))) then local exp = tonumber(getGlobalStorageValue(74813)) doPlayerSetRate(cid, SKILL__LEVEL, getExperienceStage(getPlayerLevel(cid))*(getGlobalStorageValue(monster_exp_backup) / 1000)) addLoot(getCreaturePosition(target), getCreatureName(target), {}) else doPlayerSetRate(cid, SKILL__LEVEL, 1) end return true end function addLoot(position, name, ignoredList) local check = false for i = 0, 255 do position.stackpos = i corpse = getTileThingByPos(position) if corpse.uid > 0 and isCorpse(corpse.uid) then check = true break end end if check == true then local newRate = (1 + (getGlobalStorageValue(monster_loot_backup)/100)) * getConfigValue("rateLoot") local mainbp = doCreateItemEx(1987, 1) local monsterLoot = getMonsterLootList(name) for i, loot in pairs(monsterLoot) do if math.random(1, 100000) <= newRate * loot.chance then if #ignoredList > 0 then if (not isInArray(ignoredList, loot.id)) then doAddContainerItem(mainbp, loot.id, loot.countmax and math.random(1, loot.countmax) or 1) end else doAddContainerItem(mainbp, loot.id, loot.countmax and math.random(1, loot.countmax) or 1) end end end doAddContainerItemEx(corpse.uid, mainbp) end end Em creatureevent.xml registre esta tag: <event type="kill" name="BoostedMonster" event="script" value="boosted.lua"/> Por ultimo abra o arquivo login.lua na mesma pasta (creatureevents/scripts) e cole esta linha antes do ultimo return true: registerCreatureEvent(cid, "BoostedMonster") OBS: A explicação de como adicionar os monstros etc.. Esta no arquivo boostedMonster.lua em data/lib. Obrigado MatteusDeli era isso mesmo grande ajuda! Funcionou perfeitamente vlw Editado Abril 30, 2020 5 anos por bellatrikz (veja o histórico de edições)
Postado Abril 30, 2020 5 anos Aqui está dando esse erro, pode me ajudar?@MatteusDeli@Edit: Não sei se era algum erro de caractere especiais, mas refiz e ok, abriu a distro porém sem nenhum erro, mas o monstro não está na posição solicitada. Pode me ajudar? Uso otx 0.4 @Editt; Para funcionar, bastou eu alterar o horário de começo invés de edixar 00h, coloquei o horário de teste e funcionou o summon.@EDIT HELP:Tudo certo, as configs, o summon mas não está buffando o monstro, testei xp e o loot continuam o mesmo antes e depois de mostrar a creature boostada, pode ajudar? @MatteusDeli Editado Abril 30, 2020 5 anos por alexpaimel (veja o histórico de edições)
Postado Abril 30, 2020 5 anos @alexpaimel Eu testei no TFS 0.4 pode ser que no OTX não tenha algumas functions usadas no script, deve ser por isso que não esta aumentando a exp e o loot. Tenta dar uma testada em algum server TFS
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.