• 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+ Problems with storages, or my movement script.

Eduardo170

Well-Known Member
Joined
Jan 7, 2014
Messages
422
Solutions
3
Reaction score
66
Location
Caracas, Venezuela
I've been fighting with this script that I've been doing all day. If you can help me it would be helpful.
My movement script its work, but when I kill the boss not show me any message.

After try 100 times, I added to thalas.xml and ashmunrah.xml and still.
Code:
<script>
        <event name="BossHota"/>
  </script>
How I get storage?. I used this script from @Znote here
did you added this script to data/scripts?
-Yes, I know that this is a revscript
Code:
-- Boss names(lowercase) and storage key values
local monsterList = {
    ['ashmunrah'] = Storage.Hota.Ashmunrah,
    ['thalas'] = Storage.Hota.Thalas,
    ['rahemos'] = Storage.Hota.Rahemos,
    ['omruc'] = Storage.Hota.Omruc,
    ['marhdis'] = Storage.Hota.Mahrdis,
    ['dipthrah'] = Storage.Hota.Dipthrah,
    ['vashresamun'] = Storage.Hota.Vashresamun,
    ['morguthis'] = Storage.Hota.Morguthis,
}

-- Code to be executed when a player kills something.
local event = CreatureEvent("BossHota")
function event.onKill(creature, target)
    -- This script only cares about kills against configured creature names in above list
    local storage = monsterList[target:getName():lower()]
    if target:isPlayer() or target:getMaster()  or not storage then
        print('storage:'..storage)
        return false
    end

    -- Increase killcount, and make player say it
    local kills = creature:getStorageValue(storage)
    if kills < 1 then
        kills = 1
        creature:say('You slayed ' .. target:getName() .. '.', TALKTYPE_MONSTER_SAY)
    else
        kills = kills + 1
        creature:say('You have slayed ' .. target:getName() .. ' '.. kills ..' times!', TALKTYPE_MONSTER_SAY)
    end

    -- Store killcount for further reference
    creature:setStorageValue(storage, kills)
    return true
end
event:register()

-- Register above MonsterHunter creature events to players when they login
local login = CreatureEvent("BossHota")
function login.onLogin(player)
    player:registerEvent("BossHota")
    return true
end
login:register()


Movement
Code:
local teleports = {
    [2060] = {newPos = Position(1493, 1829, 9), bossname ='Ashmunrah'},
    [2061] = {newPos = Position(1468, 1821, 9), bossname ='Ashmunrah'},
    [2062] = {newPos = Position(1491, 1862, 9), bossname ='Thalas'},
    [2063] = {newPos = Position(1476, 1848, 9), bossname ='Thalas'},
}

function onStepIn(creature, item, position, fromPosition)
    local player = creature:getPlayer()
    if not player then
        return true
    end

    local teleport = teleports[item.uid]
    --Asmunrah
    if item.uid == 2060 then
        if player:getStorageValue(Storage.Hota.Ashmunrah) < 1 then
            player:teleportTo(teleport.newPos)
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'Entering to the '..teleport.bossname..' Room')
            player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
        else
            player:teleportTo(fromPosition)
            player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You had this boss')
        end
    end
    if item.uid == 2061 then
        if player:getStorageValue(Storage.Hota.Ashmunrah) > 1 then
            player:teleportTo(teleport.newPos)
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'Exit to the '..teleport.bossname..' Room')
            player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
        else
            player:teleportTo(fromPosition)
                player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'First your need kill to '..teleport.bossname..'.')
        end
    end
    --Thalas
    if item.uid == 2062 then
        if player:getStorageValue(Storage.Hota.Thalas) < 1 then
            player:teleportTo(teleport.newPos)
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'Entering to the '..teleport.bossname..' Room')
            player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
        else
            player:teleportTo(fromPosition)
            player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You had this boss')
        end
    end
    if item.uid == 2063 then
        if player:getStorageValue(Storage.Hota.Thalas) > 1 then
            player:teleportTo(teleport.newPos)
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'Exit to the '..teleport.bossname..' Room')
            player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
        else
            player:teleportTo(fromPosition)
                player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'First your need kill to '..teleport.bossname..'.')
        end
    end
    return true
end
 
Last edited:
Solution
So what is the problem with the revscriptsys file? It doesn't track the monster?

Could it be you have configured the name wrong in monsterList?

