• 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.3] [Revscriptsys] Free Lua scripting service - Post your requests! Let's learn it together!

I'm creating a monster using revscriptsys. The configuration corresponds to the reward boss using rewardboss = "true". But now I need registre script = "rewardboss.lua" , and idk how make this. I think this happens "You are not the owner" because need registre script.lua
 
I'm creating a monster using revscriptsys. The configuration corresponds to the reward boss using rewardboss = "true". But now I need registre script = "rewardboss.lua" , and idk how make this. I think this happens "You are not the owner" because need registre script.lua
I'm not aware of dealing with monsters in revscript, my only thought would be the tag:
Code:
monster.script = rewardboss.lua

But if that doesn't work, I won't be able to help you. :/
 
I'm not aware of dealing with monsters in revscript, my only thought would be the tag:
Code:
monster.script = rewardboss.lua

But if that doesn't work, I won't be able to help you. :/
Don't works, this return a nil value for rewardboss.

Thanks for try help me
 
can you fix this script to get numeric storage?
Lua:
-- Boss names(lowercase) and storage key values
local monsterList = {
    ['medusa'] = 12345
    ['shadowpelt'] = 123456
    ['sharpclaw'] = 1234567
    ['darkfang'] = 12345678
    ['bloodback'] = 123456789
}

-- 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 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()
 
onTime

Lua:
local global_save = GlobalEvent("global_save")

local function ServerSave()
    Game.setGameState(GAME_STATE_SHUTDOWN)
    updateGlobalStorage(DailyReward.storages.lastServerSave, os.time())
end

local function ServerSaveWarning(time)
    local remaningTime = tonumber(time) - 60000
        Game.broadcastMessage("Server is saving game in " .. (remaningTime/60000) .." minute(s). Please logout.", MESSAGE_STATUS_WARNING)
    if remaningTime > 60000 then
        addEvent(ServerSaveWarning, 60000, remaningTime)
    else
        addEvent(ServerSave, 60000)
    end
end

function global_save.onTime(time)
    local remaningTime = 5 * 60000
    Game.broadcastMessage("Server is saving game in " .. (remaningTime/60000) .." minute(s). Please logout.", MESSAGE_STATUS_WARNING)
    addEvent(ServerSaveWarning, 60000, remaningTime)
    return true
end

global_save:time("07:55:00")
global_save:register()
 
I want this script to give storage to all players who attacked "The Mutated Pumpkin" but it gives only to 1 player who killed this monster, is it possible?

Lua:
local mutated_pumpkin_kill = CreatureEvent("KillMutatedPumpkin")

function mutated_pumpkin_kill.onKill(player, target)
    if target:isPlayer() or target:getMaster() then
        return true
    end
    if target:getName() == "The Mutated Pumpkin" then
        local storage = player:getStorageValue(Storage.mutated_pumpkin)
        if storage ~= 1 then
            player:setStorageValue(Storage.mutated_pumpkin, 1)
            player:say('Mozesz uzyc obsidian knife w pomieszczeniu.', TALKTYPE_MONSTER_SAY)
        end
    end
    return true
end

mutated_pumpkin_kill:register()


#edit
I solved problem myself

Lua:
local mutated_pumpkin_kill = CreatureEvent("KillMutatedPumpkin")

function mutated_pumpkin_kill.onKill(player, target)
    if target:isPlayer() or target:getMaster() then
        return true
    end
    if target:getName() == "The Mutated Pumpkin" then
        for cid, damage in pairs(target:getDamageMap()) do
            local participant = Player(cid)
            if participant and participant:isPlayer() then
                local storage = participant:getStorageValue(Storage.mutated_pumpkin)
                if storage ~= 1 then
                    participant:setStorageValue(Storage.mutated_pumpkin, 1)
                    participant:say('Mozesz uzyc obsidian knife w pomieszczeniu.', TALKTYPE_MONSTER_SAY)
                end
            end
        end
    end
    return true
end

mutated_pumpkin_kill:register()
 
Last edited:
TFS 1.3 Simple attack speed on items.xml and fist skille increase attack speed.
 
hey i'm looking for a script to help me get my Djinn quest line finished. I'm stuck on the part where a player need tear of Daraman. when i right click the fountain nothing happen.
 
Can someone explaing what is behind naming this system revscriptsys? :)
 
Can someone explaing what is behind naming this system revscriptsys? :)
It doesn't tell where the original name from OTServ came from, but that's probably the best you get for now
 
It doesn't tell where the original name from OTServ came from, but that's probably the best you get for now
TFS is based on an old version of "OTServ" which is linked to in the TFS readme file in our repository.


