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

Psychonaut's Free Scripting Service [TFS 1.x]

psychonaut

Well-Known Member
Joined
Dec 1, 2017
Messages
75
Solutions
6
Reaction score
56
Like Xikini i'm only gonna take quick scripts and i don't wanna do spells, weapons, raids or monster scripts, websites edits and database queries. Source edits need to be a really small thing(would be very boring to keep cloning TFS repo to test each one). Post in the topic too, no dm.

I wanna reserve this for interesting scripts too and try to detail as much as possible how the script need to work.

Diablo III Rifts idea by Aeronx
Sokoban game, idea by Xikini

ouzZjhG.gif
 
Last edited:
Hello Sir,
I've seen your post of free scripting and here's my request.
I think is a nice idea and would be nice.

ModalWindow - choose level 1 to 70.
Once you select a level, player get teleported to a zone where monsters according to level will spawn.
(Lets say its always the same monster but the monster have less or more HP, Damage, depending on the level you teleport)
You have 15 mins to kill 100 monsters. If you dont do it in time, you lose, tp out.
Once you kill 100 monsters, you win and get a time set like (you finished level 69 in 14 minutes 13 seconds).

(Its mosly like diablo III rifts)

Thank you for your time.
 
Hello Sir,
I've seen your post of free scripting and here's my request.
I think is a nice idea and would be nice.

ModalWindow - choose level 1 to 70.
Once you select a level, player get teleported to a zone where monsters according to level will spawn.
(Lets say its always the same monster but the monster have less or more HP, Damage, depending on the level you teleport)
You have 15 mins to kill 100 monsters. If you dont do it in time, you lose, tp out.
Once you kill 100 monsters, you win and get a time set like (you finished level 69 in 14 minutes 13 seconds).

(Its mosly like diablo III rifts)

Thank you for your time.

It's alone, should check if a player is already in that level? And what do you mean by more damage?
 
Yes, it should check if other players are inside. Yes, monster spawned should have more hp the higher the level. Also attacks should be stronger. (Adding a creaturevent to monsters that increases the damage acording to level chosen, but that part is secondary, most important is hp).
I dont know if its possible to setmaxhealth to a monster spawned through game.createmonster.

If the place to teleport is busy, maybe send player another zone?

Thank you for your time.
 
Sokoban_ani.gif


I'd love to see a recreation of a sokoban puzzle.

I found a gif to make the explanation of the game mechanics more simple.

The player is in an enclosed space, with 'switches' on the floor, that can only be activated by pushing a box on top of them.
When all switches have been pressed, the game is over and you win.

For tibia's implementation,

Players starting location is important.
Players must push a box, by walking into it. (no diagonals allowed.)
Players cannot stand on a box.
The boxes cannot go on top of other boxes, and can't be pushed into the walls.

A more simple option would be to have the players use the box, and drag the player in the direction the box is moving.

Ways in and out of the puzzle.
- A simple teleport to get inside, with a 10 minute timer before the player is kicked from the area, and the puzzle is reset.
- - (to stop the player from destroying the puzzle by accident while teleporting, restrict player movement for 2 seconds.)
- - (countdown timer per 30 seconds visible to player. Last 30 seconds counts down per 5 seconds, and last 5 seconds counts down per 1 second.)
- - (10:00, 9:30, ... 1:00, 0:30, 0:25, ... 0:10, 0:05, 0:04, ... 0:01)
- If the puzzle is solved, teleport player to a reward area, and of course reset the puzzle.

- To leave the area prior to the timer counting to zero, have the player 'double/triple click' any exterior wall.

Anti-cheating safeguards.
- 1 person limit.
- make sure players cannot logout inside the area.
- if server crash, have a safeguard to remove them from the puzzle area.
- Players cannot move the box with their mouse.
- Basically, make the box an immoveable, unpickupable, undraggable, unwalkable, unopenable, untradeable object.. like a wall, that you can only interact with by smashing your body into the side of it. xD
- Players cannot place any object onto the playing surface. (do not destroy the players griefing item attempts. Simply deny them the opportunity to place the items down from their inventory.)

(I can't think of anything else for player griefing, but you might find something while testing that I'm simply forgetting.)

Anyways, that's my idea.

Cheers,

Xikini
 
Hey, I'd like a script to merge 3 items.

You put 3 different items on 3 tiles infront of a lever, when you pull the lever the 2 items on the outer tiles dissapears with some cool effect and the remaining one in the middle gets a unique id and possibly sent to your bag idk.

Thanks. :d
 
Sokoban_ani.gif


I'd love to see a recreation of a sokoban puzzle.

I found a gif to make the explanation of the game mechanics more simple.

