• 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!

Item that deals 5% more

Lopaskurwa

Active Member
Joined
Oct 6, 2017
Messages
873
Solutions
2
Reaction score
49
Hello,
how to make that ring deals 5% more COMBAT_ENERGYDAMAGE
TFS 1.2
 
So if you do this
Lua:
function Creature:onTargetCombat(target)
    if self and target and target:isCreature() then
        self:say(self:getName(), TALKTYPE_MONSTER_SAY)
        target:say(target:getName(), TALKTYPE_MONSTER_SAY)
    end
    return true
end

I also changed isMonster to isCreature (because we want monsters and players, or nay?)
If i do this my name appears on me and creature name appears on creature. Yes we want monster and player
 
If i do this my name appears on me and creature name appears on creature. Yes we want monster and player
so add the register event below those say functions and make sure you testing with a energy spell (exori vis) and using the ring (I used wedding,
{2121} --- wedding ring)
 
so add the register event below those say functions and make sure you testing with a energy spell (exori vis) and using the ring (I used wedding,
{2121} --- wedding ring)
added and still same
Code:
function Creature:onTargetCombat(target)
    if self and target and target:isCreature() then
    self:say(self:getName(), TALKTYPE_MONSTER_SAY)
    target:say(target:getName(), TALKTYPE_MONSTER_SAY)
    target:registerEvent("ringDamage")
    end
    return true
end
yes im using energy spell, and i created exact copy of wedding ring just with different id.
 
added and still same
Code:
function Creature:onTargetCombat(target)
    if self and target and target:isCreature() then
    self:say(self:getName(), TALKTYPE_MONSTER_SAY)
    target:say(target:getName(), TALKTYPE_MONSTER_SAY)
    target:registerEvent("ringDamage")
    end
    return true
end
yes im using energy spell, and i created exact copy of wedding ring just with different id.
so you added that new id to the table, dont you?
Lua:
specialRings = {2121, newIdHere},
 
Well I dont know, it is working here, maybe try adding some prints to the damageRing script :)
Like what type of prints? print dmg or what?
Its weird because this one
Code:
local specialRings = {2123, 2124}

function onHealthChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType, origin)
  if not attacker then return true end
  local ring = attacker:getSlotItem(CONST_SLOT_RING)
  if creature then
    if primaryType == COMBAT_ENERGYDAMAGE then
      if table.contains(specialRings, ring.itemid) then
        primaryDamage = primaryDamage * 1.05
        print("> Dealing extra damage")
      end
    end
  end
  return primaryDamage, primaryType, secondaryDamage, secondaryType
end
increased dmg but gave errors, this one where we use fixed all errors but now it doesnt multiply dmg. Mind fuck
 
Like what type of prints? print dmg or what?
Its weird because this one
Code:
local specialRings = {2123, 2124}

function onHealthChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType, origin)
  if not attacker then return true end
  local ring = attacker:getSlotItem(CONST_SLOT_RING)
  if creature then
    if primaryType == COMBAT_ENERGYDAMAGE then
      if table.contains(specialRings, ring.itemid) then
        primaryDamage = primaryDamage * 1.05
        print("> Dealing extra damage")
      end
    end
  end
  return primaryDamage, primaryType, secondaryDamage, secondaryType
end
increased dmg but gave errors, this one where we use fixed all errors but now it doesnt multiply dmg. Mind fuck
the last one I modified, just add some prints like everywhere (lmao) and see where its crashing.
 
This should work, if you want the bonus damage to be applied in monsters you will have to register an event aswell.
Lua:
local specialRings = {2123, 2124}

function onHealthChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType, origin)
  if creature and attacker then
    if attacker:isPlayer() then
      local ring = attacker:getSlotItem(CONST_SLOT_RING)
      if ring and primaryType == COMBAT_ENERGYDAMAGE then
        if table.contains(specialRings, ring.itemid) then
          local tmpDamage = primaryDamage
          primaryDamage = primaryDamage * 1.05
          print("> Dealing extra damage | initialDamage: " .. tmpDamage .. " - finalDamage: " .. primaryDamage)
        end
      end
    end
  end
  return primaryDamage, primaryType, secondaryDamage, secondaryType
end
 
This should work, if you want the bonus damage to be applied in monsters you will have to register an event aswell.
Lua:
local specialRings = {2123, 2124}

function onHealthChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType, origin)
  if creature and attacker then
    if attacker:isPlayer() then
      local ring = attacker:getSlotItem(CONST_SLOT_RING)
      if ring and primaryType == COMBAT_ENERGYDAMAGE then
        if table.contains(specialRings, ring.itemid) then
          local tmpDamage = primaryDamage
          primaryDamage = primaryDamage * 1.05
          print("> Dealing extra damage | initialDamage: " .. tmpDamage .. " - finalDamage: " .. primaryDamage)
        end
      end
    end
  end
  return primaryDamage, primaryType, secondaryDamage, secondaryType
end
Works, thanks.
 
Umm also make sure you are checking that it is only applying when damage from a player is happening otherwise even when someone is healing the code will execute. You want to narrow it down perfect for less lag.

nvm just saw the line.....
if ring and primaryType == COMBAT_ENERGYDAMAGE then
 
Hello, I have a similar script as Mr. Westwol but unfortunately lifeleach/manaleach, stops working through this script (every single moster got this creaturescripts), without this script all work fine
 
Back
Top