Try this:
Lua:
-- Code to be executed when a player kills something. 
local event = CreatureEvent("MonsterHunter")
function event.onKill(creature, target)
    -- This script only cares about kills against configured creature names in above list
    local storage = monsterList[target:getName():lower()]
    if not storage then
        print("0 - Did not find storage: [".. target:getName():lower() .."] in monsterList.")
    else
        print("1 - Found storage: [".. target:getName():lower() .."] in monsterList. [".. monsterList[target:getName():lower()] .."]")
    end
    if target:isPlayer() or...
so just to confirm this is the part that is not sending on kill


Lua:
if kills < 1 then
        kills = 1
        creature:say('You slayed ' .. target:getName() .. '.', TALKTYPE_MONSTER_SAY)
    else
 
Storage.Hota.Thalas for instance, is a reference to a Storage lua table that keeps track of your storage ID's. Do you have one of these?

This is because it is easier to keep track of a storage table than random id's, like:

player:getStorageValue(Storage.DeeplingsWorldChange.FirstStage)
instead of
player:getStorageValue(25001)

That way, storages are neatly organized in a file, instead of scattered around everywhere in your code. And in case of conflicts, can easily be changed one place to correct issues.
 
Storage.Hota.Thalas for instance, is a reference to a Storage lua table that keeps track of your storage ID's. Do you have one of these?

This is because it is easier to keep track of a storage table than random id's, like:

player:getStorageValue(Storage.DeeplingsWorldChange.FirstStage)
instead of
player:getStorageValue(25001)

That way, storages are neatly organized in a file, instead of scattered around everywhere in your code. And in case of conflicts, can easily be changed one place to correct issues.

Yes, I have. If I didn't have the storage table, it will show me a nill value. The only problem is with that revscript.
Code:
-- STORAGES --
-- (HIGHLY RECOMMENDED -> ONE mission per STORAGE) --
-- Sort it in Values -

    Storage = {
        DemonOak = { --reserved 1015
                    Done = 1010,
                    Progress = 1013,
                    Squares = 1014,

                    AxeBlowsBird = 8288,
                    AxeBlowsLeft = 8289,
                    AxeBlowsRight = 8290,
                    AxeBlowsFace = 8291
                    },
        AnnihilatorDone = 1016,
        TheInquisition = { --reserved  1021
                    Questline = 12160, -- Storage through the Quest
                    EnterTeleport = 1018,
                    Reward = 1019,
                    RewardRoomText = 1020
            },
        Hota = { --reserved 1031
            Done = 1022,
            Ashmunrah = 1023,
            Thalas = 1024,
            Rahemos = 1025,
            Omruc = 1026,
            Mahrdis = 1027,
            Dipthrah = 1028,
            Vashresamun = 1029,
            Morguthis = 1030
            },
        Poi = { --reserved 1041
            WeaponReward = 1032,
            SoftBoots = 1033,
            StuffedDragon = 1034,
            FrozenStarlight = 1035,
            Platinum = 1036,
            BackpackHolding = 1037
            }
            }
 
    GlobalStorage = {    
    FuryGatesReward = 101
    }
 
Last edited:
So what is the problem with the revscriptsys file? It doesn't track the monster?

Could it be you have configured the name wrong in monsterList?

Try this:
Lua:
-- Code to be executed when a player kills something. 
local event = CreatureEvent("MonsterHunter")
function event.onKill(creature, target)
    -- This script only cares about kills against configured creature names in above list
    local storage = monsterList[target:getName():lower()]
    if not storage then
        print("0 - Did not find storage: [".. target:getName():lower() .."] in monsterList.")
    else
        print("1 - Found storage: [".. target:getName():lower() .."] in monsterList. [".. monsterList[target:getName():lower()] .."]")
    end
    if target:isPlayer() or target:getMaster()  or not storage then
        return false
    end

    -- Increase killcount, and make player say it
    local kills = creature:getStorageValue(storage)
    if kills < 1 then
        kills = 1
        creature:say('You slayed ' .. target:getName() .. '.', TALKTYPE_MONSTER_SAY)
    else
        kills = kills + 1
        creature:say('You have slayed ' .. target:getName() .. ' '.. kills ..' times!', TALKTYPE_MONSTER_SAY)
    end

    -- Store killcount for further reference
    creature:setStorageValue(storage, kills)
    return true
end
event:register()

-- Register above MonsterHunter creature events to players when they login
local login = CreatureEvent("RegisterMonsterHunter")
function login.onLogin(player)
    player:registerEvent("MonsterHunter")
    return true
end
login:register()

It should tell you what it tries to search for, and if it finds it in the console when you kill any monster.
 
Solution
Back
Top