Ir para conteúdo

[0.3.6-0.4] Skills Stages


Crypter

Posts Recomendados

Essa Creaturescript tem como função alterar a rate das Skills nos seus respectivos Niveis.

 

 

Na pasta data\creaturescripts\scripts\ Crie um arquivo chamado:  stagesconfig.lua

 

 

  1. skillConfig = {skill = getConfigValue('rateSkill'), magiclevel = getConfigValue('rateMagic')}
  2. skillStages = {}
  3. -----Explicando: na skill fist a rate sera (8X) do nivel 0 ate o nivel 59 , apos isso sera rate 5 e assim respectivamente
  4. skillStages[SKILL_FIST] = {{0,8},{60,5},{80,3},{100,2}}
  5. skillStages[SKILL_CLUB] = {{0,8},{60,5},{80,2},{100,1}}
  6. skillStages[SKILL_SWORD] = {{0,8},{60,5},{80,2},{100,1}}
  7. skillStages[SKILL_AXE] = {{0,8},{60,5},{80,2},{100,1}}
  8. skillStages[SKILL_DISTANCE] = {{0,8},{60,5},{80,2},{100,1}}
  9. skillStages[SKILL_SHIELD] = {{0,9},{60,8},{80,7},{100,6},{110,3}}
  10. --skillStages[SKILL_FISHING] = {{0,5},{60,4},{80,3},{100,2},{110,1}}
  11. skillStages[SKILL__MAGLEVEL] = {{0,10},{6,5},{15,7},{80,5},{90,2},{99,1}}
  12. showInfoOnAdvance = true -- send player message about skill rate change
  13. showInfoOnLogin = true -- send player message about skill rates when he login
  14.  
  15. function getPlayerSkillRatesText(cid)
  16.  local skillInfo = getPlayerRates(cid)
  17.  return "YOUR RATES: [ Magic Level: " .. skillInfo[SKILL__MAGLEVEL] * skillConfig.magiclevel .. "x || Fist: " .. skillInfo[SKILL_FIST] * skillConfig.skill .. "x | Club: " .. skillInfo[SKILL_CLUB] * skillConfig.skill .. "x |  Sword: " .. skillInfo[SKILL_SWORD] * skillConfig.skill .. "x | Axe: " .. skillInfo[SKILL_AXE] * skillConfig.skill .. "x |  Distance: " .. skillInfo[SKILL_DISTANCE] * skillConfig.skill .. " | Shielding: " .. skillInfo[SKILL_SHIELD] * skillConfig.skill .. "x | Fishing: " .. skillInfo[SKILL_FISHING] * skillConfig.skill .. "x ]"
  18. end

 

 

Na pasta data\creaturescripts\scripts\ Crie um arquivo chamado:   skillstagesadvance.lua

 

 

  1. dofile(getDataDir() .. "creaturescripts/scripts/stagesconfig.lua")
  2.  
  3. function onAdvance(cid, skill, oldLevel, newLevel)
  4.     if(skillStages[skill] ~= nil) then
  5.         local skillRate = 1
  6.         local oldRates = getPlayerRates(cid)
  7.         for i, skillRateInfo in pairs(skillStages[skill]) do
  8.             if(newLevel >= skillRateInfo[1]) then
  9.                 skillRate = skillRateInfo[2]
  10.             else
  11.                 break
  12.             end
  13.         end
  14.         doPlayerSetRate(cid, skill, skillRate)
  15.         if(showInfoOnAdvance and skillRate ~= oldRates[skill]) then
  16.             if(skill >= 0 and skill <= 6) then
  17.                 configRate = skillConfig.skill
  18.             else
  19.                 configRate = skillConfig.magiclevel
  20.             end
  21.             doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, SKILL_NAMES[skill] .. " rate changed from " .. oldRates[skill] * configRate .. "x to " .. skillRate * configRate .. "x. " .. getPlayerSkillRatesText(cid))
  22.         end
  23.     end
  24.     return true
  25. end

 

 

Na pasta data\creaturescripts\scripts\ Crie um arquivo chamado:   skillstageslogin.lua

 

 

 

  1. dofile(getDataDir() .. "creaturescripts/scripts/stagesconfig.lua")
  2.  
  3. function onLogin(cid)
  4.     for skill, skillStage in pairs(skillStages) do
  5.         if(skill >= 0 and skill <= 6) then
  6.             nowSkill = getPlayerSkillLevel(cid, skill)
  7.         else
  8.             nowSkill = getPlayerMagLevel(cid, true)
  9.         end
  10.         for i, skillRateInfo in pairs(skillStage) do
  11.             if(nowSkill >= skillRateInfo[1]) then
  12.                 skillRate = skillRateInfo[2]
  13.             else
  14.                 break
  15.             end
  16.         end
  17.         doPlayerSetRate(cid, skill, skillRate)
  18.     end
  19.     if(showInfoOnLogin) then
  20.         doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, getPlayerSkillRatesText(cid))
  21.     end
  22.     registerCreatureEvent(cid, "SkillStagesAdvance")
  23.     return TRUE
  24. end

 

 

 

Em creaturescripts.xml adicione essas linhas:

  1.  <event type="login" name="SkillStagesLogin" event="script" value="skillstageslogin.lua"/>
  2.     <event type="advance" name="SkillStagesAdvance" event="script" value="skillstagesadvance.lua"/>

 

 

 

Exemplo de configs:

 

skillStages[sKILL_FIST] = {{0,8},{60,5},{80,3},{100,2}}

 

 

Enquanto a skill_fist for 0-59 a rate sera de 8x

Enquanto a skill_fist for 60-79 a rate sera de 8x

Enquanto a skill_fist for 80-100 a rate sera de 8x

 

 

 

 

Creditos:

 

Gesior.pl ( Por desenvolver a script)

Crypter ( por trazer aqui para o xtibia e fazer pequenas alterações)

 

 

 

 

Link para o comentário
Compartilhar em outros sites

×
×
  • Criar Novo...