The player is in an enclosed space, with 'switches' on the floor, that can only be activated by pushing a box on top of them.
When all switches have been pressed, the game is over and you win.

For tibia's implementation,

Players starting location is important.
Players must push a box, by walking into it. (no diagonals allowed.)
Players cannot stand on a box.
The boxes cannot go on top of other boxes, and can't be pushed into the walls.

A more simple option would be to have the players use the box, and drag the player in the direction the box is moving.

Ways in and out of the puzzle.
- A simple teleport to get inside, with a 10 minute timer before the player is kicked from the area, and the puzzle is reset.
- - (to stop the player from destroying the puzzle by accident while teleporting, restrict player movement for 2 seconds.)
- - (countdown timer per 30 seconds visible to player. Last 30 seconds counts down per 5 seconds, and last 5 seconds counts down per 1 second.)
- - (10:00, 9:30, ... 1:00, 0:30, 0:25, ... 0:10, 0:05, 0:04, ... 0:01)
- If the puzzle is solved, teleport player to a reward area, and of course reset the puzzle.

- To leave the area prior to the timer counting to zero, have the player 'double/triple click' any exterior wall.

Anti-cheating safeguards.
- 1 person limit.
- make sure players cannot logout inside the area.
- if server crash, have a safeguard to remove them from the puzzle area.
- Players cannot move the box with their mouse.
- Basically, make the box an immoveable, unpickupable, undraggable, unwalkable, unopenable, untradeable object.. like a wall, that you can only interact with by smashing your body into the side of it. xD
- Players cannot place any object onto the playing surface. (do not destroy the players griefing item attempts. Simply deny them the opportunity to place the items down from their inventory.)

(I can't think of anything else for player griefing, but you might find something while testing that I'm simply forgetting.)

Anyways, that's my idea.

Cheers,

Xikini

Cool idea, it would be a set level created right?

Hey, I'd like a script to merge 3 items.

You put 3 different items on 3 tiles infront of a lever, when you pull the lever the 2 items on the outer tiles dissapears with some cool effect and the remaining one in the middle gets a unique id and possibly sent to your bag idk.

Thanks. :d

Check what Aeronx said.
 
Yes, it should check if other players are inside. Yes, monster spawned should have more hp the higher the level. Also attacks should be stronger. (Adding a creaturevent to monsters that increases the damage acording to level chosen, but that part is secondary, most important is hp).
I dont know if its possible to setmaxhealth to a monster spawned through game.createmonster.

If the place to teleport is busy, maybe send player another zone?

Thank you for your time.

hrEn6kn.gif


PUKYJd1.gif


I don't think that i need to do an onSpawn event as i need to summon the creatures so i can get the id and set the hp, so the only event would be the onKill, you can change how much hp it need to add, and what do you get when win, each level get a reward? I think that only with source edit it would be possible to increase damage, if you do you can easily add to the script.
 
Hi, I´d like to get some help regarding this online script.
Can you show me how I cen simplefy it?

Lua:
function onSay(player, words, param)
    local hasAccess = player:getGroup():getAccess()
    local players = Game.getPlayers()
    local onlineList = {}
    for _, targetPlayer in ipairs(players) do
        if hasAccess or not targetPlayer:isInGhostMode() then
            table.insert(onlineList, ("%s [%d]"):format(targetPlayer:getName(), targetPlayer:getLevel()))
        end
    end
    local playersOnline = #onlineList
   
    if playersOnline < 1 then
        player:sendTextMessage(MESSAGE_INFO_DESCR, ("No players online."):format(playersOnline))
    elseif playersOnline < 2 then
        player:sendTextMessage(MESSAGE_INFO_DESCR, ("1 player online."):format(playersOnline))
    else
        player:sendTextMessage(MESSAGE_INFO_DESCR, ("%d players online."):format(playersOnline))
    end
  
    return false
end
 
hrEn6kn.gif


PUKYJd1.gif


I don't think that i need to do an onSpawn event as i need to summon the creatures so i can get the id and set the hp, so the only event would be the onKill, you can change how much hp it need to add, and what do you get when win, each level get a reward? I think that only with source edit it would be possible to increase damage, if you do you can easily add to the script.

