Apoccalypse
New Member
- Joined
- Apr 15, 2017
- Messages
- 114
- Solutions
- 2
- Reaction score
- 4
Hi guys,
I created in game two special items which gives some extra protection ONLY from monsters.
Everytihing works perfect but I noticed that when item is equiped and the player has active mana shield and even mana is exhaustion, the script does not damage health points of the player.
An example:
Spell damages 1400
Player has 6k MP and has active mana shield ,so;
First hit dealt to us is 1400,next 1400,next 1400,next 1400 and then when 400 MP left, the script just take damge of this 400 MP instead of taking the normal damge which is 400 damge to MP and remains 1000 to HP.
If anyone would take a look on it, that would be great
I created in game two special items which gives some extra protection ONLY from monsters.
Everytihing works perfect but I noticed that when item is equiped and the player has active mana shield and even mana is exhaustion, the script does not damage health points of the player.
An example:
Spell damages 1400
Player has 6k MP and has active mana shield ,so;
First hit dealt to us is 1400,next 1400,next 1400,next 1400 and then when 400 MP left, the script just take damge of this 400 MP instead of taking the normal damge which is 400 damge to MP and remains 1000 to HP.
Lua:
local t = {
reduction1 = 3, -- poniewaz to sie sumuje z ProtectionAll i w sumie daje 7%
reduction2 = 10,
item = 2542,
item = 10309,
}
local storage = 815875 --the storage value used
-- value - [(value*(1-(t.reduction1/100)) + (value*(1-(t.reduction2/100)))]
function onStatsChange(target, attacker, type, combat, value)
local damage = value * (1-(t.reduction1/100))
local damage2 = value * ((t.reduction1 + 4)/100) -- +4 ,poniewaz ProtectionAll daje 4 % odpornosci
local Bothdamage = value * (1-((t.reduction1 + t.reduction2)/100))
local Bothdamage2 = value * ((t.reduction1 + t.reduction2 + 4)/100)
local Handdamage = value * (1-(t.reduction2/100))
local Handdamage2 = value
if isMonster(attacker) and isPlayer(target) and (type == 1 or type == 3) then
print("Statement 1 passed")
if getPlayerStorageValue(target, storage) == -1 then
doPlayerSetStorageValue(target, storage, 1)
if (getPlayerSlotItem(target, CONST_SLOT_LEFT).itemid == 2542 or getPlayerSlotItem(target, CONST_SLOT_RIGHT).itemid == 2542) and getPlayerSlotItem(target, CONST_SLOT_RING).itemid == 10309 then
return false,
doTargetCombatHealth(cid, target, combat, -Bothdamage, -Bothdamage, 255),
doPlayerSendTextMessage(target,MESSAGE_EVENT_DEFAULT, "Tempest Shield and Fire Hand absorbed " ..Bothdamage2.. " of the damge taken by you!"),
doPlayerSetStorageValue(target, storage, -1),
print("Both")
elseif (getPlayerSlotItem(target, CONST_SLOT_LEFT).itemid == 2542 or getPlayerSlotItem(target, CONST_SLOT_RIGHT).itemid == 2542) then
print("Statement 2 passed")
return false,
doTargetCombatHealth(cid, target, combat, -damage, -damage, 255),
doPlayerSendTextMessage(target,MESSAGE_EVENT_DEFAULT, "Tempest Shield spared additional " ..damage2.. " Health Points for you!"),
doPlayerSetStorageValue(target, storage, -1),
print("Tempest")
elseif getPlayerSlotItem(target, CONST_SLOT_RING).itemid == 10309 then
return false,
doTargetCombatHealth(cid, target, combat, -Handdamage, -Handdamage, 255),
doPlayerSendTextMessage(target,MESSAGE_EVENT_DEFAULT, getCreatureName(attacker).. " dealt " ..Handdamage2.. " damage to you!"),
doPlayerSetStorageValue(target, storage, -1),
print("Hand")
end
else
doPlayerSetStorageValue(target, storage, -1)
end
print("true")
end
return true
end
If anyone would take a look on it, that would be great