Lopaskurwa
Active Member
- Joined
- Oct 6, 2017
- Messages
- 877
- Solutions
- 2
- Reaction score
- 49
Hello,
how to make that ring deals 5% more COMBAT_ENERGYDAMAGE
TFS 1.2
how to make that ring deals 5% more COMBAT_ENERGYDAMAGE
TFS 1.2
If i do this my name appears on me and creature name appears on creature. Yes we want monster and playerSo 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?)
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,If i do this my name appears on me and creature name appears on creature. Yes we want monster and player
added and still sameso 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)
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
so you added that new id to the table, dont you?added and still same
yes im using energy spell, and i created exact copy of wedding ring just with different id.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
specialRings = {2121, newIdHere},
yes triedso you added that new id to the table, dont you?
Lua:specialRings = {2121, newIdHere},
Like what type of prints? print dmg or what?Well I dont know, it is working here, maybe try adding some prints to the damageRing script
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
the last one I modified, just add some prints like everywhere (lmao) and see where its crashing.Like what type of prints? print dmg or what?
Its weird because this one
increased dmg but gave errors, this one where we use fixed all errors but now it doesnt multiply dmg. Mind fuckCode: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
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.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