• 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+ Fury Gates

Raschu

New Member
Joined
Aug 2, 2011
Messages
69
Reaction score
1
Hello All

I have litte problem about fury gates. Everytime when i start up my server i have message Fury gate is in town x but all fury gates is on map in all towns and i cant entry on it please see my furygates.lua maybe you can see what is wrong:

Lua:
function onStartup(interval)

     math.randomseed(os.time())

     local chance = math.random(1, 6)

    if (chance == 1) then -- venore
        setGlobalStorageValue(9710, 1)
        Game.createItem(7853, {x = 32833, y = 32081, z = 7})
        Game.createItem(7851, {x = 32834, y = 32081, z = 7})
        Game.createItem(5066, {x = 32834, y = 32081, z = 7})
        Game.createItem(5066, {x = 32833, y = 32081, z = 7})
        gate1 = Game.createItem(6116, {x = 32834, y = 32081, z = 7})
        doSetItemActionId(gate1, 9710)
        print('>> Fury Gate will be active in venore today.')
    elseif (chance == 2) then -- ab'dendriel
        setGlobalStorageValue(9711, 2)
        Game.createItem(7853, {x = 32679, y = 31719, z = 7})
        Game.createItem(7851, {x = 32680, y = 31719, z = 7})
        Game.createItem(5066, {x = 32680, y = 31719, z = 7})
        Game.createItem(5066, {x = 32679, y = 31719, z = 7})
        gate2 = Game.createItem(6116, {x = 32680, y = 31719, z = 7})
        doSetItemActionId(gate2, 9711)
        print('>> Fury Gate will be active in ab dendriel today.')
    elseif (chance == 3) then -- thais
        setGlobalStorageValue(9712, 3)
        Game.createItem(5064, {x = 32264, y = 32163, z = 7})
        Game.createItem(5064, {x = 32264, y = 32164, z = 7})
        Game.createItem(7852, {x = 32264, y = 32164, z = 7})
        Game.createItem(7853, {x = 32264, y = 32163, z = 7})
        Game.createItem(5064, {x = 32265, y = 32163, z = 7})
        Game.createItem(5064, {x = 32265, y = 32164, z = 7})
        gate3 = Game.createItem(6117, {x = 32264, y = 32164, z = 7})
        doSetItemActionId(gate3, 9712)
        print('>> Fury Gate will be active in  thais today.')
    elseif (chance == 4) then -- carlin
        setGlobalStorageValue(9713, 4)
        Game.createItem(5066, {x = 32262, y = 31848, z = 7})
        Game.createItem(5066, {x = 32263, y = 31848, z = 7})
        Game.createItem(7853, {x = 32262, y = 31848, z = 7})
        Game.createItem(7851, {x = 32263, y = 31848, z = 7})
        gate4 = Game.createItem(6116, {x = 32263, y = 31848, z = 7})
        doSetItemActionId(gate4, 9713)
        print('>> Fury Gate will be active in carlin today.')
    elseif (chance == 5) then -- edron
        setGlobalStorageValue(9714, 5)
        Game.createItem(5066, {x = 33220, y = 31922, z = 7})
        Game.createItem(5066, {x = 33221, y = 31922, z = 7})
        Game.createItem(7853, {x = 33220, y = 31922, z = 7})
        Game.createItem(7851, {x = 33221, y = 31922, z = 7})
        Game.createItem(5066, {x = 33220, y = 31923, z = 7})
        Game.createItem(5066, {x = 33221, y = 31923, z = 7})
        gate5 = Game.createItem(6116, {x = 33221, y = 31922, z = 7})
        doSetItemActionId(gate5, 9714)
        print('>> Fury Gate will be active in edron today.')
    elseif (chance == 6) then -- kazordoon
        setGlobalStorageValue(9716, 6)
        Game.createItem(5066, {x = 32573, y = 31982, z = 7})
        Game.createItem(5066, {x = 32574, y = 31982, z = 7})
        Game.createItem(7853, {x = 32573, y = 31982, z = 7})
        Game.createItem(7851, {x = 32574, y = 31982, z = 7})
        gate6 = Game.createItem(6116, {x = 32574, y = 31982, z = 7})
        doSetItemActionId(gate6, 9716)
        print('>> Fury Gate will be active in kazordoon today.')
    end
    return true