They were the first to implement revscriptsys and metatables (earlier than 2012, but it was added to github then).
Have a look at OTServ data/scripts/spells/support/magic_rope.lua to compare similarity.

We adapted Lua metatables in 2014 (TFS 1.0), and revscriptsys in 2019 (TFS 1.3)
 
TFS is based on an old version of "OTServ" which is linked to in the TFS readme file in our repository.


They were the first to implement revscriptsys and metatables (earlier than 2012, but it was added to github then).
Have a look at OTServ data/scripts/spells/support/magic_rope.lua to compare similarity.

We adapted Lua metatables in 2014 (TFS 1.0), and revscriptsys in 2019 (TFS 1.3)
Of course, but you don't get what his question was about. He wanted to know how they (TFS or OTServ) got to the name "revscriptsys" to begin with. I linked him the explanation of how TFS got to it, but who knows how OTServ originally came up with it.

If I had to make a guess, it's rev => revision (different branch/version of OTServ that used this system) and scriptsys => script system because of the dynamic creation of script bindings and objects.
 
hello con i helpme please
Lua:
local flytp = TalkAction("!tp")
TP_MODAL_SYSTEM = {
    id = 1060, -- se nao souber do que se trata, nao mude
    titulo = "Sistema de teleport", -- titulo da janela
    mensagem = "Selecione seu destino abaixo", -- mensagem da janela
   
    tempo = 10, -- Tempo em segundos para o jogador poder utilizar o sistema novamente
   
    -- CONFIG DE HOUSES --
    houses_modal = true, -- se deseja exibir a house do jogador no modal de teleport, true/false
    house_pago = true, -- se o player precisa pagar para se teleportar para a house, true/false
    house_custo = 6000, -- custo do teleport para a house, caso tenha colocado true acima
    -- FIM DE CONFIG DOS HOUSES --
   
    protect_zone = true, -- se o player precisa ta em uma zona segura para utilizar o comando, true/false
   
    msgs = {
        ptz = "Voce precisa esta em uma protect zone para utilizar o sistema de teleport!",
        mny = "Voce nao tem %d gold coins para esta viagem!",
        exh = "Voce precisa esperar %d segundos para utilizar novamente o sistema de teleport!",
    },
   
    locais = {
        [1] = {
            nome = 'Quest', -- Nome do local a ser mostrado na janela
            pago = true, -- caso o jogador tenha que pagar para usar o teleport -> true/false
            custo = 5000, -- custo da viagem, caso tenha colocado true acima
            pos = Position(1300,1164,5) -- Posicao que ira se teleportar. Segue a ordem: X,Y,Z
        },
       
        [2] = {
            nome = 'Depot',
            pago = false,
            custo = 5000,
            pos = Position(121,53,7)
           
        },
       
        [3] = {
            nome = 'Ferreiro',
            pago = true,
            custo = 10000,
            pos = Position(309,677,7)
        },
        -- para adicionar mais, copie a partir do [3] até a linha de cima deste comentario, em seguida, adicione modifique para [4] e assim por diante
    },
   
    locais_wp = {}, -- não mexa
    storage = 44958, -- Storage que irá controlar o tempo para utilizar o sistema novamente
}

local function create_modal(id, title, message, tb, p)
    local wd = ModalWindow(id, title, message)
  
    for i, v in pairs(tb.locais) do
        wd:addChoice(i, v.nome .. ' | custo: ' .. ((v.pago and v.custo) or 0))
    end
   
    local start_tp = #tb.locais
   
    if (TP_MODAL_SYSTEM.houses_modal) then
        local p_house = p:getHouse()
        if (p_house) then
            tb.locais_wp[p:getGuid()] = {}
            table.insert(tb.locais_wp[p:getGuid()], {
                nome = "House",
                pago = tb.house_pago,
                custo = tb.house_custo,
                pos = p_house:getExitPosition()
            })
        end
        if (tb.locais_wp[p:getGuid()]) then
            for i, v in pairs(tb.locais_wp[p:getGuid()]) do
                wd:addChoice(i + start_tp, v.nome .. ' | custo: ' .. ((v.pago and v.custo) or 0))
            end
        end
    end
  
    wd:addButton(101, "Teleport")
    wd:addButton(100, "Cancel")
   
    wd:setDefaultEnterButton(101)
    wd:setDefaultEscapeButton(100)
    return wd 
end

