Advertisement
HR_Shaft

Team Race Spawning for Phasor v2

Oct 17th, 2013
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 9.01 KB | None | 0 0
  1. --[[ ###  -- Team Race Spawning -- ###]]--
  2. --[[ ###        by H® Shaft        ###]]--
  3. --[[ ###       for Phasor v2       ###]]--
  4.  
  5. -- All players spawn at their own teams base (eliminates random spawning with opposing team which normally instigates slayer-play).
  6. -- Designed for Team Race
  7.  
  8. -- Designed for these maps only:
  9. -- bloodgulch
  10. -- dangercanyon
  11. -- deathisland
  12. -- gephyrophobia
  13. -- infinity
  14. -- icefields
  15. -- sidewinder
  16. -- timberland
  17.  
  18. red_spawn_coord = {}
  19. blu_spawn_coord = {}
  20. team_play = false
  21.  
  22. function GetRequiredVersion()
  23.     return 200
  24. end
  25.  
  26. function OnScriptLoad(process, game, persistent)
  27.     if game == true or game == "PC" then
  28.         GAME = "PC"
  29.         map_name = readstring(0x698F21)
  30.         gametype_base = 0x671340
  31.     else
  32.         GAME = "CE"
  33.         map_name = readstring(0x61D151)
  34.         gametype_base = 0x5F5498
  35.     end
  36.     team_play = getteamplay()
  37.     LoadCoords()
  38. end
  39.  
  40. function OnNewGame(map)
  41.     if GAME == "PC" then
  42.         map_name = readstring(0x698F21)
  43.         gametype_base = 0x671340
  44.     elseif GAME == "CE" then
  45.         map_name = readstring(0x61D151)
  46.         gametype_base = 0x5F5498
  47.     end
  48.     team_play = getteamplay()
  49.     LoadCoords()
  50. end
  51.  
  52. function getteamplay()
  53.     if readbyte(gametype_base + 0x34) == 1 then
  54.         return true
  55.     else
  56.         return false
  57.     end
  58. end
  59.  
  60. function OnPlayerSpawn(player, m_objectId)
  61.     if team_play then
  62.         local team = getteam(player)
  63.         local m_objectId = getplayerobjectid(player)
  64.         local m_object = getobject(m_objectId)     
  65.         if team == 0 then
  66.             local redcoord = SelectRedSpawnCoord()
  67.             if redcoord then
  68.                 movobjectcoords(m_objectId, red_spawn_coord[redcoord][1], red_spawn_coord[redcoord][2], red_spawn_coord[redcoord][3])              
  69.             end
  70.         elseif team == 1 then
  71.             local blucoord = SelectBluSpawnCoord()
  72.             if blucoord then
  73.                 movobjectcoords(m_objectId, blu_spawn_coord[blucoord][1], blu_spawn_coord[blucoord][2], blu_spawn_coord[blucoord][3])
  74.             end
  75.         end
  76.     end        
  77. end
  78.  
  79. function SelectRedSpawnCoord(arg)
  80.     local redspawncount = #red_spawn_coord
  81.     if redspawncount > 0 then
  82.         return getrandomnumber(1, redspawncount+1)
  83.     end
  84.     return nil 
  85. end
  86.  
  87. function SelectBluSpawnCoord(arg)
  88.     local bluspawncount = #blu_spawn_coord
  89.     if bluspawncount > 0 then
  90.         return getrandomnumber(1, bluspawncount+1)
  91.     end
  92.     return nil 
  93. end
  94.  
  95. function LoadCoords()
  96.     if map_name == "bloodgulch" then
  97.         red_spawn_coord[1] = {68.911, -173.686, 1.815}
  98.         red_spawn_coord[2] = {74.323, -173.370, 0.817}
  99.         red_spawn_coord[3] = {79.380, -173.402, 0.410}
  100.         red_spawn_coord[4] = {84.011, -173.499, 0.307}
  101.         red_spawn_coord[5] = {89.487, -173.463, 0.344}
  102.         red_spawn_coord[6] = {95.069, -173.863, 0.718}
  103.         red_spawn_coord[7] = {100.525, -174.038, 0.813}
  104.         red_spawn_coord[8] = {105.292, -173.656, 0.229}
  105.         blu_spawn_coord[1] = {61.292, -65.713, 1.693}
  106.         blu_spawn_coord[2] = {57.520, -65.796, 1.233}
  107.         blu_spawn_coord[3] = {53.473, -66.050, 0.927}
  108.         blu_spawn_coord[4] = {49.578, -66.108, 0.848}
  109.         blu_spawn_coord[5] = {32.593, -65.859, 0.447}
  110.         blu_spawn_coord[6] = {29.079, -65.796, 0.793}
  111.         blu_spawn_coord[7] = {26.038, -65.906, 1.243}
  112.         blu_spawn_coord[8] = {23.010, -65.879, 1.813}
  113.     elseif map_name == "dangercanyon" then
  114.         red_spawn_coord[1] = {-16.254, -1.222, -4.030}
  115.         red_spawn_coord[2] = {-16.235, -5.483, -4.030}
  116.         red_spawn_coord[3] = {-15.767, 2.010, -4.000}
  117.         red_spawn_coord[4] = {-14.096, -7.125, -4.000}
  118.         red_spawn_coord[5] = {-6.198, -0.202, -4.028}
  119.         red_spawn_coord[6] = {-8.746, -7.146, -4.025}
  120.         red_spawn_coord[7] = {-3.195, -6.566, -4.022}
  121.         red_spawn_coord[8] = {-3.244, -1.144, -4.028}
  122.         blu_spawn_coord[1] = {16.140, -1.544, -4.030}
  123.         blu_spawn_coord[2] = {16.068, -5.484, -4.030}
  124.         blu_spawn_coord[3] = {15.730, 1.627, -3.990}
  125.         blu_spawn_coord[4] = {13.715, -7.029, -3.990}
  126.         blu_spawn_coord[5] = {3.785, -1.194, -4.028}
  127.         blu_spawn_coord[6] = {3.375, -6.669, -4.022}
  128.         blu_spawn_coord[7] = {5.585, -1.158, -3.998}
  129.         blu_spawn_coord[8] = {8.429, -6.587, -4.025}   
  130.     elseif map_name == "deathisland" then
  131.         red_spawn_coord[1] = {-36.889, -4.007, 9.417}
  132.         red_spawn_coord[2] = {-36.853, -9.937, 9.417}
  133.         red_spawn_coord[3] = {-38.445, -2.989, 5.744}
  134.         red_spawn_coord[4] = {-37.452, -11.724, 5.056}
  135.         red_spawn_coord[5] = {-39.155, -5.780, 5.225}
  136.         red_spawn_coord[6] = {-39.095, -8.268, 5.064}
  137.         red_spawn_coord[7] = {-41.475, -5.493, 4.936}
  138.         red_spawn_coord[8] = {-41.673, -8.819, 4.706}
  139.         blu_spawn_coord[1] = {40.430, 13.260, 8.050}
  140.         blu_spawn_coord[2] = {40.381, 18.714, 8.050}
  141.         blu_spawn_coord[3] = {40.268, 11.340, 4.605}
  142.         blu_spawn_coord[4] = {40.245, 20.333, 4.498}
  143.         blu_spawn_coord[5] = {42.548, 15.075, 4.772}
  144.         blu_spawn_coord[6] = {42.434, 17.335, 4.657}
  145.         blu_spawn_coord[7] = {44.715, 15.356, 4.298}
  146.         blu_spawn_coord[8] = {44.632, 17.430, 4.509}
  147.     elseif map_name == "gephyrophobia" then
  148.         red_spawn_coord[1] = {23.085, -17.469, -15.626}
  149.         red_spawn_coord[2] = {25.546, -18.771, -15.624}
  150.         red_spawn_coord[3] = {28.144, -18.726, -15.624}
  151.         red_spawn_coord[4] = {30.708, -17.435, -15.626}
  152.         red_spawn_coord[5] = {21.866, -20.804, -15.632}
  153.         red_spawn_coord[6] = {25.564, -21.533, -15.632}
  154.         red_spawn_coord[7] = {28.048, -21.506, -15.632}
  155.         red_spawn_coord[8] = {31.697, -20.837, -15.631}
  156.         blu_spawn_coord[1] = {23.064, -126.660, -15.626}
  157.         blu_spawn_coord[2] = {25.562, -125.415, -15.624}
  158.         blu_spawn_coord[3] = {28.091, -125.388, -15.624}
  159.         blu_spawn_coord[4] = {30.670, -126.631, -15.626}
  160.         blu_spawn_coord[5] = {21.893, -123.528, -15.632}
  161.         blu_spawn_coord[6] = {23.724, -124.808, -15.628}
  162.         blu_spawn_coord[7] = {29.853, -124.809, -15.628}
  163.         blu_spawn_coord[8] = {31.707, -123.409, -15.632}
  164.     elseif map_name == "infinity" then
  165.         red_spawn_coord[1] = {-4.009, -141.548, 13.948}
  166.         red_spawn_coord[2] = {-6.345, -138.274, 12.774}
  167.         red_spawn_coord[3] = {-9.914, -139.481, 12.981}
  168.         red_spawn_coord[4] = {-13.352, -137.575, 13.256}
  169.         red_spawn_coord[5] = {-11.814, -135.970, 13.288}
  170.         red_spawn_coord[6] = {-9.080, -134.124, 12.868}
  171.         red_spawn_coord[7] = {-6.184, -134.323, 12.745}
  172.         red_spawn_coord[8] = {-8.609, -137.069, 12.865}
  173.         blu_spawn_coord[1] = {15.132, -140.947, 12.237}
  174.         blu_spawn_coord[2] = {7.642, -140.089, 12.666}
  175.         blu_spawn_coord[3] = {5.193, -142.325, 13.779}
  176.         blu_spawn_coord[4] = {13.618, -138.929, 11.898}
  177.         blu_spawn_coord[5] = {16.507, -132.527, 14.684}
  178.         blu_spawn_coord[6] = {14.987, -136.355, 12.257}
  179.         blu_spawn_coord[7] = {9.523, -135.474, 12.582}
  180.         blu_spawn_coord[8] = {6.412, -133.836, 12.622}
  181.     elseif map_name == "icefields" then
  182.         red_spawn_coord[1] = {33.716, -30.292, 0.814}
  183.         red_spawn_coord[2] = {28.352, -33.786, 1.779}
  184.         red_spawn_coord[3] = {21.291, -33.896, 1.742}
  185.         red_spawn_coord[4] = {18.527, -33.562, 0.919}
  186.         red_spawn_coord[5] = {36.429, -26.407, 0.852}
  187.         red_spawn_coord[6] = {13.779, -25.712, 0.865}
  188.         red_spawn_coord[7] = {14.735, -26.288, 0.755}
  189.         red_spawn_coord[8] = {34.516, -25.876, 0.787}
  190.         blu_spawn_coord[1] = {-84.048, 97.797, 1.206}
  191.         blu_spawn_coord[2] = {-81.324, 98.501, 1.873}
  192.         blu_spawn_coord[3] = {-74.521, 98.328, 1.805}
  193.         blu_spawn_coord[4] = {-71.704, 97.779, 0.874}
  194.         blu_spawn_coord[5] = {-67.641, 91.366, 0.786}
  195.         blu_spawn_coord[6] = {-87.249, 91.701, 0.730}
  196.         blu_spawn_coord[7] = {-67.949, 90.537, 0.749}
  197.         blu_spawn_coord[8] = {-86.628, 90.800, 0.746}
  198.     elseif map_name == "sidewinder" then
  199.         red_spawn_coord[1] = {-28.435, -29.414, -3.84}
  200.         red_spawn_coord[2] = {-30.924, -28.509, -3.841}
  201.         red_spawn_coord[3] = {-33.996, -28.264, -3.835}
  202.         red_spawn_coord[4] = {-36.305, -28.492, -3.744}
  203.         red_spawn_coord[5] = {-41.707, -28.023, -3.745}
  204.         red_spawn_coord[6] = {-35.948, -24.355, -3.607}
  205.         red_spawn_coord[7] = {-27.586, -27.538, -3.841}
  206.         red_spawn_coord[8] = {-23.380, -28.505, -3.841}
  207.         blu_spawn_coord[1] = {33.463, -33.008, -3.841}
  208.         blu_spawn_coord[2] = {31.670, -32.148, -3.815}
  209.         blu_spawn_coord[3] = {29.094, -32.326, -3.803}
  210.         blu_spawn_coord[4] = {27.602, -32.158, -3.776}
  211.         blu_spawn_coord[5] = {38.559, -30.418, -3.839}
  212.         blu_spawn_coord[6] = {34.422, -27.695, -3.648}
  213.         blu_spawn_coord[7] = {26.203, -27.890, -3.658}
  214.         blu_spawn_coord[8] = {21.464, -30.625, -3.841}
  215.     elseif map_name == "timberland" then
  216.         red_spawn_coord[1] = {-28.435, -29.414, -3.84}
  217.         red_spawn_coord[2] = {-30.924, -28.509, -3.841}
  218.         red_spawn_coord[3] = {-33.996, -28.264, -3.835}
  219.         red_spawn_coord[4] = {-36.305, -28.492, -3.744}
  220.         red_spawn_coord[5] = {-41.707, -28.023, -3.745}
  221.         red_spawn_coord[6] = {-35.948, -24.355, -3.607}
  222.         red_spawn_coord[7] = {-27.586, -27.538, -3.841}
  223.         red_spawn_coord[8] = {-23.380, -28.505, -3.841}
  224.         blu_spawn_coord[1] = {-23.846, 50.052, -17.228}
  225.         blu_spawn_coord[2] = {-19.738, 48.242, -17.692}
  226.         blu_spawn_coord[3] = {-17.530, 46.434, -17.954}
  227.         blu_spawn_coord[4] = {-15.200, 46.523, -17.872}
  228.         blu_spawn_coord[5] = {-13.178, 48.048, -17.714}
  229.         blu_spawn_coord[6] = {-7.965, 47.485, -17.085}
  230.         blu_spawn_coord[7] = {-12.055, 49.968, -17.395}
  231.         blu_spawn_coord[8] = {-20.413, 50.131, -17.395}    
  232.     end
  233. end
  234.  
  235. -- Created by H® Shaft thank you to Oxide, AelitePrime, Nugget & Wizard.
  236. -- Visit http://halorace.org/forum/index.php?topic=514.0 or
  237. -- Visit http://pastebin.com/u/HR_Shaft for more phasor scripts
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement