Thanks both of you, I will test it now.
Post automatically merged:
It did not work. I change everything you said, and no error appear on the TFS except this:
But then I tried the original script and also doesnt work and appear this error on TFS:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_GREEN)
combat:setParameter(COMBAT_PARAM_AGGRESSIVE, 0)
local protect = Condition(CONDITION_ATTRIBUTES, CONDITIONID_COMBAT)
protect:setParameter(CONDITION_PARAM_SUBID, 56)
protect:setParameter(CONDITION_PARAM_BUFF_SPELL, true)
protect:setParameter(CONDITION_PARAM_TICKS, 5 * 1000)
combat:addCondition(protect)
function onCastSpell(creature, var)
return combat:execute(creature, var)
end
function...
change this line for the amount of seconds, in the protection spelloww, nice. But how do I edit to be just fire and last for 5 seconds?
protect:setParameter(CONDITION_PARAM_TICKS, 10 * 1000)
function onHealthChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType, origin)
if creature and creature:isPlayer() then
if creature:getCondition(CONDITION_ATTRIBUTES, CONDITIONID_COMBAT, 56) then
if primaryType == COMBAT_FIREDAMAGE then
primaryDamage = primaryDamage / 2
end
if secondaryType == COMBAT_FIREDAMAGE then
secondaryDamage = secondaryDamage / 2
end
end
end
return primaryDamage, primaryType, secondaryDamage, secondaryType
end
[Warning] Function Combat.setCondition was renamed to Combat.addCondition and will be removed in the future
[Warning] Function Combat.setCondition was renamed to Combat.addCondition and will be removed in the future
[Warning - Event::checkScript] Event onHealthChange not found. scripts/blockfire.lua
Thanks both of you, I will test it now.
Post automatically merged:
It did not work. I change everything you said, and no error appear on the TFS except this:
But then I tried the original script and also doesnt work and appear this error on TFS:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_GREEN)
combat:setParameter(COMBAT_PARAM_AGGRESSIVE, 0)
local protect = Condition(CONDITION_ATTRIBUTES, CONDITIONID_COMBAT)
protect:setParameter(CONDITION_PARAM_SUBID, 56)
protect:setParameter(CONDITION_PARAM_BUFF_SPELL, true)
protect:setParameter(CONDITION_PARAM_TICKS, 5 * 1000)
combat:addCondition(protect)
function onCastSpell(creature, var)
return combat:execute(creature, var)
end
function onHealthChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType, origin)
if creature and creature:isPlayer() then
if creature:getCondition(CONDITION_ATTRIBUTES, CONDITIONID_COMBAT, 56) then
if primaryType == COMBAT_FIREDAMAGE then
primaryDamage = primaryDamage / 2
end
if secondaryType == COMBAT_FIREDAMAGE then
secondaryDamage = secondaryDamage / 2
end
end
end
return primaryDamage, primaryType, secondaryDamage, secondaryType
end
Try it with prints.No erros on TFS, but it doesn't work. It shows the effect but I still get normal damage. I put "primaryDamage / 100" and "secondaryDamage / 100" just to see if I would get lower damage, but it's just normal damage. Any ideas to what might be going wrong?
function onHealthChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType, origin)
print("--------")
print("script start")
if creature and creature:isPlayer() then
print("is player")
if creature:getCondition(CONDITION_ATTRIBUTES, CONDITIONID_COMBAT, 56) then
print("condition found")
if primaryType == COMBAT_FIREDAMAGE then
print("Primary damage type is FIRE.. reducing damage")
print("Initial damage value: " .. primaryDamage)
primaryDamage = primaryDamage / 2
print("Modified damage value: " .. primaryDamage)
end
if secondaryType == COMBAT_FIREDAMAGE then
print("Secondary damage type is FIRE.. reducing damage")
print("Initial damage value: " .. secondaryDamage)
secondaryDamage = secondaryDamage / 2
print("Modified damage value: " .. secondaryDamage)
end
end
end
return primaryDamage, primaryType, secondaryDamage, secondaryType
end
<event type="healthchange" name="blockfire" script="blockfire.lua"/>
--------
script start
is player
--------
script start
is player
--------
script start
is player
--------
script start
is player
--------
script start
is player
--------
script start
is player
--------
script start
is player
--------
script start
is player
--------
script start
is player
--------
script start
is player
--------
script start
is player
--------
script start
is player
--------
script start
is player
--------
script start
is player
--------
script start
is player
--------
script start
is player
--------
script start
is player
--------
script start
is player
--------
script start
is player
--------
script start
is player
--------
script start
is player
--------
script start
is player
--------
script start
is player
--------
script start
is player
--------
script start
is player
--------
script start
is player
--------
script start
is player
When you are using the spell, are you getting the buff?At creature script:
Tested with the print:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_GREEN)
combat:setParameter(COMBAT_PARAM_AGGRESSIVE, 0)
local protect = Condition(CONDITION_ATTRIBUTES, CONDITIONID_COMBAT)
protect:setParameter(CONDITION_PARAM_SUBID, 56)
protect:setParameter(CONDITION_PARAM_BUFF_SPELL, true)
protect:setParameter(CONDITION_PARAM_TICKS, 50 * 1000)
combat:addCondition(protect)
function onCastSpell(creature, var)
return combat:execute(creature, var)
end
<instant group="attack" spellid="212" name="teste block" words="teste block" level="1" mana="10" direction="1" cooldown="8000" groupcooldown="2000" needlearn="0" script="support/blockfire.lua">
<vocation name="knight" />
</instant>
change your line, for this one
<instant group="attack" spellid="212" name="teste block" words="teste block" level="1" mana="10" selftarget="1" cooldown="8000" groupcooldown="2000" needlearn="0" script="support/blockfire.lua">
<vocation name="knight" />
</instant>