HR_Shaft

Ghostly! Alternating Camouflage for Phasor v2

Mar 30th, 2014
235
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 7.48 KB | None | 0 0
  1. --[[ ###         Ghostly! v1        ###]]--
  2. --[[ ###   Alternating Camouflage   ###]]--
  3. --[[ ###  by H® Shaft for Phasor v2 ###]]--
  4.  
  5. -- Based on the settings per map, (ffa_invis and team_invis), players or teams will alternate appearing and disappearing in 5 second loops
  6. -- When applied in FFA, players will be invisible for 5 seconds, then will be visible for 5 seconds
  7. -- When applied in TEAM, red players will be invisible for 5 seconds, while blue will be visible for 5 seconds, then vice-versa
  8. -- Best for small maps or open maps
  9.  
  10. team_play = false
  11. game_started = false
  12. ffa_invis = {}
  13. team_invis = {}
  14. cur_players = 0
  15.  
  16. -- ffa alternating camo
  17. ffa_invis.      beavercreek         =       true            -- battle creek
  18. ffa_invis.      bloodgulch          =       false              
  19. ffa_invis.      boardingaction      =       true               
  20. ffa_invis.      carousel            =       true            -- derelict
  21. ffa_invis.      chillout            =       true               
  22. ffa_invis.      damnation           =       true               
  23. ffa_invis.      dangercanyon        =       false              
  24. ffa_invis.      deathisland         =       false          
  25. ffa_invis.      gephyrophobia       =       false              
  26. ffa_invis.      hangemhigh          =       true               
  27. ffa_invis.      icefields           =       false              
  28. ffa_invis.      infinity            =       false              
  29. ffa_invis.      longest             =       true               
  30. ffa_invis.      prisoner            =       true               
  31. ffa_invis.      putput              =       true            -- chiron tl34
  32. ffa_invis.      ratrace             =       true               
  33. ffa_invis.      sidewinder          =       false              
  34. ffa_invis.      timberland          =       false              
  35. ffa_invis.      wizard              =       true
  36. ffa_invis.      ballbeavercreek     =       true
  37. ffa_invis.      ballcarousel        =       true
  38. ffa_invis.      ballchillout        =       true
  39. ffa_invis.      balldamnation       =       true
  40. ffa_invis.      ballhangemhigh      =       true
  41. ffa_invis.      balllongest         =       true
  42. ffa_invis.      ballprisoner        =       true
  43. ffa_invis.      ballputput          =       true
  44. ffa_invis.      ballratrace         =       true
  45. ffa_invis.      ballwizard          =       true
  46. ffa_invis.      ballbloodgulch      =       false
  47. ffa_invis.      ballsidewinder      =       false
  48.  
  49. -- team alternating camo
  50. team_invis.     beavercreek         =       true            -- battle creek
  51. team_invis.     bloodgulch          =       false              
  52. team_invis.     boardingaction      =       true               
  53. team_invis.     carousel            =       true            -- derelict
  54. team_invis.     chillout            =       true               
  55. team_invis.     damnation           =       true               
  56. team_invis.     dangercanyon        =       false              
  57. team_invis.     deathisland         =       false          
  58. team_invis.     gephyrophobia       =       false              
  59. team_invis.     hangemhigh          =       true               
  60. team_invis.     icefields           =       false              
  61. team_invis.     infinity            =       false              
  62. team_invis.     longest             =       true               
  63. team_invis.     prisoner            =       true               
  64. team_invis.     putput              =       true            -- chiron tl34
  65. team_invis.     ratrace             =       true               
  66. team_invis.     sidewinder          =       false              
  67. team_invis.     timberland          =       false              
  68. team_invis.     wizard              =       true
  69. team_invis.     ballbeavercreek     =       true
  70. team_invis.     ballcarousel        =       true
  71. team_invis.     ballchillout        =       true
  72. team_invis.     balldamnation       =       true
  73. team_invis.     ballhangemhigh      =       true
  74. team_invis.     balllongest         =       true
  75. team_invis.     ballprisoner        =       true
  76. team_invis.     ballputput          =       true
  77. team_invis.     ballratrace         =       true
  78. team_invis.     ballwizard          =       true
  79. team_invis.     ballbloodgulch      =       true
  80. team_invis.     ballsidewinder      =       true
  81.  
  82. function GetRequiredVersion()
  83.     return 200
  84. end
  85.  
  86. function OnScriptLoad(process, game, persistent)
  87.     if game == true or game == "PC" then
  88.         GAME = "PC"
  89.         gametype_base = 0x671340
  90.         map_name = readstring(0x698F21)
  91.     else
  92.         GAME = "CE"
  93.         gametype_base = 0x5F5498
  94.         map_name = readstring(0x61D151)    
  95.     end
  96.    
  97.     if getteamplay() == true then team_play = true else team_play = false end  
  98.    
  99.     for i=0,15 do
  100.         if getplayer(i) then
  101.             cur_players = cur_players + 1
  102.         end    
  103.     end
  104.  
  105.     if game_started == false and cur_players > 0 then game_started = true end
  106. end
  107.  
  108. function OnNewGame(map)
  109.     if GAME == "PC" then
  110.         gametype_base = 0x671340
  111.         map_name = readstring(0x698F21)
  112.     elseif GAME == "CE" then
  113.         gametype_base = 0x5F5498
  114.         map_name = readstring(0x61D151)
  115.     end
  116.  
  117.     game_started = true
  118.  
  119.     if getteamplay() == true then team_play = true else team_play = false end  
  120.    
  121.     for i=0,15 do
  122.         if getplayer(i) then
  123.             cur_players = cur_players + 1
  124.         end    
  125.     end
  126.    
  127.     if team_play and game_started then
  128.         if team_invis[map_name] then
  129.             teaminvis = registertimer(500, "red_team_invis_start")
  130.         end
  131.     elseif not team_play and game_started then
  132.         if ffa_invis[map_name] then
  133.             ffainvis = registertimer(500, "ffa_invis_start")
  134.         end
  135.     end
  136. end
  137.  
  138. function getteamplay()
  139.     if readbyte(gametype_base + 0x34) == 1 then
  140.         return true
  141.     else
  142.         return false
  143.     end
  144. end
  145.  
  146. function OnPlayerJoin(player)
  147.     if getplayer(player) then
  148.         cur_players = cur_players + 1
  149.         if team_play then
  150.             if team_invis[map_name] then
  151.                 privatesay(player, "Ghostly Teams!")
  152.                 privatesay(player, "Teams will Alternate Appearing and Disappearing")
  153.             end
  154.         elseif not team_play then
  155.             if ffa_invis[map_name] then
  156.                 privatesay(player, "Ghostly Free for All!")
  157.                 privatesay(player, "Players will Alternate Appearing and Disappearing")
  158.             end
  159.         end                
  160.     end
  161. end
  162.  
  163. function OnPlayerLeave(player)
  164.     if getplayer(player) then
  165.         cur_players = cur_players - 1
  166.     end
  167. end
  168.  
  169. function OnGameEnd(stage)
  170.     if stage == 1 then
  171.         game_started = false
  172.         if teaminvis then
  173.             removetimer(teaminvis)
  174.             teaminvis = nil
  175.         end
  176.         if ffainvis then
  177.             removetimer(ffainvis)
  178.             ffainvis = nil
  179.         end
  180.         if blue_team_invis then
  181.             removetimer(blue_team_invis)
  182.             blue_team_invis = nil
  183.         end
  184.         if red_team_invis then
  185.             removetimer(red_team_invis)
  186.             red_team_invis = nil
  187.         end
  188.         if ffa_invisi then
  189.             removetimer(ffa_invisi)
  190.             ffa_invisi = nil
  191.         end
  192.         if ffa_uninvis then
  193.             removetimer(ffa_uninvis)
  194.             ffa_uninvis = nil
  195.         end    
  196.     end
  197. end
  198.  
  199. function red_team_invis_start(id, count) -- alternating invisible teams begin loop
  200.     if count == 1 then
  201.         for x = 0,15 do
  202.             if getplayer(x) then
  203.                 local team = getteam(x)
  204.                 if team == 0 then
  205.                     applycamo(x, 5)
  206.                 end
  207.             end
  208.         end
  209.         blue_team_invis = registertimer(6000, "Blue_Team_Invis") -- initiates first loop
  210.     end
  211.     return true
  212. end
  213.  
  214. function ffa_invis_start(id, count)
  215.     if count == 1 then
  216.         for x = 0,15 do
  217.             if getplayer(x) then
  218.                 applycamo(x, 5)
  219.             end
  220.         end
  221.         ffa_uninvis = registertimer(6000, "Ffa_Uninvis") -- initiates first loop
  222.     end
  223.     return true
  224. end
  225. -- univis note: used to slightly adjust players camo time for joining/spawning players (player latency)
  226. function Ffa_Uninvis(id, count)
  227.     for x = 0,15 do
  228.         if getplayer(x) then
  229.             applycamo(x, 1)
  230.         end
  231.     end
  232.     ffa_invisi = registertimer(6000, "Ffa_Invisi")
  233.     return false   
  234. end
  235.  
  236. function Ffa_Invisi(id, count)
  237.     for x = 0,15 do
  238.         if getplayer(x) then
  239.             applycamo(x, 5)
  240.         end
  241.     end
  242.     ffa_uninvis = registertimer(6000, "Ffa_Uninvis") -- initiates timer for ffa loopback
  243.     return false   
  244. end
  245.  
  246. function Red_Team_Invis(id, count)
  247.     for x = 0,15 do
  248.         if getplayer(x) then
  249.             local team = getteam(x)
  250.             if team == 0 then
  251.                 applycamo(x, 5)
  252.             end
  253.         end
  254.     end
  255.     blue_team_invis = registertimer(6000, "Blue_Team_Invis") -- initiates timer for blue loopback
  256.     return false   
  257. end
  258.  
  259. function Blue_Team_Invis(id, count)
  260.     for x = 0,15 do
  261.         if getplayer(x) then
  262.             local team = getteam(x)
  263.             if team == 1 then
  264.                 applycamo(x, 5)
  265.             end
  266.         end
  267.     end
  268.     red_team_invis = registertimer(6000, "Red_Team_Invis") -- initiates timer for red loopback
  269.     return false   
  270. end
  271.  
  272. -- Created by H® Shaft thank you to Oxide, AelitePrime, Nugget & Wizard.
  273. -- Visit http://halorace.org/forum/index.php?topic=514.0 or
  274. -- Visit http://pastebin.com/u/HR_Shaft for more phasor scripts
Advertisement
Add Comment
Please, Sign In to add comment