local function check_cond(p)
    if (p:getStorageValue(TP_MODAL_SYSTEM.storage) >= os.time()) then
        p:sendCancelMessage((TP_MODAL_SYSTEM.msgs.exh):format(p:getStorageValue(TP_MODAL_SYSTEM.storage) - os.time()))
        p:getPosition():sendMagicEffect(CONST_ME_POFF)
        return false
    end
   
    if (TP_MODAL_SYSTEM.protect_zone) then
        if not (Tile(p:getPosition()):hasFlag(TILESTATE_PROTECTIONZONE)) then
            p:sendCancelMessage(TP_MODAL_SYSTEM.msgs.ptz)
            p:getPosition():sendMagicEffect(CONST_ME_POFF)
            return false
        end
    end
    return true
end

function flytp.onSay(player, words, param)
    if not (check_cond(player)) then return false end
    player:registerEvent("Modal_tpsystem")
    local window = create_modal(TP_MODAL_SYSTEM.id, TP_MODAL_SYSTEM.titulo, TP_MODAL_SYSTEM.mensagem, TP_MODAL_SYSTEM, player)
    window:sendToPlayer(player)
    player:setStorageValue(TP_MODAL_SYSTEM.storage, os.time() + TP_MODAL_SYSTEM.tempo)
    return true
end

flytp:separator(" ")
flytp:register()
it opens the modal but does not teleport...
pleasee..
 
Does anyone know where to find raceId if it is missing? Example for monster "Werehyaena".
Lua:
monster.raceId = 1142
monster.Bestiary = {
    class = "Lycanthrope",
    race = BESTY_RACE_LYCANTHROPE,
    toKill = 1000,
    FirstUnlock = 50,
    SecondUnlock = 500,
    CharmsPoints = 25,
    Stars = 3,
    Occurrence = 0,
    Locations = "Grimvale underground, were-beasts cave south-west of Edron and in the Last Sanctum east of Cormaya."
        }
 
Lua:
local config = {
    [ITEM_GOLD_COIN] = {changeTo = ITEM_PLATINUM_COIN},
    [ITEM_PLATINUM_COIN] = {changeTo = ITEM_CRYSTAL_COIN, changeBack = ITEM_GOLD_COIN},
    [ITEM_CRYSTAL_COIN] = {changeBack = ITEM_PLATINUM_COIN}
}

local changegold = Action()

function changegold.onUse(player, item, fromPosition, itemEx, toPosition, isHotkey)
    local coin = config[item.itemid]
    if not coin then
        return false
    end

    if coin.changeTo and item.type == 100 then
        item:remove()
        player:addItem(coin.changeTo, 1)
    elseif coin.changeBack then
        item:transform(item.itemid, item.type - 1)
        player:addItem(coin.changeBack, 100)
    else
        return false
    end
    return true
end
changegold:id(2148, 2152, 2160)
changegold:register()
 
Lua:
local config = {
    [ITEM_GOLD_COIN] = {changeTo = ITEM_PLATINUM_COIN},
    [ITEM_PLATINUM_COIN] = {changeTo = ITEM_CRYSTAL_COIN, changeBack = ITEM_GOLD_COIN},
    [ITEM_CRYSTAL_COIN] = {changeBack = ITEM_PLATINUM_COIN}
}

local changegold = Action()

function changegold.onUse(player, item, fromPosition, itemEx, toPosition, isHotkey)
    local coin = config[item.itemid]
    if not coin then
        return false
    end

    if coin.changeTo and item.type == 100 then
        item:remove()
        player:addItem(coin.changeTo, 1)
    elseif coin.changeBack then
        item:transform(item.itemid, item.type - 1)
        player:addItem(coin.changeBack, 100)
    else
        return false
    end
    return true
end
changegold:id(2148, 2152, 2160)
changegold:register()
Thx :)
 
Does anyone know where to find raceId if it is missing? Example for monster "Werehyaena".
Lua:
monster.raceId = 1142
monster.Bestiary = {
    class = "Lycanthrope",
    race = BESTY_RACE_LYCANTHROPE,
    toKill = 1000,
    FirstUnlock = 50,
    SecondUnlock = 500,
    CharmsPoints = 25,
    Stars = 3,
    Occurrence = 0,
    Locations = "Grimvale underground, were-beasts cave south-west of Edron and in the Last Sanctum east of Cormaya."
        }
Yes, you can check it here: SaiyansKing/optimized_forgottenserver (https://github.com/SaiyansKing/optimized_forgottenserver/blob/master/data/for-future/staticdata.txt)
id = raceid, you can't use monsters that aren't on this list because this list is from staticdata client assets file that has hardcoded monsters.
 
Back
Top