• 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.0 Last Man Standing By Nevix

nevix

Tunzodus.net
Joined
Mar 31, 2010
Messages
356
Reaction score
62
Location
Lithuanian
Hello, as i'm saw here is a lot of last man stading events, anyway I will share my last man standing.
Probably it is my first thing what I create good and working perfect :)

* Starts every xxx minutes as you want.
* Simple install.
* Reward premium points, of course you can edit code by yourself.
* Lets starts


- Check every 10 seconds whats happening in fight area.
^ If here left 1 player he won event.

I'm not good programmer but I tested it and it working 100% good. Anyway of cource printer LMS maybe stabile and better. But anyway guys it working good :)

Photos:
Waiting.....
MgN_5l78.png


Here is event teleport into the room :)
EUIBeq3k.png


Waiting event in waiting room. :)
3CZsblaH.png


After counter down all players who is in waiting room going into fight area!
HFeQRw_B.png


After one player left in event area:

zDoAetCD.png


I'm adding global events files

5 minutes you need change by yourself eg:
2 hours: 2*60*60*1000
rezult: 7200000
XML:
<globalevent name="Last Man Standing" interval="300000" script="my scripts/lms.lua"/>
Movements:
XML:
<movevent event="StepIn" actionid="25001" script="my scripts/lmsjoin.lua"/>
<movevent event="StepIn" actionid="25002" script="my scripts/lmsleave.lua"/>

Waiting area should be PZ protection and anti logout.
Fighting area should be PVP area and anti logout.

tfs.lua put into globalevents.
lmsjoin and lmsleave put into movements.

Anyway you can edit code as you want :)
Enjoy guys.

Credit: Nevix
 

Attachments

Last edited:
wont work :&

Code:
[08/02/2015 03:40:15] [Error - LuaScriptInterface::loadFile] cannot open data/globalevents/scripts/scripts/lms.lua: No such file or directory
[08/02/2015 03:40:15] [Warning - Event::loadScript] Cannot load script (data/globalevents/scripts/scripts/lms.lua)
[08/02/2015 03:40:15] cannot open data/globalevents/scripts/scripts/lms.lua: No such file or directory

i get that error :/ what is it for version?
 
Last edited by a moderator:
Code:
[08/02/2015 03:40:15] [Error - LuaScriptInterface::loadFile] cannot open data/globalevents/scripts/scripts/lms.lua: No such file or directory
[08/02/2015 03:40:15] [Warning - Event::loadScript] Cannot load script (data/globalevents/scripts/scripts/lms.lua)
[08/02/2015 03:40:15] cannot open data/globalevents/scripts/scripts/lms.lua: No such file or directory

i get that error :/ what is it for version?
post globalevents.xml
 
problem with this is that if you are 1 vs 1 and someone walks away from the other. Both or 1 wins and get teleported out.
 
I dident solve this, its fucked this system.
 
@nevix

would be nice if you also explained that we have to change. :)

Code:
    portalwhere = {x= 32349, y=32222, z=7}
    local portal = doCreateItem(11796,1,portalwhere)
  doSetItemActionId(portal, 25001)
  doSendMagicEffect(portalwhere, CONST_ME_TELEPORT)


    iteminfo = {x= 32348, y=32222, z=7}
    local item = doCreateItem(1431,1,iteminfo)
  doSetItemActionId(item, 25002)
  doSendMagicEffect(iteminfo, CONST_ME_TELEPORT)

works fine here except for the reward TFS 1.1 but i only used a perfect square as arena and waiting room maybe thats why they had that error/problem.

problem with this is that if you are 1 vs 1 and someone walks away from the other. Both or 1 wins and get teleported out.
 
Last edited:
local spectators = getSpectators(waitingplace, 10, 10, false)

10,10 -- means 10 squares from to center.

you can change it depends how many squares you would like to put.
small eg:

do0dE_2Fp.jpg


It is local spectators = getSpectators(waitingplace, 2, 2, false) -- area
you can increase it by yourself

edited code improved:
Just change
local area_increase = 10 --

Code:
local centeroffight = {x = 32396, y = 32194, z = 7}
local waitingplace = {x = 32245, y = 32206, z = 7}
local depotcenter = {x = 32345, y = 32223, z = 7}
local MinimumPlayers = 10
local rewardpoints = 2
local area_increase = 10




local function lmsclosed1()
    broadcastMessage("Last Man Standing event will start in 1 minutes. Portal is opened in depot", MESSAGE_STATUS_WARNING)
end


local function lmsclosed()

count = 0
        local spectators = getSpectators(waitingplace, area_increase, area_increase, false)
        if spectators ~= nil then
                for _, spectator in ipairs(spectators) do
                        if isPlayer(spectator) then   
                         count = count + 1
                      
                        end
                end
        end
       
       
       
if (count >= MinimumPlayers) then

broadcastMessage("Last Man Standing event portal closed and event started!", MESSAGE_STATUS_WARNING)

