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

Knight Spell REP++

massinha

New Member
Joined
Mar 13, 2019
Messages
31
Reaction score
0
Hey guys, if someone can help me, how can I make a spell, in which it's only available for either knight or vocation 4-8. I don`t want to write her and activate, I want her to be unique to the character without nothing to activate. Well, when the Knight's health is below 30% his total health, he gains 20+ skill for axe, sword and club, can someone please help me? Remembering that I do not want to activate her like 'utito tempo' and I do not want her to have a determinate time, I want her to be the character's when he's below 30% health he gains skill thank you very much.
 
Hey guys, if someone can help me, how can I make a spell, in which it's only available for either knight or vocation 4-8. I don`t want to write her and activate, I want her to be unique to the character without nothing to activate. Well, when the Knight's health is below 30% his total health, he gains 20+ skill for axe, sword and club, can someone please help me? Remembering that I do not want to activate her like 'utito tempo' and I do not want her to have a determinate time, I want her to be the character's when he's below 30% health he gains skill thank you very much.
You need to post what distro version you are using. I'm going to assume you're using the latest because you've been posting in 1.x threads.

You could do something like this:
Lua:
local condition = Condition(CONDITION_ATTRIBUTES)
condition:setParameter(CONDITION_PARAM_TICKS, -1)
condition:setParameter(CONDITION_PARAM_SKILL_MELEE, 20)
condition:setParameter(CONDITION_PARAM_SUBID, 10)
condition:setParameter(CONDITION_PARAM_BUFF_SPELL, true)

function onHealthChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType, origin)
    local health_now, health_max = creature:getHealth(), creature:getMaxHealth()
    if primaryType == COMBAT_HEALING then
        if (health_now + primaryDamage) > math.ceil(health_max * 0.30) then
            creature:removeCondition(CONDITION_ATTRIBUTES, CONDITIONID_COMBAT, 10)
        end
    else
        if (health_now - primaryDamage) > 0 and (health_now - primaryDamage) < math.ceil(health_max * 0.30) then
            if not creature:getCondition(CONDITION_ATTRIBUTES, CONDITIONID_COMBAT, 10) then
                creature:addCondition(condition)
            end
        end
    end
    return primaryDamage, primaryType, secondaryDamage, secondaryType
end

And add this in your login.lua:
Lua:
if isInArray({4, 8}, player:getVocation():getId()) then -- add more vocation id's to array if needed
    player:registerEvent("EVENT NAME HERE")
end
 
Back
Top