Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[ ### Custom Team and FFA Colors ###]]--
- --[[ ### by H® Shaft for Phasor v2+ ###]]--
- -- Team Games: allows you to set custom colors for each team (see color table and selected team colors below)
- -- FFA games: each time a player spawns, they are given a new random color.
- -- inspired by: AelitePrimes Colored Team Gametypes. Numerous rgb offsets published by Wizard,
- -- Correct rgb offsets found by 002 in his SAPP custom team color script: https://www.dropbox.com/s/91ksoqbsydi49nl/customteamcolors.lua
- -- selected team colors - edit these
- red_color[1] = {1, 1, 0.003} --"Yellow"
- blue_color[1] = {0, 1, 0.003} --"Green"
- -- team color tables - don't edit
- red_color = {}
- blue_color = {}
- team_play = false
- color_table = {}
- color_table[1] = {0, 0, 0} --"Black"
- color_table[2] = {0.996, 0, 0} --"Red"
- color_table[3] = {0.007, 0.003, 0.890} --"Blue"
- color_table[4] = {0.439, 0.494, 0.443} --"Gray"
- color_table[5] = {1, 1, 0.003} --"Yellow"
- color_table[6] = {0, 1, 0.003} --"Green"
- color_table[7] = {1, 0.337, 0.725} --"Pink"
- color_table[8] = {0.67, 0.062, 0.956} --"Purple"
- color_table[9] = {0.003, 1, 1} --"Cyan"
- color_table[10] = {0.392, 0.576, 0.929} --"Cobalt"
- color_table[11] = {1, 0.498, 0} --"Orange"
- color_table[12] = {0.117, 0.80, 0.568} --"Teal"
- color_table[13] = {0, 0.392, 0.003} --"Sage"
- color_table[14] = {0.376, 0.217, 0.078} --"Brown"
- color_table[15] = {0.776, 0.6117, 0.423} --"Tan"
- color_table[16] = {0.615, 0.043, 0.054} --"Maroon"
- color_table[17] = {0.960, 0.6, 0.619} --"Salmon"
- color_table[18] = {1, 1, 1} -- "White"
- function GetRequiredVersion()
- return 200
- end
- function OnScriptLoad(process, game, persistent)
- GAME = game
- GetGameAddresses(game)
- end
- function OnNewGame(map)
- team_play = getteamplay()
- end
- function OnPlayerSpawn(player, m_objectId)
- if getplayer(player) then
- local m_objectId = getplayerobjectid(player)
- if m_objectId then
- local m_object = getobject(m_objectId)
- if m_object then
- local m_player = getplayer(player)
- if m_player then
- if team_play then
- writebyte(gametype_base + 0x34, 0) -- temporarily sets team game to ffa
- if getteam(player) == 0 then
- writefloat(m_object + 0x1A0, red_color[1][1])
- writefloat(m_object + 0x1A4, red_color[1][2])
- writefloat(m_object + 0x1A8, red_color[1][3])
- else
- writefloat(m_object + 0x1A0, blue_color[1][1])
- writefloat(m_object + 0x1A4, blue_color[1][2])
- writefloat(m_object + 0x1A8, blue_color[1][3])
- end
- toteamplay = registertimer(100, "ToTeamPlay") -- resets game to team game
- else
- local random_color = SelectRandomRGB()
- if random_color ~= nil then
- writefloat(m_object + 0x1A0, color_table[random_color][1])
- writefloat(m_object + 0x1A4, color_table[random_color][2])
- writefloat(m_object + 0x1A8, color_table[random_color][3])
- end
- -- this works too - comment out lines 73-77, uncomment line 79 --
- --ChangeFFAColor(player)
- end
- end
- end
- end
- end
- end
- function ToTeamPlay(id, count)
- writebyte(gametype_base + 0x34, 1)
- return false
- end
- function SelectRandomRGB()
- local colorcount = #color_table
- if colorcount > 0 then
- return getrandomnumber(1, colorcount+1)
- end
- return nil
- end
- function ChangeFFAColor(player)
- if getplayer(player) then
- local m_objectId = getplayerobjectid(player)
- if m_objectId then
- local m_object = getobject(m_objectId)
- if m_object then
- local m_player = getplayer(player)
- local color = getrandomnumber(1, 18)
- writeword(m_player + 0x60, color)
- end
- end
- end
- end
- function GetGameAddresses(game)
- if game == "PC" or GAME == "PC" then
- map_name = readstring(0x698F21)
- gametype_base = 0x671340
- else
- map_name = readstring(0x61D151)
- gametype_base = 0x5F5498
- end
- end
- function getteamplay()
- if readbyte(gametype_base + 0x34) == 1 then
- return true
- else
- return false
- end
- end
- function OnGameEnd(stage)
- if stage == 1 then
- if toteamplay then
- toteamplay = nil
- end
- end
- end
- --[[ Created by H® Shaft.
- Thanks to Oxide, AelitePrime, Wizard -- and 002
- 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