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

Lua Creature Script

nefinoo

Carnage.flv
Joined
Sep 11, 2010
Messages
335
Reaction score
24
Location
Lo Mochis, Sinaloa
Someone could help me with a script so that when a monster is killed, it immediately adds another, as if it were about reviving the same monster but now with more life or with a different looktype. I am using tfs 1.3
 

M0ustafa

1337
Support Team
Joined
Mar 4, 2017
Messages
2,404
Solutions
301
Reaction score
984
Location
Egypt
Try this, Not tested
Lua:
function onKill(player, target)
        local hp = 5000
    local targetMonster = target:getMonster()
    if not targetMonster then
        return true
    end
        bossName = targetMonster:getName():lower() == 'BOSSNAME HERE'

    if not bossName then
        return true
    end
    Game.createMonster(bossName, targetMonster:getPosition(), false, true)
        bossName:setMaxHealth(hp)
        bossName:addHealth(hp - monster:getHealth())
        bossName:setOutfit(Outfitnumberhere)
    return true
end
 

Evil Hero

Legacy Member
TFS Developer
Joined
Dec 12, 2007
Messages
1,224
Solutions
23
Reaction score
617
Location
Germany
Just place all of this into a lua file into data/monster/
Lua:
local creatureevent = CreatureEvent("xxx") -- *1

function creatureevent.onDeath(creature, corpse, killer, mostDamageKiller, lastHitUnjustified, mostDamageUnjustified)
    Game.createMonster("MonsterName", creature:getPosition(), false, true)
    return true
end

creatureevent:register()

local mType = MonsterType("MonsterName") -- name of the monster which dies in this case to summon the next.
mType:registerEvent("xxx") -- xxx has to be the same as you put into *1
 
Top