end
 
Solution
If they are already on map why are you creating them again?
On server restart the globalevent will add the portal depending on the generated number and give it an actionid.

your moveevent code uses globalstorage.furygates
your globalevents uses setstorage 9710 etc
change all the setglobalstorages

Lua:
function onStartup(interval)
     math.randomseed(os.time())
     local chance = math.random(1, 6)
    if (chance == 1) then -- venore
        setGlobalStorageValue(GlobalStorage.FuryGates, 1)
        Game.createItem(7853, {x = 32833, y = 32081, z = 7})
        Game.createItem(7851, {x = 32834, y = 32081, z = 7})
        Game.createItem(5066, {x = 32834, y = 32081, z = 7})
        Game.createItem(5066, {x = 32833, y = 32081, z = 7})...
The script you provided is only creating the portal, setting an action id to it and printing which city it is.

Look in your movements.xml and find the script that is used on items with action id from 9710 to 9716 and post that script.

What @namco said isn't going to help you, in fact it can be a bad thing to make that variable not local, so don't do that.
 
it is literally impossible that this is happening unless you have multiple events registered for that 1 script to make the script execute a ton of times for some reason
does it print fury gate active for every single city in console? show screenshot of it
send globalevents.xml
 
Hi Thanks for respond, will be great if that be work, both files is to long so i upload that for you:
also take ss:

asdasd.png

furygates.lua from movements:
Code:
local gates = {
    [9710] = {value = 1, position = Position(32834, 32082, 7)},
    [9711] = {value = 2, position = Position(32680, 31720, 7)},
    [9712] = {value = 3, position = Position(32268, 32162, 7)},
    [9713] = {value = 4, position = Position(32263, 31847, 7)},
    [9714] = {value = 5, position = Position(33221, 31921, 7)},
    [9716] = {value = 6, position = Position(32574, 31981, 7)}
}

local exitPositions = {
    [1] = Position(32834, 32082, 7),
    [2] = Position(32680, 31720, 7),
    [3] = Position(32268, 32162, 7),
    [4] = Position(32263, 31847, 7),
    [5] = Position(33221, 31921, 7),
    [6] = Position(32574, 31981, 7)
}

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

    if isInArray({9710, 9711, 9712, 9713, 9714, 9716}, item.actionid) then
        local gate = gates[item.actionid]
        if not gate then
            return true
        end

        position:sendMagicEffect(CONST_ME_TELEPORT)

        if Game.getStorageValue(GlobalStorage.FuryGates) ~= gate.value then
            player:teleportTo(gate.position)
            gate.position:sendMagicEffect(CONST_ME_TELEPORT)
            return true
        end

        if player:getLevel() < 60 then
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You have to be at least level 60 to enter this gate.')
            player:teleportTo(gate.position)
            gate.position:sendMagicEffect(CONST_ME_TELEPORT)
            return true
        end

        local destination = Position(33290, 31786, 13)
        player:teleportTo(destination)
        destination:sendMagicEffect(CONST_ME_FIREAREA)
    else
        local destination = exitPositions[Game.getStorageValue(GlobalStorage.FuryGates)]
        if not destination then
            return true
        end

        position:sendMagicEffect(CONST_ME_TELEPORT)
        player:teleportTo(destination)
        destination:sendMagicEffect(CONST_ME_FIREAREA)
    end
    return true
end

Many thanks for any help !
 

Attachments

If they are already on map why are you creating them again?
On server restart the globalevent will add the portal depending on the generated number and give it an actionid.

your moveevent code uses globalstorage.furygates
your globalevents uses setstorage 9710 etc
change all the setglobalstorages

