Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[ ### -- Team Race Spawning -- ###]]--
- --[[ ### by H® Shaft ###]]--
- --[[ ### v 1.1 for Phasor v2 ###]]--
- -- All players spawn at their own teams base (eliminates random spawning with opposing team which normally instigates slayer-play). Added thanks to Oxide for spawn view vector update
- -- Designed for Team Race
- -- Designed for these maps only:
- -- bloodgulch
- -- dangercanyon
- -- deathisland
- -- gephyrophobia
- -- infinity
- -- icefields
- -- sidewinder
- -- timberland
- red_spawn_coord = {}
- blu_spawn_coord = {}
- team_play = false
- function GetRequiredVersion()
- return 200
- end
- function OnScriptLoad(process, game, persistent)
- if game == true or game == "PC" then
- GAME = "PC"
- map_name = readstring(0x698F21)
- gametype_base = 0x671340
- else
- GAME = "CE"
- map_name = readstring(0x61D151)
- gametype_base = 0x5F5498
- end
- team_play = getteamplay()
- LoadCoords()
- end
- function OnNewGame(map)
- if GAME == "PC" then
- map_name = readstring(0x698F21)
- gametype_base = 0x671340
- elseif GAME == "CE" then
- map_name = readstring(0x61D151)
- gametype_base = 0x5F5498
- end
- team_play = getteamplay()
- LoadCoords()
- if map_name == "bloodgulch" then
- red_rot = createobject(gettagid("scen", "scenery\\flag_base\\flag_base"), 0, 0, false, 60.987, -121.606, 0.274)
- blue_rot = createobject(gettagid("scen", "scenery\\flag_base\\flag_base"), 0, 0, false, 60.987, -121.606, 0.274)
- elseif map_name == "dangercanyon" then
- red_rot = createobject(gettagid("scen", "scenery\\flag_base\\flag_base"), 0, 0, false, -37.219, 0.058, -2.172)
- blue_rot = createobject(gettagid("scen", "scenery\\flag_base\\flag_base"), 0, 0, false, 37.756, 0.404, -2.172)
- elseif map_name == "deathisland" then
- red_rot = createobject(gettagid("scen", "scenery\\flag_base\\flag_base"), 0, 0, false, -61.327, -9.832, 1.843)
- blue_rot = createobject(gettagid("scen", "scenery\\flag_base\\flag_base"), 0, 0, false, 55.415, 13.656, 1.775)
- elseif map_name == "gephyrophobia" then
- red_rot = createobject(gettagid("scen", "scenery\\flag_base\\flag_base"), 0, 0, false, 26.831, -72.683, -10.699)
- blue_rot = createobject(gettagid("scen", "scenery\\flag_base\\flag_base"), 0, 0, false, 26.831, -72.683, -10.699)
- elseif map_name == "infinity" then
- red_rot = createobject(gettagid("scen", "scenery\\flag_base\\flag_base"), 0, 0, false, 0.676, -164.567, 15.049)
- blue_rot = createobject(gettagid("scen", "scenery\\flag_base\\flag_base"), 0, 0, false, 0.676, -164.567, 15.049)
- elseif map_name == "icefields" then
- red_rot = createobject(gettagid("scen", "scenery\\flag_base\\flag_base"), 0, 0, false, 19.573, -2.920, 0.791)
- blue_rot = createobject(gettagid("scen", "scenery\\flag_base\\flag_base"), 0, 0, false, -72.611, 67.428, 0.781)
- elseif map_name == "sidewinder" then
- red_rot = createobject(gettagid("scen", "scenery\\flag_base\\flag_base"), 0, 0, false, 2.708, 55.001, -2.791)
- blue_rot = createobject(gettagid("scen", "scenery\\flag_base\\flag_base"), 0, 0, false, 2.708, 55.001, -2.791)
- elseif map_name == "timberland" then
- red_rot = createobject(gettagid("scen", "scenery\\flag_base\\flag_base"), 0, 0, false, 16.607, -31.762, -15.401)
- blue_rot = createobject(gettagid("scen", "scenery\\flag_base\\flag_base"), 0, 0, false, -15.884, 31.805, -15.291)
- end
- end
- function getteamplay()
- if readbyte(gametype_base + 0x34) == 1 then
- return true
- else
- return false
- end
- end
- function OnPlayerSpawn(player, m_objectId)
- if team_play then
- local team = getteam(player)
- local m_object = getobject(m_objectId)
- if team == 0 then
- local redcoord = SelectRedSpawnCoord()
- if redcoord then
- movobjectcoords(m_objectId, red_spawn_coord[redcoord][1], red_spawn_coord[redcoord][2], red_spawn_coord[redcoord][3])
- local fx, fy, fz = getobjectcoords(red_rot)
- local px, py, pz = getobjectcoords(m_objectId)
- local vx = fx - px
- local vy = fy - py
- local vz = fz - pz
- -- normalize it
- local magnitude = math.sqrt(vx*vx + vy*vy + vz*vz)
- vx = vx / magnitude
- vy = vy / magnitude
- vz = vz / magnitude
- writefloat(m_object + 0x74, vx)
- writefloat(m_object + 0x78, vy)
- writefloat(m_object + 0x7c, vz)
- end
- elseif team == 1 then
- local blucoord = SelectBluSpawnCoord()
- if blucoord then
- movobjectcoords(m_objectId, blu_spawn_coord[blucoord][1], blu_spawn_coord[blucoord][2], blu_spawn_coord[blucoord][3])
- local fx, fy, fz = getobjectcoords(blue_rot)
- local px, py, pz = getobjectcoords(m_objectId)
- local vx = fx - px
- local vy = fy - py
- local vz = fz - pz
- -- normalize it
- local magnitude = math.sqrt(vx*vx + vy*vy + vz*vz)
- vx = vx / magnitude
- vy = vy / magnitude
- vz = vz / magnitude
- writefloat(m_object + 0x74, vx)
- writefloat(m_object + 0x78, vy)
- writefloat(m_object + 0x7c, vz)
- end
- end
- end
- end
- function SelectRedSpawnCoord(arg)
- local redspawncount = #red_spawn_coord
- if redspawncount > 0 then
- return getrandomnumber(1, redspawncount+1)
- end
- return nil
- end
- function SelectBluSpawnCoord(arg)
- local bluspawncount = #blu_spawn_coord
- if bluspawncount > 0 then
- return getrandomnumber(1, bluspawncount+1)
- end
- return nil
- end
- function LoadCoords()
- if map_name == "bloodgulch" then
- red_spawn_coord[1] = {68.911, -173.686, 1.815}
- red_spawn_coord[2] = {74.323, -173.370, 0.817}
- red_spawn_coord[3] = {79.380, -173.402, 0.410}
- red_spawn_coord[4] = {84.011, -173.499, 0.307}
- red_spawn_coord[5] = {89.487, -173.463, 0.344}
- red_spawn_coord[6] = {95.069, -173.863, 0.718}
- red_spawn_coord[7] = {100.525, -174.038, 0.813}
- red_spawn_coord[8] = {105.292, -173.656, 0.229}
- blu_spawn_coord[1] = {61.292, -65.713, 1.693}
- blu_spawn_coord[2] = {57.520, -65.796, 1.233}
- blu_spawn_coord[3] = {53.473, -66.050, 0.927}
- blu_spawn_coord[4] = {49.578, -66.108, 0.848}
- blu_spawn_coord[5] = {32.593, -65.859, 0.447}
- blu_spawn_coord[6] = {29.079, -65.796, 0.793}
- blu_spawn_coord[7] = {26.038, -65.906, 1.243}
- blu_spawn_coord[8] = {23.010, -65.879, 1.813}
- elseif map_name == "dangercanyon" then
- red_spawn_coord[1] = {-16.254, -1.222, -4.030}
- red_spawn_coord[2] = {-16.235, -5.483, -4.030}
- red_spawn_coord[3] = {-15.767, 2.010, -4.000}
- red_spawn_coord[4] = {-14.096, -7.125, -4.000}
- red_spawn_coord[5] = {-6.198, -0.202, -4.028}
- red_spawn_coord[6] = {-8.746, -7.146, -4.025}
- red_spawn_coord[7] = {-3.195, -6.566, -4.022}
- red_spawn_coord[8] = {-3.244, -1.144, -4.028}
- blu_spawn_coord[1] = {16.140, -1.544, -4.030}
- blu_spawn_coord[2] = {16.068, -5.484, -4.030}
- blu_spawn_coord[3] = {15.730, 1.627, -3.990}
- blu_spawn_coord[4] = {13.715, -7.029, -3.990}
- blu_spawn_coord[5] = {3.785, -1.194, -4.028}
- blu_spawn_coord[6] = {3.375, -6.669, -4.022}
- blu_spawn_coord[7] = {5.585, -1.158, -3.998}
- blu_spawn_coord[8] = {8.429, -6.587, -4.025}
- elseif map_name == "deathisland" then
- red_spawn_coord[1] = {-36.889, -4.007, 9.417}
- red_spawn_coord[2] = {-36.853, -9.937, 9.417}
- red_spawn_coord[3] = {-38.445, -2.989, 5.744}
- red_spawn_coord[4] = {-37.452, -11.724, 5.056}
- red_spawn_coord[5] = {-39.155, -5.780, 5.225}
- red_spawn_coord[6] = {-39.095, -8.268, 5.064}
- red_spawn_coord[7] = {-41.475, -5.493, 4.936}
- red_spawn_coord[8] = {-41.673, -8.819, 4.706}
- blu_spawn_coord[1] = {40.430, 13.260, 8.050}
- blu_spawn_coord[2] = {40.381, 18.714, 8.050}
- blu_spawn_coord[3] = {40.268, 11.340, 4.605}
- blu_spawn_coord[4] = {40.245, 20.333, 4.498}
- blu_spawn_coord[5] = {42.548, 15.075, 4.772}
- blu_spawn_coord[6] = {42.434, 17.335, 4.657}
- blu_spawn_coord[7] = {44.715, 15.356, 4.298}
- blu_spawn_coord[8] = {44.632, 17.430, 4.509}
- elseif map_name == "gephyrophobia" then
- red_spawn_coord[1] = {23.064, -126.660, -15.626}
- red_spawn_coord[2] = {25.562, -125.415, -15.624}
- red_spawn_coord[3] = {28.091, -125.388, -15.624}
- red_spawn_coord[4] = {30.670, -126.631, -15.626}
- red_spawn_coord[5] = {21.893, -123.528, -15.632}
- red_spawn_coord[6] = {23.724, -124.808, -15.628}
- red_spawn_coord[7] = {29.853, -124.809, -15.628}
- red_spawn_coord[8] = {31.707, -123.409, -15.632}
- blu_spawn_coord[1] = {23.085, -17.469, -15.626}
- blu_spawn_coord[2] = {25.546, -18.771, -15.624}
- blu_spawn_coord[3] = {28.144, -18.726, -15.624}
- blu_spawn_coord[4] = {30.708, -17.435, -15.626}
- blu_spawn_coord[5] = {21.866, -20.804, -15.632}
- blu_spawn_coord[6] = {25.564, -21.533, -15.632}
- blu_spawn_coord[7] = {28.048, -21.506, -15.632}
- blu_spawn_coord[8] = {31.697, -20.837, -15.631}
- elseif map_name == "infinity" then
- red_spawn_coord[1] = {-4.009, -141.548, 13.948}
- red_spawn_coord[2] = {-6.345, -138.274, 12.774}
- red_spawn_coord[3] = {-9.914, -139.481, 12.981}
- red_spawn_coord[4] = {-13.352, -137.575, 13.256}
- red_spawn_coord[5] = {-11.814, -135.970, 13.288}
- red_spawn_coord[6] = {-9.080, -134.124, 12.868}
- red_spawn_coord[7] = {-6.184, -134.323, 12.745}
- red_spawn_coord[8] = {-8.609, -137.069, 12.865}
- blu_spawn_coord[1] = {15.132, -140.947, 12.237}
- blu_spawn_coord[2] = {7.642, -140.089, 12.666}
- blu_spawn_coord[3] = {5.193, -142.325, 13.779}
- blu_spawn_coord[4] = {13.618, -138.929, 11.898}
- blu_spawn_coord[5] = {16.507, -132.527, 14.684}
- blu_spawn_coord[6] = {14.987, -136.355, 12.257}
- blu_spawn_coord[7] = {9.523, -135.474, 12.582}
- blu_spawn_coord[8] = {6.412, -133.836, 12.622}
- elseif map_name == "icefields" then
- red_spawn_coord[1] = {33.716, -30.292, 0.814}
- red_spawn_coord[2] = {28.352, -33.786, 1.779}
- red_spawn_coord[3] = {21.291, -33.896, 1.742}
- red_spawn_coord[4] = {18.527, -33.562, 0.919}
- red_spawn_coord[5] = {36.429, -26.407, 0.852}
- red_spawn_coord[6] = {13.779, -25.712, 0.865}
- red_spawn_coord[7] = {14.735, -26.288, 0.755}
- red_spawn_coord[8] = {34.516, -25.876, 0.787}
- blu_spawn_coord[1] = {-84.048, 97.797, 1.206}
- blu_spawn_coord[2] = {-81.324, 98.501, 1.873}
- blu_spawn_coord[3] = {-74.521, 98.328, 1.805}
- blu_spawn_coord[4] = {-71.704, 97.779, 0.874}
- blu_spawn_coord[5] = {-67.641, 91.366, 0.786}
- blu_spawn_coord[6] = {-87.249, 91.701, 0.730}
- blu_spawn_coord[7] = {-67.949, 90.537, 0.749}
- blu_spawn_coord[8] = {-86.628, 90.800, 0.746}
- elseif map_name == "sidewinder" then
- red_spawn_coord[1] = {-28.435, -29.414, -3.84}
- red_spawn_coord[2] = {-30.924, -28.509, -3.841}
- red_spawn_coord[3] = {-33.996, -28.264, -3.835}
- red_spawn_coord[4] = {-36.305, -28.492, -3.744}
- red_spawn_coord[5] = {-41.707, -28.023, -3.745}
- red_spawn_coord[6] = {-35.948, -24.355, -3.607}
- red_spawn_coord[7] = {-27.586, -27.538, -3.841}
- red_spawn_coord[8] = {-23.380, -28.505, -3.841}
- blu_spawn_coord[1] = {33.463, -33.008, -3.841}
- blu_spawn_coord[2] = {31.670, -32.148, -3.815}
- blu_spawn_coord[3] = {29.094, -32.326, -3.803}
- blu_spawn_coord[4] = {27.602, -32.158, -3.776}
- blu_spawn_coord[5] = {38.559, -30.418, -3.839}
- blu_spawn_coord[6] = {34.422, -27.695, -3.648}
- blu_spawn_coord[7] = {26.203, -27.890, -3.658}
- blu_spawn_coord[8] = {21.464, -30.625, -3.841}
- elseif map_name == "timberland" then
- red_spawn_coord[1] = {24.903, -49.360, -17.249}
- red_spawn_coord[2] = {23.912, -45.946, -17.514}
- red_spawn_coord[3] = {20.483, -48.143, -17.734}
- red_spawn_coord[4] = {20.946, -50.218, -17.584}
- red_spawn_coord[5] = {18.867, -45.628, -18.047}
- red_spawn_coord[6] = {15.356, -45.680, -17.951}
- red_spawn_coord[7] = {13.913, -48.065, -17.71}
- red_spawn_coord[8] = {10.964, -48.303, -17.250}
- blu_spawn_coord[1] = {-23.846, 50.052, -17.228}
- blu_spawn_coord[2] = {-19.738, 48.242, -17.692}
- blu_spawn_coord[3] = {-17.530, 46.434, -17.954}
- blu_spawn_coord[4] = {-15.200, 46.523, -17.872}
- blu_spawn_coord[5] = {-13.178, 48.048, -17.714}
- blu_spawn_coord[6] = {-7.965, 47.485, -17.085}
- blu_spawn_coord[7] = {-12.055, 49.968, -17.395}
- blu_spawn_coord[8] = {-20.413, 50.131, -17.395}
- end
- end
- -- Created by H® Shaft thank you to Oxide, AelitePrime, Nugget & Wizard.
- -- Visit http://halorace.org/forum/index.php?topic=514.0 or
- -- Visit http://pastebin.com/u/HR_Shaft for more phasor scripts
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement