• 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 How to i set reward in this script

_M4G0_

Well-Known Member
Joined
Feb 6, 2016
Messages
504
Solutions
16
Reaction score
98
I have this script for ferumbras quest but i need set setReward for ferumbras mortal,
local bossForms = {
['ascending ferumbras'] = {
text = 'IT\'S NOT THAT EASY MORTALS! FEEL THE POWER OF THE GOD!',
newForm = 'ferumbras soul splinter'
},
['ferumbras soul splinter'] = {
text = 'NOOO! NOW YOU HERETICS WILL FACE MY GODLY WRATH!',
newForm = 'destabilized ferumbras'
},
['destabilized ferumbras'] = {
text = 'YOU ... WILL ... PAY WITH ETERNITY ... OF AGONY!',
newForm = 'ferumbras mortal'
}
}

function onKill(player, target)
local targetMonster = target:getMonster()
if not targetMonster then
return true
end


local name = targetMonster:getName():lower()
local bossConfig = bossForms[name]
if not bossConfig then
return true
end

local found = false
for k, v in ipairs(Game.getSpectators(targetMonster:getPosition())) do
if v:getName():lower() == bossConfig.newForm then
found = true
break
end
end

if not found then
Game.createMonster(bossConfig.newForm, targetMonster:getPosition(), false, true)
player:say(bossConfig.text, TALKTYPE_MONSTER_SAY)
end
return true
end

i tried it
Code:
    if targetMonster == "ferumbras mortal shell" then
    targetMonster:setReward(true)
    end
but not success.
Message "you are not owner" i use tfs 1.2
 
Solution
are you sure that you register the event at the monsters?
also, you can resolve the problem using another type of script "onCreatureAppear" in monsters
in ferumbras mortal shell.xml
Code:
<monster name="Ferumbras Mortal Shell" nameDescription="ferumbras mortal shell" race="venom" experience="xx" speed="x" script="boss.lua"
then you create a folder in data/monsters called scripts
then you create the file boss.lua
Code:
function onCreatureAppear(self, creature)
    if self == creature then
        if self:getType():isRewardBoss() then
            self:setReward(true)
        end
    end
end
you're trying compare the monster user data with a string
Code:
if targetMonster:getName():lower() == "ferumbras mortal shell" then
      targetMonster:setReward(true)
 end
 
are you sure that you register the event at the monsters?
also, you can resolve the problem using another type of script "onCreatureAppear" in monsters
in ferumbras mortal shell.xml
Code:
<monster name="Ferumbras Mortal Shell" nameDescription="ferumbras mortal shell" race="venom" experience="xx" speed="x" script="boss.lua"
then you create a folder in data/monsters called scripts
then you create the file boss.lua
Code:
function onCreatureAppear(self, creature)
    if self == creature then
        if self:getType():isRewardBoss() then
            self:setReward(true)
        end
    end
end
 
Solution
solved using
Code:
<monster name="Ferumbras Mortal Shell" nameDescription="ferumbras mortal shell" race="venom" experience="xx" speed="x" script="boss.lua"

but i have the script boss.lua on monster folder
thanks :D
 
Back
Top