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

Cant use heal after using buff spell

henkas

Well-Known Member
Joined
Jul 8, 2015
Messages
993
Solutions
5
Reaction score
55
XML:
<instant name="buff" words="buff" selftarget="1" aggressive="0"  lvl="10"     maglv="20"  mana="100" soul="0" exhaustion="30000" enabled="1" script="buffup.lua"></instant>

XML:
<instant name="heal" words="heal" selftarget="1" aggressive="0"  lvl="10"     maglv="10"  mana="50" soul="0" exhaustion="1000" prem="1" enabled="1" script="heal.lua"></instant>

Buff
Lua:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_EFFECT, 28)
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, false)

local condition = createConditionObject(CONDITION_ATTRIBUTES)
condition:setParameter(CONDITION_PARAM_TICKS, 30000)
condition:setParameter(CONDITION_PARAM_SKILL_SWORD, 20)
condition:setParameter(CONDITION_PARAM_SKILL_AXE, 20)
condition:setParameter(CONDITION_PARAM_SKILL_DISTANCE, 20)
condition:setParameter(CONDITION_PARAM_SKILL_SHIELD, 20)
condition:setParameter(CONDITION_PARAM_SKILL_FISHING, 20)
condition:setParameter(CONDITION_PARAM_SKILL_CLUB, 20)
condition:setParameter(CONDITION_PARAM_STAT_MAXHITPOINTS, 500)
condition:setParameter(CONDITION_PARAM_STAT_MAXMANAPOINTS, 500)
condition:setParameter(CONDITION_PARAM_BUFF, true)
setCombatCondition(combat, condition)

function onCastSpell(cid, var)
    return combat:execute(cid, var)
end

Heal
Lua:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_HEALING)
setCombatParam(combat, COMBAT_PARAM_EFFECT, 28)
setCombatParam(combat, COMBAT_PARAM_TARGETCASTERORTOPMOST, 1)
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, 0)
--setCombatFormula(combat, COMBAT_FORMULA_LEVELMAGIC, 1.1, -0, 1.1, 0)

function onGetFormulaValues(cid, level, maglevel)
    min = (level * 10) * 8.5
    max = (level * 10) * 9.5
   
    if min < 250 then
        min = 250
    end

    return min, max
end