It looks great. That preview is cool! (i'd love to know which program you did this kind of gif) Also, its possible to add damage based on level, but i can do that (since its more time consuming, its possible to create a spell for the monster or a creaturescript that will do X damage based on the level).

Also, is that a final version? I will probably change it to a talkaction to popup the modalwindow, and be teleported to that place only and only if the place is empty.

Each level will get a reward yeah, but most important thing on this system is the timer and the monster countdown. onkill add a storage +1, when you get storage == 100 (you can set a lower number for testing purposes obviously), you "win" and it gives you the time it took you to kill the "100" monsters. (thats just i way i thought, problably there are others way to do it).
Time cap is 15 minutes, if you dont kill it before 15 minutes, you lose (tp out).

Hi, I´d like to get some help regarding this online script.
Can you show me how I cen simplefy it?

Lua:
function onSay(player, words, param)
    local hasAccess = player:getGroup():getAccess()
    local players = Game.getPlayers()
    local onlineList = {}
    for _, targetPlayer in ipairs(players) do
        if hasAccess or not targetPlayer:isInGhostMode() then
            table.insert(onlineList, ("%s [%d]"):format(targetPlayer:getName(), targetPlayer:getLevel()))
        end
    end
    local playersOnline = #onlineList
 
    if playersOnline < 1 then
        player:sendTextMessage(MESSAGE_INFO_DESCR, ("No players online."):format(playersOnline))
    elseif playersOnline < 2 then
        player:sendTextMessage(MESSAGE_INFO_DESCR, ("1 player online."):format(playersOnline))
    else
        player:sendTextMessage(MESSAGE_INFO_DESCR, ("%d players online."):format(playersOnline))
    end
 
    return false
end

How more simple you want it? I mean, is as simple it gets. What you want exactly?
 
Last edited by a moderator:
Code:
function onSay(player, words, param)
    local onlineList = {}
    for _, targetPlayer in ipairs(Game.getPlayers()) do
        if targetPlayer:getGroup():getAccess() or not targetPlayer:isInGhostMode() then
            table.insert(onlineList, ("%s [%d]"):format(targetPlayer:getName(), targetPlayer:getLevel()))
        end
    end
    local text = "players"
    if #onlineList == 1 then
        text = "player"
    end

    player:sendTextMessage(MESSAGE_INFO_DESCR, string.format("%d %s online.", #onlineList, text))
    return true
end

I don't know how can you make it "shorter" than this. Not tested and my brain is cancer today so prolly I fucked up something.
 
Last edited:
Is hasAccess supposed to be inside for? It's getting the access from the player that used the talk action.
 
Is hasAccess supposed to be inside for? It's getting the access from the player that used the talk action.
No, good catch. It should be targetPlayer:getAccess blah blah. Probably not my script XD
Edited my post.
 
It looks great. That preview is cool! (i'd love to know which program you did this kind of gif) Also, its possible to add damage based on level, but i can do that (since its more time consuming, its possible to create a spell for the monster or a creaturescript that will do X damage based on the level).

Also, is that a final version? I will probably change it to a talkaction to popup the modalwindow, and be teleported to that place only and only if the place is empty.

Each level will get a reward yeah, but most important thing on this system is the timer and the monster countdown. onkill add a storage +1, when you get storage == 100 (you can set a lower number for testing purposes obviously), you "win" and it gives you the time it took you to kill the "100" monsters. (thats just i way i thought, problably there are others way to do it).
Time cap is 15 minutes, if you dont kill it before 15 minutes, you lose (tp out).

I use Peek, it's not a final one just a wip, and when the player log off it will need to check if he got the storage to be in that area and remove him if the time is over. You can set an area where the creatures will spawn and where the player will tp so you can bring him to a empty place first.
 
I use Peek, it's not a final one just a wip, and when the player log off it will need to check if he got the storage to be in that area and remove him if the time is over. You can set an area where the creatures will spawn and where the player will tp so you can bring him to a empty place first.
For the logout part, i will set the whole event area to nologout. (The final timer if the player won, will save to the db, and be shown on website later). Looking great! Gona test Peek :D Thank you for your time!
 
Hello Sir,
I've seen your post of free scripting and here's my request.
I think is a nice idea and would be nice.

ModalWindow - choose level 1 to 70.
Once you select a level, player get teleported to a zone where monsters according to level will spawn.
(Lets say its always the same monster but the monster have less or more HP, Damage, depending on the level you teleport)
You have 15 mins to kill 100 monsters. If you dont do it in time, you lose, tp out.
Once you kill 100 monsters, you win and get a time set like (you finished level 69 in 14 minutes 13 seconds).

(Its mosly like diablo III rifts)

Thank you for your time.

Code:
<event type="modalwindow" name="RiftsModal" script="RiftsModal.lua" />
<event type="kill" name="Rifts" script="rifts.lua"/>
Lua:
local tpPos = {x = 1011, y = 1014, z = 7}
local monster = {quantity = 4, name = "Rat"} -- Creatures to spawn
local spawn = {minX = 1009, maxX = 1012, minY = 1012, maxY = 1015, z = 7}

function spawnMonsters(value) 
    local random = math.random
    local addHealth = doCreatureAddHealth
    local maxHp = getCreatureMaxHealth
    local summon = doSummonCreature
    local i = monster.quantity
    while i > 0 do
        local summoned = summon(monster.name, {x = random(spawn.minX, spawn.maxX), y = random(spawn.minY, spawn.maxY), z = spawn.z})
        if summoned ~= false then
            Creature(summoned):setMaxHealth(maxHp(summoned) + (200 * value))
            addHealth(summoned, maxHp(summoned) + (200 * value))
            rift.creatures[#rift.creatures + 1] = summoned
            i = i - 1
        end      
    end  
    return true
end

local function timeLimit(player)
    local tLimitPlayer = Player(player)
    if tLimitPlayer:getStorageValue(rift.storages.player) ~= 0 then
        tLimitPlayer:unregisterEvent("Rifts")
        for _, creature in ipairs(rift.creatures) do
            doRemoveCreature(creature)
            rift.creatures[_] = nil
        end    
        doTeleportThing(player, rift.posBack)
        tLimitPlayer:say('Time is over, you killed ' .. (monster.quantity - rift.monstersLeft) .. " creatures.", TALKTYPE_MONSTER_SAY)
        rift.monstersLeft = 0
        return
    end
end


function onModalWindow(player, modalWindowId, buttonId, choiceId)
    player:unregisterEvent("RiftsModal")
    if modalWindowId == 1254 and buttonId == 100 then
        if spawnMonsters(choiceId) then
            rift.monstersLeft = monster.quantity
            player:setStorageValue(rift.storages.player, choiceId)
            player:setStorageValue(rift.storages.playerTime, os.time())  
            player:sendTextMessage(MESSAGE_STATUS_SMALL, "Welcome to the rift.")
            player:registerEvent("Rifts")
            rift.timelimit = addEvent(timeLimit, 1 * 30 * 1000, player.uid)
            doTeleportThing(player.uid, tpPos)
            doSendMagicEffect(tpPos, CONST_ME_MAGIC_BLUE)
        end
    end
  
    return true
end

Code:
<action actionid="2415" script="modals/diabloRiftTp.lua" />
Lua:
rift = {posBack = {x = 1024, y = 1014, z = 7}, storages = {player = 3514, playerTime = 3515}, creatures = {}, monstersLeft = 0}
local modal = {id = 1254, title = 'Select a level', message = 'Each level will have a higher difficulty'}
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    player:registerEvent("RiftsModal")
    if rift.monstersLeft > 0 then
        return player:sendTextMessage(MESSAGE_STATUS_SMALL, "Someone is using the rift already.")
    end
  
    local window = ModalWindow(modal.id, modal.title, modal.message)
    window:addButton(100, "Enter")
    window:addButton(101, "Cancel")
    for i = 1, 70 do
        local choice = window:addChoice(i, "Level " .. i)
    end
    window:setDefaultEnterButton(100)
    window:setDefaultEscapeButton(101)
   window:sendToPlayer(player)
   return true
end

Lua:
function onKill(creature, target)
   local targetMonster = Monster(target)
   if not targetMonster or rift.timelimit == nil or isSummon(targetMonster) or targetMonster:getName():lower() ~= "rat" then
       return true
    end

   local player = creature:getPlayer()
    if rift.monstersLeft < 1 then
        return true
    end
   
    rift.monstersLeft = rift.monstersLeft - 1
    if rift.monstersLeft == 0 then
        for _, creature in ipairs(rift.creatures) do
            doRemoveCreature(creature)
            rift.creatures[_] = nil
        end
        stopEvent(rift.timelimit)
        doTeleportThing(player.uid, rift.posBack)
        player:addItem(2160, player:getStorageValue(rift.storages.player))
        player:setStorageValue(rift.storages.player, 0)
        local time = os.date("*t", os.time() - player:getStorageValue(rift.storages.playerTime))
        if time.min > 0 then
            time = time.min .. " minutes and " .. time.sec .. " seconds"
        else
            time = time.sec .. " seconds"
        end
        player:say('Congratulations you finished the rift in ' .. time, TALKTYPE_MONSTER_SAY)
        player:unregisterEvent("Rifts")
    end
   
   return true
end


You can change rewards using the storage to get the selected level, in this script i'm giving one crystal coin for each level, so you can change as you want, can do a table too to get a specific reward for each level.
Only increasing HP, you can change the formula.

I changed the script i was going to use another storage but didn't needed it, copy again, set creature name inside the onKill function.
 
Last edited:
Back
Top