Lua:
function onStartup(interval)
     math.randomseed(os.time())
     local chance = math.random(1, 6)
    if (chance == 1) then -- venore
        setGlobalStorageValue(GlobalStorage.FuryGates, 1)
        Game.createItem(7853, {x = 32833, y = 32081, z = 7})
        Game.createItem(7851, {x = 32834, y = 32081, z = 7})
        Game.createItem(5066, {x = 32834, y = 32081, z = 7})
        Game.createItem(5066, {x = 32833, y = 32081, z = 7})
        gate1 = Game.createItem(6116, {x = 32834, y = 32081, z = 7})
        doSetItemActionId(gate1, 9710)
        print('>> Fury Gate will be active in venore today.')
    elseif (chance == 2) then -- ab'dendriel
        setGlobalStorageValue(GlobalStorage.FuryGates, 2)
        Game.createItem(7853, {x = 32679, y = 31719, z = 7})
        Game.createItem(7851, {x = 32680, y = 31719, z = 7})
        Game.createItem(5066, {x = 32680, y = 31719, z = 7})
        Game.createItem(5066, {x = 32679, y = 31719, z = 7})
        gate2 = Game.createItem(6116, {x = 32680, y = 31719, z = 7})
        doSetItemActionId(gate2, 9711)
        print('>> Fury Gate will be active in ab dendriel today.')
    elseif (chance == 3) then -- thais
        setGlobalStorageValue(GlobalStorage.FuryGates, 3)
        Game.createItem(5064, {x = 32264, y = 32163, z = 7})
        Game.createItem(5064, {x = 32264, y = 32164, z = 7})
        Game.createItem(7852, {x = 32264, y = 32164, z = 7})
        Game.createItem(7853, {x = 32264, y = 32163, z = 7})
        Game.createItem(5064, {x = 32265, y = 32163, z = 7})
        Game.createItem(5064, {x = 32265, y = 32164, z = 7})
        gate3 = Game.createItem(6117, {x = 32264, y = 32164, z = 7})
        doSetItemActionId(gate3, 9712)
        print('>> Fury Gate will be active in  thais today.')
    elseif (chance == 4) then -- carlin
        setGlobalStorageValue(GlobalStorage.FuryGates, 4)
        Game.createItem(5066, {x = 32262, y = 31848, z = 7})
        Game.createItem(5066, {x = 32263, y = 31848, z = 7})
        Game.createItem(7853, {x = 32262, y = 31848, z = 7})
        Game.createItem(7851, {x = 32263, y = 31848, z = 7})
        gate4 = Game.createItem(6116, {x = 32263, y = 31848, z = 7})
        doSetItemActionId(gate4, 9713)
        print('>> Fury Gate will be active in carlin today.')
    elseif (chance == 5) then -- edron
        setGlobalStorageValue(GlobalStorage.FuryGates, 5)
        Game.createItem(5066, {x = 33220, y = 31922, z = 7})
        Game.createItem(5066, {x = 33221, y = 31922, z = 7})
        Game.createItem(7853, {x = 33220, y = 31922, z = 7})
        Game.createItem(7851, {x = 33221, y = 31922, z = 7})
        Game.createItem(5066, {x = 33220, y = 31923, z = 7})
        Game.createItem(5066, {x = 33221, y = 31923, z = 7})
        gate5 = Game.createItem(6116, {x = 33221, y = 31922, z = 7})
        doSetItemActionId(gate5, 9714)
        print('>> Fury Gate will be active in edron today.')
    elseif (chance == 6) then -- kazordoon
        setGlobalStorageValue(GlobalStorage.FuryGates, 6)
        Game.createItem(5066, {x = 32573, y = 31982, z = 7})
        Game.createItem(5066, {x = 32574, y = 31982, z = 7})
        Game.createItem(7853, {x = 32573, y = 31982, z = 7})
        Game.createItem(7851, {x = 32574, y = 31982, z = 7})
        gate6 = Game.createItem(6116, {x = 32574, y = 31982, z = 7})
        doSetItemActionId(gate6, 9716)
        print('>> Fury Gate will be active in kazordoon today.')
    end
    return true
end
 
Solution
you mean fury gate will be active in thais today etc?

That should only be on your server output.
If you want to message the player on loginscript check the number in globalstorage.furygates and then display player message.
 