setCombatCallback(combat, CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")

function onCastSpell(cid, var)
   doCombat(cid, combat, var)
   return true
end
 
Solution
Don't edit any of the scripts this guy tells you to, restore them to their original form and utilize xml groups instead.
For your healing spell, add the group="healing" tag after <instant
Example with exura vita:
XML:
<instant group="healing" spellid="3" name="Ultimate Healing" words="exura vita"
For your buff spell, use group="support".
Then both of those spells should have completely separate cooldowns for their respective groups, if you use a long cooldown spell in a support group, that support group will be exhausted.
I am not sure, but could the 30000 exhaustion on the buff spell be related? Can you reduce it to 1000 to test and see if that is what is blocking the heal spell?
 
I am not sure, but could the 30000 exhaustion on the buff spell be related? Can you reduce it to 1000 to test and see if that is what is blocking the heal spell?
Yea it is 30000 exhaustion who cause this but the problem that i need it to be that long.
 
so could it be done, put the exhaust at normal 1000, but then, in the function onCastSpell, put an if statement that checks if there is a buff already in place, since your ticks count it down, and if it is in place, report "Sorry, cannot recast buff until it expires" or such sentence.
 
so could it be done, put the exhaust at normal 1000, but then, in the function onCastSpell, put an if statement that checks if there is a buff already in place, since your ticks count it down, and if it is in place, report "Sorry, cannot recast buff until it expires" or such sentence.
But it works with spells tho you can cast them even when exhaustion is 30000 so i dont think if statement is needed, i dont know now how to add that if statement. I heard something about group="X" it helps to separate stuff. Im not sure
 
Sorry for the poor explanation, and also still not sure if this is right. If I understand you, we agree that the 30000 exhaust is what is cause the issue, because when you try to cast heal, you are exhausted.

So what I mean to say is, first lower the exhaust to 1000 as per normal. This will let other spells be cast that have effect. For your buff spell, which you hope cannot be cast again for 30000, to put an if statement that checks the current state of your buff, and if buff is on, return cannot cast.

For example:

Lua:
function onCastSpell(cid, var)

if isInRange(getPlayerPosition(cid), {x = 1272, y = 77, z = 0}, {x = 1461, y = 214, z = 7})
 
 then
    
    doCombat(cid, combat, var)
    
    return false

else
    
    return  doCombat(cid, combat, var)
    
end

end

This is the ultimate healing rune. If a player casts it inside that zone, you get a healing, but the rune charge does not decrease. (The zone is the free no count death pvp arena). So, replace the isinrange if statement, to be basically if conditionbuff is still true, as in it is still counting down the 30000, then do nothing, else cast the buff spell. The actual cast of the spell exhaust is only 1000, so you should be able to cast other spells.

I hope it is clear; sorry if it is wrong. I am not sure what to use to basically do the "if still in buff condition"; is it possible to use the
CONDITION_PARAM_BUFF, true section for it? I am unaware if it resets to not true after the 30000 counts down. Hopefully someone smart comes and saves us!
 
Sorry for the poor explanation, and also still not sure if this is right. If I understand you, we agree that the 30000 exhaust is what is cause the issue, because when you try to cast heal, you are exhausted.

So what I mean to say is, first lower the exhaust to 1000 as per normal. This will let other spells be cast that have effect. For your buff spell, which you hope cannot be cast again for 30000, to put an if statement that checks the current state of your buff, and if buff is on, return cannot cast.

For example:

Lua:
function onCastSpell(cid, var)

if isInRange(getPlayerPosition(cid), {x = 1272, y = 77, z = 0}, {x = 1461, y = 214, z = 7})

then
   
    doCombat(cid, combat, var)
   
    return false

else
   
    return  doCombat(cid, combat, var)
   
end

end

This is the ultimate healing rune. If a player casts it inside that zone, you get a healing, but the rune charge does not decrease. (The zone is the free no count death pvp arena). So, replace the isinrange if statement, to be basically if conditionbuff is still true, as in it is still counting down the 30000, then do nothing, else cast the buff spell. The actual cast of the spell exhaust is only 1000, so you should be able to cast other spells.

I hope it is clear; sorry if it is wrong. I am not sure what to use to basically do the "if still in buff condition"; is it possible to use the
CONDITION_PARAM_BUFF, true section for it? I am unaware if it resets to not true after the 30000 counts down. Hopefully someone smart comes and saves us!
I dont really understand the structure how it should looks then
 
Would it be possible to test this? I am not sure if parameter can be used in such a way.

Lua:
function onCastSpell(cid, var)

if CONDITION_PARAM_BUFF = true
  then
      doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, "You may not cast Buff again yet!")
else
       return  doCombat(cid, combat, var)
   end
end

Of course also to reduce the exhaust from 30000 to 1000 in spell buff. If that does not work, but it is the general idea, just need to find the measure to see if buff is on or not.
Good luck!
 
Would it be possible to test this? I am not sure if parameter can be used in such a way.

Lua:
function onCastSpell(cid, var)

if CONDITION_PARAM_BUFF = true
  then
      doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, "You may not cast Buff again yet!")
else
       return  doCombat(cid, combat, var)
   end
end

Of course also to reduce the exhaust from 30000 to 1000 in spell buff. If that does not work, but it is the general idea, just need to find the measure to see if buff is on or not.
Good luck!
You forgot to add if statement of timer if im not wrong because now it doesnt make sense.
 
Don't edit any of the scripts this guy tells you to, restore them to their original form and utilize xml groups instead.
For your healing spell, add the group="healing" tag after <instant
Example with exura vita:
XML:
<instant group="healing" spellid="3" name="Ultimate Healing" words="exura vita"
For your buff spell, use group="support".
Then both of those spells should have completely separate cooldowns for their respective groups, if you use a long cooldown spell in a support group, that support group will be exhausted.
 
Solution
Don't edit any of the scripts this guy tells you to, restore them to their original form and utilize xml groups instead.
For your healing spell, add the group="healing" tag after <instant
Example with exura vita:
XML:
<instant group="healing" spellid="3" name="Ultimate Healing" words="exura vita"
For your buff spell, use group="support".
Then both of those spells should have completely separate cooldowns for their respective groups, if you use a long cooldown spell in a support group, that support group will be exhausted.
Okay. I though about groups but nobody said anything about it so i though it was dumb idea. Thanks everything works.
 
Thanks Stig! Glad someone who know how it works came, we were fumbling through our best ideas. If there was another spell in support group, is there a way to make it so the exhaust does not effect to it?
 
Thanks Stig! Glad someone who know how it works came, we were fumbling through our best ideas. If there was another spell in support group, is there a way to make it so the exhaust does not effect to it?
No. The purpose of groups is to have a group exhaust for a collection of spells and not others. If you wanted separate cooldowns for spells in the same group you'd be using groups incorrectly.
 
Back
Top