Postado Maio 23, 2022 2 anos .Qual servidor ou website você utiliza como base? OTX 2 Qual o motivo deste tópico? Estou adaptando um script que encontrei aqui no forum de Daily Boosted Monster, porém meu server é por rates, e para add a Exp bonus eu vou usar a função ( doPlayerAddExpEx ) , porém, pra eu fazer como eu quero eu preciso que independente do level que está ou qual estage, eu quero uma função que me retorne quanto o monstro deu de EXP quando matei ele, para que eu poder usar mais ou menos da seguinte forma doPlayerAddExpEx(cid, XP QUE GANHEI/100*0.30) , a questão é, QUAL FUNÇÃO USO PARA ME RETORNAR O VALOR QUE GANHEI?
Postado Maio 23, 2022 2 anos local exp = getExperienceStage(getPlayerLevel(cid), getVocationInfo(getPlayerVocation(cid)).experienceMultiplier) local amount = math.floor(getMonsterInfo(string.lower(getCreatureName(target))).experience*exp) doPlayerAddExperience(cid, amount) se quer adicionar em porcentagem, pode ser assim: local percent = 0.25 -- 25% local exp = getExperienceStage(getPlayerLevel(cid), getVocationInfo(getPlayerVocation(cid)).experienceMultiplier) local amount = math.floor(((getMonsterInfo(string.lower(getCreatureName(target))).experience*exp)*percent)) doPlayerAddExperience(cid, amount) [*Ninguém será digno do sucesso se não usar suas derrotas para conquistá-lo.*] DISCORD: vodkart#6090
Postado Maio 23, 2022 2 anos Autor testando nesse momento, dei reload e vou ver o que da, e ja retorno. Caso não de vou lhe mostrar qual script usei aqui, para facilitar o entendimento. 17 minutos atrás, Vodkart disse: local exp = getExperienceStage(getPlayerLevel(cid), getVocationInfo(getPlayerVocation(cid)).experienceMultiplier) local amount = math.floor(getMonsterInfo(string.lower(getCreatureName(target))).experience*exp) doPlayerAddExperience(cid, amount) se quer adicionar em porcentagem, pode ser assim: local percent = 0.25 -- 25% local exp = getExperienceStage(getPlayerLevel(cid), getVocationInfo(getPlayerVocation(cid)).experienceMultiplier) local amount = math.floor(((getMonsterInfo(string.lower(getCreatureName(target))).experience*exp)*percent)) doPlayerAddExperience(cid, amount) o primeiro testei o em porcentagem, o monster do dia acaba a vida e não morre, fica de pé ali, e os demais, morrem, dão loot, mas não dão exp alguma. Agora to reiniciando pra testar o de cima. Em 29/04/2020 em 23:36, 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. o script que estou usando é este, porém ele não estava dando exp alguma... Ai fui modificando até que consegui fazer ele diferenciar os outros monstros do que esta de boost... Mas nao consegui add o bonus até agora. @Vodkart
Postado Maio 24, 2022 2 anos Solução na lib tenta deixar assim: monsters_boosteds = { -- Configuracao dos monstros que irão ter exp e loot aumentados [1] = {monster_name = "Dwarf", exp = 0.05, loot = 7}, [2] = {monster_name = "Goblin", exp = 0.05, loot = 5}, [3] = {monster_name = "Orc", exp = 0.25, loot = 15}, [4] = {monster_name = "Dwarf Soldier", exp = 0.35, loot = 10}, --[5] = {monster_name = "NOME DO MONSTRO", exp = "PORCENTAGEM DE EXP", loot = "PORCENTAGEM DO LOOT"}, } o onKill 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 percent = tonumber(getGlobalStorageValue(74813)) local exp = getExperienceStage(getPlayerLevel(cid), getVocationInfo(getPlayerVocation(cid)).experienceMultiplier) local amount = math.floor(((getMonsterInfo(string.lower(getCreatureName(target))).experience*exp)*percent)) doPlayerAddExperience(cid, amount) addLoot(getCreaturePosition(target), getCreatureName(target), {}) 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 OBS: O EVENTO TEM QUE SER COMEÇADO DE NOVO PARA ATUALIZAR A EXP NA STORAGE, ou seja, testa só depois que dar o boost exp [*Ninguém será digno do sucesso se não usar suas derrotas para conquistá-lo.*] DISCORD: vodkart#6090
Postado Maio 24, 2022 2 anos Autor 1 hora atrás, Vodkart disse: na lib tenta deixar assim: monsters_boosteds = { -- Configuracao dos monstros que irão ter exp e loot aumentados [1] = {monster_name = "Dwarf", exp = 0.05, loot = 7}, [2] = {monster_name = "Goblin", exp = 0.05, loot = 5}, [3] = {monster_name = "Orc", exp = 0.25, loot = 15}, [4] = {monster_name = "Dwarf Soldier", exp = 0.35, loot = 10}, --[5] = {monster_name = "NOME DO MONSTRO", exp = "PORCENTAGEM DE EXP", loot = "PORCENTAGEM DO LOOT"}, } o onKill 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 percent = tonumber(getGlobalStorageValue(74813)) local exp = getExperienceStage(getPlayerLevel(cid), getVocationInfo(getPlayerVocation(cid)).experienceMultiplier) local amount = math.floor(((getMonsterInfo(string.lower(getCreatureName(target))).experience*exp)*percent)) doPlayerAddExperience(cid, amount) addLoot(getCreaturePosition(target), getCreatureName(target), {}) 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 OBS: O EVENTO TEM QUE SER COMEÇADO DE NOVO PARA ATUALIZAR A EXP NA STORAGE, ou seja, testa só depois que dar o boost exp A última ali eu testei e deu mais ou menos certo, só que alguma parte do cálculo ela tá fazendo errado, vou alterar agora as partes que me mandou e ver o que sai… mas já me resolveu parcialmente o problema… acredito que agora vai, vou testar e retorno aqui.
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.