Lua:
local furyGates = {
    [1] = {
        city = 'venore',
        itemsPos = {
            [1] = {itemId = 7853, pos = Position(32833, 32081, 7)},
            [2] = {itemId = 7851, pos = Position(32833, 32081, 7)},
            [3] = {itemId = 5066, pos = Position(32833, 32081, 7)},
            [4] = {itemId = 5066, pos = Position(32833, 32081, 7)}
        },
        teleport = {
            itemId = 6116,
            pos = Position(32834, 32081, 7),
            actionId = 9710
        }
    },
    [2] = {
        city = 'ab dendriel',
        itemsPos = {
            [1] = {itemId = 7853, itemPos = Position(32679, 31719, 7)},
            [2] = {itemId = 7851, itemPos = Position(32680, 31719, 7)},
            [3] = {itemId = 5066, itemPos = Position(32680, 31719, 7)},
            [4] = {itemId = 5066, itemPos = Position(32679, 31719, 7)},
        },
        itemTeleport = {
            itemId = 6116,
            itemPos = Position(32680, 31719, 7),
            actionId = 9711
        }
    },
    [3] = {
        city = 'thais',
        itemsPos = {
            [1] = {itemId = 5064, itemPos = Position(32264, 32163, 7)},
            [2] = {itemId = 5064, itemPos = Position(32264, 32164, 7)},
            [3] = {itemId = 7852, itemPos = Position(32264, 32164, 7)},
            [4] = {itemId = 7853, itemPos = Position(32264, 32163, 7)},
            [5] = {itemId = 5064, itemPos = Position(32265, 32163, 7)},
            [6] = {itemId = 5064, itemPos = Position(32265, 32163, 7)}
        },
        itemTeleport = {
            itemId = 6116,
            itemPos = Position(32264, 32164, 7),
            actionId = 9712
        }
    },
    [4] = {
        city = 'carlin',
        itemsPos = {
            [1] = {itemId = 5066, itemPos = Position(32262, 31848, 7)},
            [2] = {itemId = 5066, itemPos = Position(32263, 31848, 7)},
            [3] = {itemId = 7853, itemPos = Position(32262, 31848, 7)},
            [4] = {itemId = 7851, itemPos = Position(32263, 31848, 7)}
        },
        itemTeleport = {
            itemId = 6116,
            itemPos = Position(32263, 31848, 7),
            actionId = 9713
        }
    },
    [5] = {
        city = 'edron',
        itemsPos = {
            [1] = {itemId = 5066, itemPos = Position(33220, 31922, 7)},
            [2] = {itemId = 5066, itemPos = Position(33221, 31922, 7)},
            [3] = {itemId = 7853, itemPos = Position(33220, 31922, 7)},
            [4] = {itemId = 7851, itemPos = Position(33221, 31922, 7)},
            [5] = {itemId = 5066, itemPos = Position(33220, 31923, 7)},
            [6] = {itemId = 5066, itemPos = Position(33221, 31923, 7)},
        },
        itemTeleport = {
            itemId = 6116,
            itemPos = Position(33221, 31922, 7),
            actionId = 9714
        }
    },
    [6] = {
        city = 'kazordoon',
        itemsPos = {
            [1] = {itemId = 5066, itemPos = Position(32573, 31982, 7)},
            [2] = {itemId = 5066, itemPos = Position(32574, 31982, 7)},
            [3] = {itemId = 7853, itemPos = Position(32573, 31982, 7)},
            [4] = {itemId = 7851, itemPos = Position(32574, 31982, 7)}
        },
        itemTeleport = {
            itemId = 6116,
            itemPos = Position(32574, 31982, 7),
            actionId = 9716
        }
    }
}

function onStartup(interval)
    math.randomseed(os.time())
    local random = furyGates[math.random(1, 6)]

    Game.setStorageValue(GlobalStorage.FuryGates, random)
    for _, item in ipairs(random.itemsPos) do
        Game.createItem(item.itemId, item.pos)
    end

    local gate = Game.createItem(random.teleport.itemId, random.teleport.pos)
    gate:setActionId(random.teleport.actionId)
    print('>> Fury Gate will be active in '.. random.city ..' today.')
    return true
end
 
Last edited:
flav, edron was duplicated in your code. but i like the code being put into the array.
cheers for sharing.
 
Also, you have errors..

line 6 uses pos
yet others use itemPos
same with itemTeleport itemPos as well
 
Back
Top