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

RevScripts cool tp appear idea

Lbtg

Intermediate OT User
Joined
Nov 22, 2008
Messages
2,312
Reaction score
135
hey hey again xd :)) inspiring time xd


i want to ask alot alot please for a revscript, idea like this:

if i kill Demon in area 11/11/7 - 22/22/7 . appear teleport on 11/15/7 for 90 seconds , with leads to 55/55/7.
while teleport is active, shoud be counttimer on tp. Also revscript, so can add multiple lines for different locations/monsters etc.


thanks alot in advance!!!
 
@Fjorda
I had to join his server to test a boss kill event. Indeed, his TFS source is quite buggy. I recommend switching to a newer TFS. I sent him about 6 different scripts, and none of them worked for him, lol. I tested my TFS, and it worked fine, but it gave an error in his console. I think his source is very buggy or poorly optimized or something like that. I don't know.
i got over 100 revscripts and alot of them are event types, and alot of them are op ones, maybe there is something diff here , im pretty sure its fixaible
 
i got over 100 revscripts and alot of them are event types, and alot of them are op ones, maybe there is something diff here , im pretty sure its fixaible
Most likely you're missing a method i've used. List your src/luascript.cpp here.
 
Most likely you're missing a method i've used. List your src/luascript.cpp here.
i cannot post either upload it here

So i upload in google what i found ''


its luascript.cpp


thanks alot for giving time for this
Post automatically merged:

Lua:
local teleportCountdownRange = { --how close to the teleport to see the countdown? best to set to your viewport radiuses
    x = 7, --default tibia client x radius
    y = 5 --default tibia client y radius
}

local config = {
    {
        bossName = "demon",
        area = {
            from = Position(32320, 32210, 7),
            to = Position(32322, 32213, 7),
        },
        teleportId = 1387,
        teleportTime = 90,
        teleportPos = Position(32320, 32218, 7),
        teleportToPos = Position(32331, 32215, 7),
        killMessage = "You have survived, and a portal has spawned for you.",
        killMessageType = MESSAGE_EVENT_ADVANCE,
    },
    {
        bossName = "dragon",
        area = {
            from = Position(32320, 32210, 7),
            to = Position(32322, 32213, 7),
        },
        teleportId = 1387,
        teleportTime = 90,
        teleportPos = Position(32320, 32218, 7),
        teleportToPos = Position(32331, 32215, 7),
        killMessage = "You have survived, and a portal has spawned for you.",
        killMessageType = MESSAGE_EVENT_ADVANCE,
    },
}

local function countdownTeleport(eventId, timer)
    local event = config[eventId]
    if not event then
        return
    end
  
    local teleport = event.teleport
    if not teleport then
        return
    end
  
    timer = timer - 1
  
    if timer == 0 then
        teleport:remove()
        event.teleport = nil
        return
    end
  
    local teleportPosition = teleport:getPosition()
    local spectators = Game.getSpectators(teleportPosition, false, true, teleportCountdownRange.x, teleportCountdownRange.x, teleportCountdownRange.y, teleportCountdownRange.y)
    if spectators then
        for _, spectator in ipairs(spectators) do
            spectator:say(timer, TALKTYPE_MONSTER_SAY, false, spectator, teleportPosition)
        end
    end

    addEvent(countdownTeleport, 1000, eventId, timer)
end

local deathTeleportOnKill = CreatureEvent("deathTeleportOnKill")
function deathTeleportOnKill.onKill(player, target)

    if not target:isMonster() then
        return true
    end
  
    local monsterName = target:getName():lower()

    for eventId, event in ipairs(config) do
        if monsterName == event.bossName
        and player:getPosition():isInRange(event.area.from, event.area.to)
        and not event.teleport then
            local teleport = Game.createItem(event.teleportId, 1, event.teleportPos)
            if teleport then
                teleport:setDestination(event.teleportToPos)
                event.teleport = teleport
                addEvent(countdownTeleport, 1000, eventId, event.teleportTime)
              
                if event.killMessage and event.killMessageType then
                    local damageMap = target:getDamageMap()
                    if damageMap then
                        for playerId, _ in pairs(damageMap) do
                            local contributor = Player(playerId)
                            if contributor then
                                contributor:sendTextMessage(event.killMessageType, event.killMessage)
                            end
                        end
                    end
                end
            end
            break
        end
    end
  
    return true
end
deathTeleportOnKill:register()

--or register "deathTeleportLogin" on player login (data/creaturescripts/login.lua) and remove the code below
local deathTeleportLogin = CreatureEvent("deathTeleportLogin")
function deathTeleportLogin.onLogin(player)
    player:registerEvent("deathTeleportOnKill")
    return true
end
deathTeleportLogin:register()
bro tested it again fully and it works :D.......... idk what i messed up, im not programer so i could easily mess up something....


Thanks alot for trying to help by giving your time!
 
Last edited:
bro tested it again fully and it works :D.......... idk what i messed up, im not programer so i could easily mess up something...
That's great that you sorted it out, but be careful with the script. If you make any mistakes, make sure to review the script to ensure everything is correct before testing and running it. If any errors occur, you can easily fix them yourself! It's super easy! 🙂
 
Back
Top