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

[HELP] Annihilator script

Anyjia

KillaBeez
Joined
Jun 10, 2007
Messages
220
Reaction score
37
Location
Sweden
Hi, im curious if theres any chance to make this quest able only once a day? if so could any kind soul out there please tell me these functions/lines.. Iam using OT-Hire 0.2

Regards.
 
Use addEvent
I am not sure, but would the event not cancel if you reload scripts/restart the server?
I probably would use a global storage to determine if the quest has been done or not, and use a globalevent at a specific time to reset it.
 
I am not sure, but would the event not cancel if you reload scripts/restart the server?
I probably would use a global storage to determine if the quest has been done or not, and use a globalevent at a specific time to reset it.
That would be great. I will be running "real" server saves so I didn't think of it that way :)
 
I am not sure, but would the event not cancel if you reload scripts/restart the server?
I probably would use a global storage to determine if the quest has been done or not, and use a globalevent at a specific time to reset it.
addEvent does not get deleted with /reload

onTopic:
Do you want quest once per day for player or anyone who does the quest first and rest need to wait a day to try race for it again.
Either way use storages. (player or global, depending what you wanted)
If you want to make it safe then save player after changing storage value. Then database will be updated.
 
Code:
local config = {
    requiredLevel = 100,
    daily = false,
    centerDemonRoomPosition = Position(352, 245, 8),
    playerPositions = {
        Position(356, 257, 8),
        Position(355, 257, 8),
        Position(354, 257, 8),
        Position(353, 257, 8)
    },
    newPositions = {
        Position(353, 245, 8),
        Position(352, 245, 8),
        Position(351, 245, 8),
        Position(350, 245, 8)
    },
    demonPositions = {
        Position(350, 243, 8),
        Position(352, 243, 8),
        Position(351, 247, 8),
        Position(353, 247, 8),
        Position(354, 245, 8),
        Position(355, 245, 8)
    }
}


function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if item.itemid == 1946 then
        local storePlayers, playerTile = {}

        for i = 1, #config.playerPositions do
            playerTile = Tile(config.playerPositions[i]):getTopCreature()
            if not playerTile or not playerTile:isPlayer() then
                player:sendTextMessage(MESSAGE_STATUS_SMALL, "You need 4 players.")
                return true
            end

            if playerTile:getLevel() < config.requiredLevel then
                player:sendTextMessage(MESSAGE_STATUS_SMALL, "All the players need to be level ".. config.requiredLevel .." or higher.")
                return true
            end

            storePlayers[#storePlayers + 1] = playerTile
        end

        local specs, spec = Game.getSpectators(config.centerDemonRoomPosition, false, false, 3, 3, 2, 2)
        for i = 1, #specs do
            spec = specs[i]
            if spec:isPlayer() then
                player:sendTextMessage(MESSAGE_STATUS_SMALL, "A team is already inside the quest room.")
                return true
            end

            spec:remove()
        end

        for i = 1, #config.demonPositions do
            Game.createMonster("Demon", config.demonPositions[i])
        end

        local players
        for i = 1, #storePlayers do
            players = storePlayers[i]
            config.playerPositions[i]:sendMagicEffect(CONST_ME_POFF)
            players:teleportTo(config.newPositions[i])
            config.newPositions[i]:sendMagicEffect(CONST_ME_ENERGYAREA)
            players:setDirection(DIRECTION_EAST)
        end
    elseif item.itemid == 1945 then
        if config.daily then
            player:sendTextMessage(MESSAGE_STATUS_SMALL, Game.getReturnMessage(RETURNVALUE_NOTPOSSIBLE))
            return true
        end
    end

    item:transform(item.itemid == 1946 and 1945 or 1946)
    return true
end

You are welcome! :) Just change daily = false to true..

EDIT: I didnt read the distro you were using.. This is working on tfs 1.2. Maybe you can make it work.
 
Back
Top