for _, pid in ipairs(getOnlinePlayers()) do
    if getPlayerStorageValue(pid, 25001) == 1 then
local playerids = getPlayerByName(pid)
doTeleportThing(playerids,centeroffight)
doSendMagicEffect(center, CONST_ME_TELEPORT)
    end
      
end

else

broadcastMessage("Not enough players to start Last man Standing event! Minimum: "..MinimumPlayers.." players. We have "..count.."!", MESSAGE_STATUS_WARNING)
setGlobalStorageValue(25002, 0)

for _, pid in ipairs(getOnlinePlayers()) do
    if getPlayerStorageValue(pid, 25001) == 1 then
local playerids = getPlayerByName(pid)
doTeleportThing(playerids,depotcenter)
doSendMagicEffect(depotcenter, CONST_ME_TELEPORT)
setPlayerStorageValue(pid, 25001, 0)

    end
end

end


return true
end





local function lmscheck()


count = 0
        local spectators = getSpectators(centeroffight, area_increase, area_increase, false)
        if spectators ~= nil then
                for _, spectator in ipairs(spectators) do
                        if isPlayer(spectator) then   
                         count = count + 1
                      
                        end
                end
        end

if count == 1 then


for _, pid in ipairs(getOnlinePlayers()) do
    if getPlayerStorageValue(pid, 25001) == 1 then
local playerids = getPlayerByName(pid)
setPlayerStorageValue(playerids, 25001, 0)
    end
end

        local spectators = getSpectators(centeroffight, area_increase, area_increase, false)
        if spectators ~= nil then
                for _, spectator in ipairs(spectators) do
                        if isPlayer(spectator) then 

           
           
doTeleportThing(spectator,depotcenter)
doSendMagicEffect(depotcenter, CONST_ME_TELEPORT)
broadcastMessage("LMS ended winner is: "..getPlayerName(spectator)..", reward is 2 premium points.", MESSAGE_STATUS_WARNING)
  
local accid = Player(spectator):getAccountId()
local points = rewardpoints
db.query("UPDATE `accounts` SET `premium_points` = `premium_points` + " .. points .. " WHERE `id` = " .. accid)
                     end
                end
        end
       


for _, pid in ipairs(getOnlinePlayers()) do
    if getPlayerStorageValue(pid, 25001) == 1 then
local playerids = getPlayerByName(pid)
setPlayerStorageValue(pid, 25001, 0)
end
end

stopEvent(lmscheck)

else
addEvent(lmscheck, 10*1000)
end
end



local function lms()
    broadcastMessage("Last Man Standing event will start in 2 minutes. Portal is opened in depot", MESSAGE_STATUS_WARNING)

    portalwhere = {x= 32349, y=32222, z=7}
    local portal = doCreateItem(11796,1,portalwhere)
  doSetItemActionId(portal, 25001)
  doSendMagicEffect(portalwhere, CONST_ME_TELEPORT)


    iteminfo = {x= 32348, y=32222, z=7}
    local item = doCreateItem(1431,1,iteminfo)
  doSetItemActionId(item, 25002)
  doSendMagicEffect(iteminfo, CONST_ME_TELEPORT)
 
addEvent(function() doRemoveItem(getTileItemById(portalwhere, 11796).uid) end, 120 * 1000)
addEvent(function() doSendMagicEffect(portalwhere, CONST_ME_TELEPORT) end, 120 * 1000)

addEvent(function() doRemoveItem(getTileItemById(iteminfo, 1431).uid) end, 120 * 1000)
addEvent(function() doSendMagicEffect(iteminfo, CONST_ME_TELEPORT) end, 120 * 1000)

addEvent(lmsclosed, 2*60*1000)
addEvent(lmsclosed1, 1*60*1000)
addEvent(lmscheck, 130*1000)

return true
end



function onThink(interval)

    broadcastMessage("Last Man Standing event will start in 3 minutes.", MESSAGE_STATUS_WARNING)
    addEvent(lms, 60*1000)



for _, pid in ipairs(getOnlinePlayers()) do
    if getPlayerStorageValue(pid, 25001) == 1 then
local playerids = getPlayerByName(pid)
doTeleportThing(playerids,depotcenter)
doSendMagicEffect(depotcenter, CONST_ME_TELEPORT)
setPlayerStorageValue(pid, 25001, 0)

    end
end


return true
end
 
@nevix

can you make it that reward is an item or random from 5 items that is configurable? like itemid chance 500 and second itemid chance 1000 or something?
 
@nevix

can you make it that reward is an item or random from 5 items that is configurable? like itemid chance 500 and second itemid chance 1000 or something?
I know how to do it, but if I'm gonna do it everything for you, you will never learn lua language.

random number 1,5
itemchance like 1,10

if random number == 1 && itemchance == 1 then
you got this item
elseif random number == 2 && itemchance == 1 then
you got this item

you can configure it by yourself very easily
 
Back
Top