• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Vocations Balancing [implementation]

_M4G0_

Well-Known Member
Joined
Feb 6, 2016
Messages
464
Solutions
15
Reaction score
81
I tried make it in a better way to configure it so that the damage is changed according to the type of attack...
I think had a result + -, if someone is available to make it safe and better
based
Lua:
local ElementProtect = {
                [COMBAT_FIREDAMAGE] = 5,
                [COMBAT_ICEDAMAGE] = 5,
                [COMBAT_DEATHDAMAGE]  = 5,
                [COMBAT_ENERGYDAMAGE] = 5,
                [COMBAT_EARTHDAMAGE] = 5,
                [COMBAT_HOLYDAMAGE] = 5,
                [COMBAT_PHYSICALDAMAGE] = 2,
}
function onHealthChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType, origin)
  if not creature or not attacker or creature == attacker then
    return primaryDamage, primaryType, secondaryDamage, secondaryType
  end
 
  if creature:isPlayer() and creature:getParty() and attacker:isPlayer() and attacker:getParty() then
    if creature:getParty() == attacker:getParty() then
      return primaryDamage, primaryType, secondaryDamage, secondaryType
    end
  end
    if creature:isPlayer() and attacker:isPlayer() then -- remove attacker:isPlayer() to affect monsters fights
                primaryDamage = math.floor(primaryDamage - (primaryDamage * 0.20)) -- for EK and pallies when they switch to HP
                secondaryDamage = math.floor(secondaryDamage - (secondaryDamage * 0.20)) -- for EK and pallies when they switch to HP
        local damage = (primaryDamage + secondaryDamage)
        if damage < 0 then
             damage = damage * -1
        end
    end
  return primaryDamage, primaryType, secondaryDamage, secondaryType
end

function onManaChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType, origin)
  if not creature or not attacker or creature == attacker then
    return primaryDamage, primaryType, secondaryDamage, secondaryType
  end

  if creature:isPlayer() and creature:getParty() and attacker:isPlayer() and attacker:getParty() then
    if creature:getParty() == attacker:getParty() then
      return primaryDamage, primaryType, secondaryDamage, secondaryType
    end
  end
     -- local protect = 0
    -- for i = 1, #ElementProtect do
         protect = ElementProtect[primaryType] 
    -- end
    print(ElementProtect[primaryType])
    if creature:isPlayer() and attacker:isPlayer() then
    if creature:getVocation():getId() == 3 or creature:getVocation():getId() == 7 then
         primaryDamage = math.floor(primaryDamage - (primaryDamage * 0.07)) -- PALLIES on MP
         secondaryDamage = math.floor(secondaryDamage - (secondaryDamage * 0.07)) -- PALLIES on MP
       else
        primaryDamage = primaryDamage-((primaryDamage * protect)/100) -- MAGES (SORC/DRUID)
        secondaryDamage = secondaryDamage-((secondaryDamage * protect)/100) -- MAGES (SORC/DRUID)
       end
    local damage = (primaryDamage + secondaryDamage)
    if damage < 0 then
      damage = damage * -1
    end
  end
  return primaryDamage, primaryType, secondaryDamage, secondaryType
end
 
Last edited:

Shadow_

Veteran OT User
Joined
Jun 2, 2018
Messages
922
Solutions
30
Reaction score
342
This is only working for attacks on mana for mages, also why you used a for loop for all elements? attack is 100% is an element physical/fire/earth so you can just make it to be protect = ElementProtect[primaryType] it will never be a null, nice way to upgrade it, looking for more modifications, it can be used to create new vocations that are protected by X% from X Element and not only balancing them
 
OP
OP
M

_M4G0_

Well-Known Member
Joined
Feb 6, 2016
Messages
464
Solutions
15
Reaction score
81
This is only working for attacks on mana for mages, also why you used a for loop for all elements? attack is 100% is an element physical/fire/earth so you can just make it to be protect = ElementProtect[primaryType] it will never be a null, nice way to upgrade it, looking for more modifications, it can be used to create new vocations that are protected by X% from X Element and not only balancing them
Yes, for me only for mages:oops:
I used the for, because i dont know another way to make it work😅o_O, thanks for your attention
 
Top