Postado Julho 26, 2018 6 anos Diga em poucas palavras a base utilizada (Nome do servidor ou nome do website). TFS 1.2 Qual erro está surgindo/O que você procura? Meu treino off funciona normalmente, porém, tenho um problema: O skill principal (axe, sword ou club) sobe normalmente, mas o shielding sobe bem mais lento!). Por exemplo: deixei o char treinando off por certo tempo, ele pegou axe 34 e shielding 28! Ou seja, está bem desbalanceado. Segue a baixo o meu training.lua, para caso alguém possa me ajudar a corrigir isso. Você tem o código disponível? Se tiver publique-o aqui: function onLogin(player) local lastLogout = player:getLastLogout() local offlineTime = lastLogout ~= 0 and math.min(os.time() - lastLogout, 86400 * 21) or 0 local offlineTrainingSkill = player:getOfflineTrainingSkill() if offlineTrainingSkill == -1 then player:addOfflineTrainingTime(offlineTime * 1000) return true end player:setOfflineTrainingSkill(-1) if offlineTime < 600 then player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You must be logged out for more than 10 minutes to start offline training.") return true end local trainingTime = math.max(0, math.min(offlineTime, math.min(43200, player:getOfflineTrainingTime() / 1000))) player:removeOfflineTrainingTime(trainingTime * 1000) local remainder = offlineTime - trainingTime if remainder > 0 then player:addOfflineTrainingTime(remainder * 1000) end if trainingTime < 60 then return true end local text = "During your absence you trained for" local hours = math.floor(trainingTime / 3600) if hours > 1 then text = string.format("%s %d hours", text, hours) elseif hours == 1 then text = string.format("%s 1 hour", text) end local minutes = math.floor((trainingTime % 3600) / 60) if minutes ~= 0 then if hours ~= 0 then text = string.format("%s and", text) end if minutes > 1 then text = string.format("%s %d minutes", text, minutes) else text = string.format("%s 1 minute", text) end end text = string.format("%s.", text) player:sendTextMessage(MESSAGE_EVENT_ADVANCE, text) local vocation = player:getVocation() local promotion = vocation:getPromotion() local topVocation = not promotion and vocation or promotion local updateSkills = false if table.contains({SKILL_CLUB, SKILL_SWORD, SKILL_AXE, SKILL_DISTANCE}, offlineTrainingSkill) then local modifier = topVocation:getAttackSpeed() / 1000 updateSkills = player:addOfflineTrainingTries(offlineTrainingSkill, (trainingTime / modifier) / (offlineTrainingSkill == SKILL_DISTANCE and 4 or 2)) elseif offlineTrainingSkill == SKILL_MAGLEVEL then local gainTicks = topVocation:getManaGainTicks() * 2 if gainTicks == 0 then gainTicks = 1 end updateSkills = player:addOfflineTrainingTries(SKILL_MAGLEVEL, trainingTime * (vocation:getManaGainAmount() / gainTicks)) end if updateSkills then player:addOfflineTrainingTries(SKILL_SHIELD, trainingTime / 4) end return true end Otserver Global - Open Tibia angera.servegame.com
Postado Julho 26, 2018 6 anos Solução Na verdade, no global é assim. A ideia é que o shield demore menos pra subir pra recompensar quem não tem mente sã e ainda treina online huaauhu. Se mesmo assim tu quer deixar na msm velocidade, tenta assim: Spoiler function onLogin(player) local lastLogout = player:getLastLogout() local offlineTime = lastLogout ~= 0 and math.min(os.time() - lastLogout, 86400 * 21) or 0 local offlineTrainingSkill = player:getOfflineTrainingSkill() if offlineTrainingSkill == -1 then player:addOfflineTrainingTime(offlineTime * 1000) return true end player:setOfflineTrainingSkill(-1) if offlineTime < 600 then player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You must be logged out for more than 10 minutes to start offline training.") return true end local trainingTime = math.max(0, math.min(offlineTime, math.min(43200, player:getOfflineTrainingTime() / 1000))) player:removeOfflineTrainingTime(trainingTime * 1000) local remainder = offlineTime - trainingTime if remainder > 0 then player:addOfflineTrainingTime(remainder * 1000) end if trainingTime < 60 then return true end local text = "During your absence you trained for" local hours = math.floor(trainingTime / 3600) if hours > 1 then text = string.format("%s %d hours", text, hours) elseif hours == 1 then text = string.format("%s 1 hour", text) end local minutes = math.floor((trainingTime % 3600) / 60) if minutes ~= 0 then if hours ~= 0 then text = string.format("%s and", text) end if minutes > 1 then text = string.format("%s %d minutes", text, minutes) else text = string.format("%s 1 minute", text) end end text = string.format("%s.", text) player:sendTextMessage(MESSAGE_EVENT_ADVANCE, text) local vocation = player:getVocation() local promotion = vocation:getPromotion() local topVocation = not promotion and vocation or promotion local updateSkills = false local modifier = topVocation:getAttackSpeed() / 1000 if table.contains({SKILL_CLUB, SKILL_SWORD, SKILL_AXE, SKILL_DISTANCE}, offlineTrainingSkill) then updateSkills = player:addOfflineTrainingTries(offlineTrainingSkill, (trainingTime / modifier) / (offlineTrainingSkill == SKILL_DISTANCE and 4 or 2)) elseif offlineTrainingSkill == SKILL_MAGLEVEL then local gainTicks = topVocation:getManaGainTicks() * 2 if gainTicks == 0 then gainTicks = 1 end updateSkills = player:addOfflineTrainingTries(SKILL_MAGLEVEL, trainingTime * (vocation:getManaGainAmount() / gainTicks)) end if updateSkills then player:addOfflineTrainingTries(SKILL_SHIELD, (trainingTime / modifier) / 2) end return true end Na verdade, a única parte que eu alterei foi: player:addOfflineTrainingTries(SKILL_SHIELD, trainingTime / 4) A ideia é mudar o segundo parâmetro (estava trainingTime/4, eu pus (trainingTime / modifier) / 2). Quanto maior for o valor dele, mais upará a skill de shield. Editado Julho 26, 2018 6 anos por Mono Singed (veja o histórico de edições)
Postado Julho 26, 2018 6 anos if updateSkills then player:addOfflineTrainingTries(SKILL_SHIELD, trainingTime / 4) end -- /\ -- Em sua função de adicionar SKILL_SHIELD está divindo o valor por 4, tente ir diminuindo o valor... Exemplo: if updateSkills then player:addOfflineTrainingTries(SKILL_SHIELD, trainingTime / 3) end -- OU if updateSkills then player:addOfflineTrainingTries(SKILL_SHIELD, trainingTime / 2) end @amora murder Meus trabalhos: [Movements] TFS 1.1+ Area Hardcore [Movements] TFS 1.1+ Tile Party [Action] TFS 1.1+ Bau diário [Action] TFS 1.1+ Guild Dungeon Lever [Talkactions] TFS 0.3.6 / 0.4 Quest Hunt por Tempo Contato: Discord: Tataboy67#4934
Postado Julho 26, 2018 6 anos Autor @Mono Singed Bom, se no global a ideia é realmente subir mais lentamente o shielding, vou deixar assim mesmo! A questão é que imaginei que fosse um BUG hahaha Muito obrigado pela ajuda! Se quiser tentar me dar uma força no tópico a baixo, ficaria muito grato. Tem quase uma semana que criei e ainda não consegui solucionar. Otserver Global - Open Tibia angera.servegame.com
Postado Julho 26, 2018 6 anos Meus trabalhos: [Movements] TFS 1.1+ Area Hardcore [Movements] TFS 1.1+ Tile Party [Action] TFS 1.1+ Bau diário [Action] TFS 1.1+ Guild Dungeon Lever [Talkactions] TFS 0.3.6 / 0.4 Quest Hunt por Tempo Contato: Discord: Tataboy67#4934
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.