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

TFS 1.X+ Tfs 1.2.. when orshabaal have life 50% then summon 2 demmons.

roriscrave

Advanced OT User
Joined
Dec 7, 2011
Messages
1,210
Solutions
35
Reaction score
206
How can I do it?
When the orshabaal has 90% of life, it summon 2 demons ...
when he has 50%, sumona 3 demons ...
when he has 20%, sumona 5 demons ...

Tfs 1.2!
 
Save this as orshSummons.lua in data/creaturescripts/scripts
LUA:
local c = {
    [90] = {count = 2, name = "demon", storage = 90},
    [50] = {count = 3, name = "demon", storage = 50},
    [20] = {count = 5, name = "demon", storage = 20},
}

Boss = {}
local bossName = "orshabaal"

local function percentage(n, p)
    return math.ceil((n * p) / 100)
end

local function getHealthPercent(maxhealth, currenthealth)
    for perc, tble in pairs(c) do
        if percentage(maxhealth, perc) <= currenthealth and not Boss[tble.storage] then
            return tble
        end
    end
    return nil
end

function onHealthChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType, origin)
    if creature and creature:getName():lower() == bossName then
        local health = creature:getHealth()
        if health <= 0 then
            Boss = {}
        else
            local t = getHealthPercent(creature:getMaxHealth(), health)
            if t then
                for i = 1, t.count do
                    doConvinceCreature(doSummonCreature(t.name, creature:getPosition()), creature:getId())
                    Boss[t.storage] = 1
                end
            end
        end
    end
    return primaryDamage, primaryType, secondaryDamage, secondaryType
end

Add this to creaturescripts.xml in data/creaturescripts
XML:
<event type="healthchange" name="orshSummons" script="orshSummons.lua" />
Then add this to the Orshabaal's xml file
XML:
<script>
    <event name="orshSummons"/>
</script>

I have not tested this but if it doesn't work then you will have to fix it yourself because this is how I would make my initial attempt of "how to do it"
Edit: You will also need to make sure Demon's are convinceable
Edit2: made some changes to the script
 
Last edited:
it did not work, if you hit 1 hit in the orshabaal he summon demon.
If the orshabaal heals, he summon again.
Regardless of life, he always summon when taking 1 hit or healing
but I will give you like for trying to help
 
it did not work, if you hit 1 hit in the orshabaal he summon demon.
If the orshabaal heals, he summon again.
Regardless of life, he always summon when taking 1 hit or healing
but I will give you like for trying to help
Try again I forgot a comma in the script & if you 1 hit orsh of course he will skip over the summons
 
I had already added this comma, the error occurs that if you hit 1 damage the orshabaal already summoned, even with life above 90%.
and has another error, let's suppose that the orsha is with 95% of life, when he heales, he also summoned
 
I had already added this comma, the error occurs that if you hit 1 damage the orshabaal already summoned, even with life above 90%.
and has another error, let's suppose that the orsha is with 95% of life, when he heales, he also summoned
remove the summons from orsha's xml file. do I need to hold your hand every step of the way? There is nothing I can do about him healing. You asked for him to summon creatures at different percentages of health and that is what you got. If you are using any other system such as monster levels then this script will not work for you.
 
Back
Top