TFS 1.0 Last Man Standing By Nevix

Discussion in 'GlobalEvents, Spells & CreatureEvents' started by nevix, Sep 20, 2014.

  1. nevix

    nevix Tunzodus.net

    Joined:
    Mar 31, 2010
    Messages:
    353
    Likes Received:
    55
    Best Answers:
    0
    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.....
    [​IMG]

    Here is event teleport into the room :)
    [​IMG]

    Waiting event in waiting room. :)
    [​IMG]

    After counter down all players who is in waiting room going into fight area!
    [​IMG]

    After one player left in event area:

    [​IMG]

    I'm adding global events files

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

    Attached Files:

    Last edited: Sep 20, 2014
  2. ricotje1

    ricotje1 Member

    Joined:
    Nov 8, 2012
    Messages:
    234
    Likes Received:
    2
    Best Answers:
    0
    Nice :D I add the random spawn.
     
    Last edited: Oct 6, 2014
  3. Alek

    Alek ᵀᴴᴱ ᴼᴿᴵᴳᴵᴻᴬᴸs

    Joined:
    Feb 15, 2008
    Messages:
    697
    Likes Received:
    14
    Best Answers:
    0
    Nice (Y)
     
  4. matti450

    matti450 Active Member

    Joined:
    Apr 13, 2008
    Messages:
    508
    Likes Received:
    22
    Best Answers:
    0
    wont work :&

    Code (Text):
    1. [08/02/2015 03:40:15] [Error - LuaScriptInterface::loadFile] cannot open data/globalevents/scripts/scripts/lms.lua: No such file or directory
    2. [08/02/2015 03:40:15] [Warning - Event::loadScript] Cannot load script (data/globalevents/scripts/scripts/lms.lua)
    3. [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: Feb 12, 2015
  5. StreamSide

    StreamSide Joseluis Gonzalez

    Joined:
    Aug 31, 2007
    Messages:
    2,546
    Likes Received:
    494
    Best Answers:
    0
    post globalevents.xml
     
  6. matti450

    matti450 Active Member

    Joined:
    Apr 13, 2008
    Messages:
    508
    Likes Received:
    22
    Best Answers:
    0
    managed to fix the error and all worked but the problem was when that thing did created in t.e.x temple it was without teleport :/

    the teleport wont show up :/!!!!!!!!!!!!
     
    Last edited by a moderator: Feb 12, 2015
  7. StreamSide

    StreamSide Joseluis Gonzalez

    Joined:
    Aug 31, 2007
    Messages:
    2,546
    Likes Received:
    494
    Best Answers:
    0
    copy console errors and creatureevents.xml
     
  8. matti450

    matti450 Active Member

    Joined:
    Apr 13, 2008
    Messages:
    508
    Likes Received:
    22
    Best Answers:
    0
    dude i got no errors ffs, the only thing is that damn teleport do not spawns out only that pink items....
     
  9. nevix

    nevix Tunzodus.net

    Joined:
    Mar 31, 2010
    Messages:
    353
    Likes Received:
    55
    Best Answers:
    0
    TFS V.1.0.1 Everything working perfect because i'm using it.
     
  10. televolt

    televolt Member

    Joined:
    Jun 21, 2010
    Messages:
    153
    Likes Received:
    9
    Best Answers:
    0
    pink item = teleport
    check your moveevent
     
  11. gurden

    gurden i need support for my server, good scripter!

    Joined:
    May 19, 2009
    Messages:
    518
    Likes Received:
    5
    Best Answers:
    0
    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.
     
  12. zbizu

    zbizu ‌‌Luakami

    Joined:
    Nov 22, 2010
    Messages:
    2,437
    Likes Received:
    1,328
    Best Answers:
    0
    @nevix does it work on 1.1?
     
  13. nevix

    nevix Tunzodus.net

    Joined:
    Mar 31, 2010
    Messages:
    353
    Likes Received:
    55
    Best Answers:
    0
  14. Andreselos

    Andreselos Member

    Joined:
    Feb 9, 2015
    Messages:
    36
    Likes Received:
    7
    Best Answers:
    0
    i have this problem too, how to solve this?
     
  15. gurden

    gurden i need support for my server, good scripter!

    Joined:
    May 19, 2009
    Messages:
    518
    Likes Received:
    5
    Best Answers:
    0
    I dident solve this, its fucked this system.
     
  16. StreamSide

    StreamSide Joseluis Gonzalez

    Joined:
    Aug 31, 2007
    Messages:
    2,546
    Likes Received:
    494
    Best Answers:
    0
    what you mean, can you reproduce it again?
     
  17. yogiikke

    yogiikke :D

    Joined:
    Mar 24, 2013
    Messages:
    59
    Likes Received:
    7
    Best Answers:
    0
    @nevix

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

    Code (Text):
    1.  
    2.     portalwhere = {x= 32349, y=32222, z=7}
    3.     local portal = doCreateItem(11796,1,portalwhere)
    4.   doSetItemActionId(portal, 25001)
    5.   doSendMagicEffect(portalwhere, CONST_ME_TELEPORT)
    6.  
    7.  
    8.     iteminfo = {x= 32348, y=32222, z=7}
    9.     local item = doCreateItem(1431,1,iteminfo)
    10.   doSetItemActionId(item, 25002)
    11.   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.

     
    Last edited: May 23, 2015
    nevix likes this.
  18. nevix

    nevix Tunzodus.net

    Joined:
    Mar 31, 2010
    Messages:
    353
    Likes Received:
    55
    Best Answers:
    0
    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:

    [​IMG]

    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 (Text):
    1. local centeroffight = {x = 32396, y = 32194, z = 7}
    2. local waitingplace = {x = 32245, y = 32206, z = 7}
    3. local depotcenter = {x = 32345, y = 32223, z = 7}
    4. local MinimumPlayers = 10
    5. local rewardpoints = 2
    6. local area_increase = 10
    7.  
    8.  
    9.  
    10.  
    11. local function lmsclosed1()
    12.     broadcastMessage("Last Man Standing event will start in 1 minutes. Portal is opened in depot", MESSAGE_STATUS_WARNING)
    13. end
    14.  
    15.  
    16. local function lmsclosed()
    17.  
    18. count = 0
    19.         local spectators = getSpectators(waitingplace, area_increase, area_increase, false)
    20.         if spectators ~= nil then
    21.                 for _, spectator in ipairs(spectators) do
    22.                         if isPlayer(spectator) then  
    23.                          count = count + 1
    24.                      
    25.                         end
    26.                 end
    27.         end
    28.        
    29.        
    30.        
    31. if (count >= MinimumPlayers) then
    32.  
    33. broadcastMessage("Last Man Standing event portal closed and event started!", MESSAGE_STATUS_WARNING)
    34.  
    35. for _, pid in ipairs(getOnlinePlayers()) do
    36.     if getPlayerStorageValue(pid, 25001) == 1 then
    37. local playerids = getPlayerByName(pid)
    38. doTeleportThing(playerids,centeroffight)
    39. doSendMagicEffect(center, CONST_ME_TELEPORT)
    40.     end
    41.      
    42. end
    43.  
    44. else
    45.  
    46. broadcastMessage("Not enough players to start Last man Standing event! Minimum: "..MinimumPlayers.." players. We have "..count.."!", MESSAGE_STATUS_WARNING)
    47. setGlobalStorageValue(25002, 0)
    48.  
    49. for _, pid in ipairs(getOnlinePlayers()) do
    50.     if getPlayerStorageValue(pid, 25001) == 1 then
    51. local playerids = getPlayerByName(pid)
    52. doTeleportThing(playerids,depotcenter)
    53. doSendMagicEffect(depotcenter, CONST_ME_TELEPORT)
    54. setPlayerStorageValue(pid, 25001, 0)
    55.  
    56.     end
    57. end
    58.  
    59. end
    60.  
    61.  
    62. return true
    63. end
    64.  
    65.  
    66.  
    67.  
    68.  
    69. local function lmscheck()
    70.  
    71.  
    72. count = 0
    73.         local spectators = getSpectators(centeroffight, area_increase, area_increase, false)
    74.         if spectators ~= nil then
    75.                 for _, spectator in ipairs(spectators) do
    76.                         if isPlayer(spectator) then  
    77.                          count = count + 1
    78.                      
    79.                         end
    80.                 end
    81.         end
    82.  
    83. if count == 1 then
    84.  
    85.  
    86. for _, pid in ipairs(getOnlinePlayers()) do
    87.     if getPlayerStorageValue(pid, 25001) == 1 then
    88. local playerids = getPlayerByName(pid)
    89. setPlayerStorageValue(playerids, 25001, 0)
    90.     end
    91. end
    92.  
    93.         local spectators = getSpectators(centeroffight, area_increase, area_increase, false)
    94.         if spectators ~= nil then
    95.                 for _, spectator in ipairs(spectators) do
    96.                         if isPlayer(spectator) then
    97.  
    98.            
    99.            
    100. doTeleportThing(spectator,depotcenter)
    101. doSendMagicEffect(depotcenter, CONST_ME_TELEPORT)
    102. broadcastMessage("LMS ended winner is: "..getPlayerName(spectator)..", reward is 2 premium points.", MESSAGE_STATUS_WARNING)
    103.  
    104. local accid = Player(spectator):getAccountId()
    105. local points = rewardpoints
    106. db.query("UPDATE `accounts` SET `premium_points` = `premium_points` + " .. points .. " WHERE `id` = " .. accid)
    107.                      end
    108.                 end
    109.         end
    110.        
    111.  
    112.  
    113. for _, pid in ipairs(getOnlinePlayers()) do
    114.     if getPlayerStorageValue(pid, 25001) == 1 then
    115. local playerids = getPlayerByName(pid)
    116. setPlayerStorageValue(pid, 25001, 0)
    117. end
    118. end
    119.  
    120. stopEvent(lmscheck)
    121.  
    122. else
    123. addEvent(lmscheck, 10*1000)
    124. end
    125. end
    126.  
    127.  
    128.  
    129. local function lms()
    130.     broadcastMessage("Last Man Standing event will start in 2 minutes. Portal is opened in depot", MESSAGE_STATUS_WARNING)
    131.  
    132.     portalwhere = {x= 32349, y=32222, z=7}
    133.     local portal = doCreateItem(11796,1,portalwhere)
    134.   doSetItemActionId(portal, 25001)
    135.   doSendMagicEffect(portalwhere, CONST_ME_TELEPORT)
    136.  
    137.  
    138.     iteminfo = {x= 32348, y=32222, z=7}
    139.     local item = doCreateItem(1431,1,iteminfo)
    140.   doSetItemActionId(item, 25002)
    141.   doSendMagicEffect(iteminfo, CONST_ME_TELEPORT)
    142.  
    143. addEvent(function() doRemoveItem(getTileItemById(portalwhere, 11796).uid) end, 120 * 1000)
    144. addEvent(function() doSendMagicEffect(portalwhere, CONST_ME_TELEPORT) end, 120 * 1000)
    145.  
    146. addEvent(function() doRemoveItem(getTileItemById(iteminfo, 1431).uid) end, 120 * 1000)
    147. addEvent(function() doSendMagicEffect(iteminfo, CONST_ME_TELEPORT) end, 120 * 1000)
    148.  
    149. addEvent(lmsclosed, 2*60*1000)
    150. addEvent(lmsclosed1, 1*60*1000)
    151. addEvent(lmscheck, 130*1000)
    152.  
    153. return true
    154. end
    155.  
    156.  
    157.  
    158. function onThink(interval)
    159.  
    160.     broadcastMessage("Last Man Standing event will start in 3 minutes.", MESSAGE_STATUS_WARNING)
    161.     addEvent(lms, 60*1000)
    162.  
    163.  
    164.  
    165. for _, pid in ipairs(getOnlinePlayers()) do
    166.     if getPlayerStorageValue(pid, 25001) == 1 then
    167. local playerids = getPlayerByName(pid)
    168. doTeleportThing(playerids,depotcenter)
    169. doSendMagicEffect(depotcenter, CONST_ME_TELEPORT)
    170. setPlayerStorageValue(pid, 25001, 0)
    171.  
    172.     end
    173. end
    174.  
    175.  
    176. return true
    177. end
     
    yogiikke likes this.
  19. yogiikke

    yogiikke :D

    Joined:
    Mar 24, 2013
    Messages:
    59
    Likes Received:
    7
    Best Answers:
    0
    @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?
     
  20. nevix

    nevix Tunzodus.net

    Joined:
    Mar 31, 2010
    Messages:
    353
    Likes Received:
    55
    Best Answers:
    0
    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
     

Share This Page

Loading...