--[[ --LMOTH v1.4 --By Darren Watts (W'rkncacnter) --]] Triggers = {} SHORT_ROUNDS = 750 -- Short rounds < 4 people MED_ROUNDS = 750--1050 Med < 6 LONG_ROUNDS = 900--1350 just_reset = true reset_timer = 90 team = false COUNTDOWN = LONG_ROUNDS timer = 0 in_first = nil in_second = nil in_third = nil in_fourth = nil contested = false delayed_reset = false beacon_x = nil beacon_y = nil end_game = false end_timer = 210 RESET_AMT = 120 dead_body_repository = nil -- Keep those dead bastards out of liquid POPE_MODE = false -- The pope loves the diluted SPAZ_AMT = 90 -- How much do you suck? hex = {} hex.slate, hex[0] = '205DA0', '205DA0' hex.red, hex[1] = 'F80000', 'F80000' hex.violet, hex[2] = 'B00258', 'B00258' hex.yellow, hex[3] = 'F9F800', 'F9F800' hex.white, hex[4] = 'E9EFE8', 'E9EFE8' hex.orange, hex[5] = 'F05800', 'F05800' hex.blue, hex[6] = '0807F8', '0807F8' hex.green, hex[7] = '01F800', '01F800' hex.neutral, hex[8] = '7F7F7F', '7F7F7F' icon_shape = [[ 1 #COLOR ################ ################ ################ ################ ################ ################ ################ ################ ################ ################ ################ ################ ################ ################ ################ ################ ]] function Triggers.init() for p in Players() do -- Set up custom fields for player p._spawn = p.monster.polygon p._score = 0 p._waiting = false p._wants_cameras = true p._camera = Cameras.new() p._spaz_timer = 0 if(p.color ~= p.team) then teams = true end p.color = p.team end for poly in Polygons() do if(poly.type == "hill") then beacon_x = poly.x beacon_y = poly.y if(poly.media == nil) then dead_body_repository = poly -- I find that hills are always the best places to hide dead bodies end break end end if(dead_body_repository == nil) then for poly in Polygons() do if(poly.media == nil) then dead_body_repository = poly break end end end if(dead_body_repository == nil) then dead_body_repository = Polygons[0] end for p in Players() do p.compass.x = beacon_x p.compass.y = beacon_y p.compass.lua = true p.compass.beacon = true end if(#Players < 4) then COUNTDOWN = SHORT_ROUNDS elseif(#Players < 6) then COUNTDOWN = MED_ROUNDS else COUNTDOWN = LONG_ROUNDS end timer = COUNTDOWN end function Triggers.idle() if(end_game) then end_timer = end_timer - 1 if(end_timer < 0) then Game.over = true -- This will happen a lot. Have you seen the retards that try to host games? end end if(Game.type == "netscript") then if(beacon_x == nil or beacon_y == nil) then Players.print("Hey numbnuts, you're supposed to host this on a map with a hill.") Players.print(" ") Players.print(" ") Players.print(" ") Players.print(" ") Players.print(" ") Players.print(" ") end_game = true else lolstuff() end else Players.print("Hey numbnuts, you're supposed to host this with the netscript gametype.") Players.print(" ") Players.print(" ") Players.print(" ") Players.print(" ") Players.print(" ") Players.print(" ") end_game = true end end function lolstuff() -- This function does stuff. hill_status() timer_stuff() control_revives() omgcameras() overlay() update_score() end_round_early() lua_compass() play_sound() loldeadbody() one_place_per_team() end -- Your mom does stuff also. function Triggers.player_killed(player, aggressor_player, action, projectile) if(not just_reset) then player._waiting = true end player._spaz_timer = SPAZ_AMT if((in_first == nil or player.team ~= in_first.team) and player ~= agressor_player and not just_reset and no_one_on_hill() and player.monster.polygon.type == "hill") then capture_hill(player) end end function no_one_on_hill() for p in Players() do if(not p.dead and p.monster.polygon.type == "hill") then return false end end return true end function Triggers.item_created(item) if(item == "infravision") then -- Fuck infravision item:delete() end end function timer_stuff() if(timer > 0) then timer = timer - 1 elseif(not contested and not delayed_reset) then end_round(0) elseif(not contested and delayed_reset) then timer = 90 delayed_reset = false else -- timer hits 0 while contested delayed_reset = true end if(timer == COUNTDOWN - 90) then in_first = nil in_second = nil in_third = nil in_fourth = nil end if(reset_timer > 0) then reset_timer = reset_timer - 1 else just_reset = false end for p in Players() do if(p._spaz_timer > 0) then p._spaz_timer = p._spaz_timer - 1 -- All good things must come to an end eventually. end if(just_reset) then p._spaz_timer = 0 end end end function hill_status() local plrs = {} local was_contested = contested contested = false local num_plrs = 0 for p in Players() do if(p.monster.polygon.type == "hill" and not p.dead) then num_plrs = num_plrs + 1 plrs[num_plrs] = p end end local controlling_plr = plrs[1] local newly_contested = false if(controlling_plr ~= nil) then for i = 0, num_plrs-1, 1 do local p = plrs[i+1] if(p.team ~= controlling_plr.team) then if(not was_contested) then newly_contested = true end contested = true break end end if(not contested) then if(in_first == nil or (not (controlling_plr.team == in_first.team))) then capture_hill(controlling_plr) end if(in_third == in_second or in_third == in_first) then in_third = nil end in_fourth = nil else if(newly_contested) then in_fourth = in_third in_third = in_second in_second = in_first in_first = nil end end end end function capture_hill(controlling_plr) -- This method is bullshit. if(in_second ~= nil and controlling_plr.team == in_second.team and in_first == nil) then in_first = in_second in_second = in_third in_third = in_fourth elseif(in_second ~= nil and controlling_plr.team == in_second.team) then in_second = in_first in_first = controlling_plr elseif(in_third ~= nil and controlling_plr.team == in_third.team and in_first == nil) then in_first = in_third in_third = nil elseif(in_third ~= nil and controlling_plr.team == in_third.team) then in_third = in_second in_second = in_first in_first = controlling_plr else if(in_first == nil) then in_first = controlling_plr else in_third = in_second in_second = in_first in_first = controlling_plr end end end function end_round(situation) if(in_first ~= nil) then if(situation == 0) then if(teams) then Players.print(string.upper(in_first.team.mnemonic).." wins the round!") else Players.print(in_first.name.." wins the round!") end elseif(situation == 1) then if(teams) then Players.print(string.upper(in_first.team.mnemonic).." wins the round!".." (Last team standing)") else Players.print(in_first.name.." wins the round!".." (Last man standing)") end elseif(situation == 2) then if(teams) then Players.print(string.upper(in_first.team.mnemonic).." wins the round!".." (All players dead)") else Players.print(in_first.name.." wins the round!".." (All players dead)") end end elseif(in_second ~= nil) then if(teams) then Players.print(string.upper(in_second.team.mnemonic).." wins the round!") else Players.print(in_second.name.." wins the round!") end elseif(in_third ~= nil) then if(teams) then Players.print(string.upper(in_third.team.mnemonic).." wins the round!") else Players.print(in_third.name.." wins the round!") end else Players.print("You all suck.") -- Seriously dudes, are you retarded? end if(in_first ~= nil) then in_first._score = in_first._score + 3 end if(in_second ~= nil) then in_second._score = in_second._score + 2 if(in_first == nil) then in_second._score = in_second._score + 1 end end if(in_third ~= nil) then in_third._score = in_third._score + 1 end just_reset = true for p in Players() do if(not p.dead) then p:damage(1000) -- Stomped. end p._waiting = false end timer = COUNTDOWN reset_timer = RESET_AMT end function control_revives() for p in Players() do if(p._waiting) then if(p.action_flags.action_trigger == true) then if(p._wants_cameras) then p._wants_cameras = false else p._wants_cameras = true end end p.action_flags.action_trigger = false end if(p.dead and not p._waiting) then p.action_flags.action_trigger = true end end end function omgcameras() -- It's really not that exciting local plr_to_watch for p in Players() do plr_to_watch = nil if(p._waiting and p._wants_cameras) then -- Check teammates first for plr in Players() do if(p.team == plr.team and not plr.dead) then plr_to_watch = plr break end end -- Check remaining alive players if(plr_to_watch == nil) then for plr in Players() do if(not plr.dead) then plr_to_watch = plr break end end end -- Set up camera to follow the MUTHAFUCKA TARGET if(plr_to_watch ~= nil) then p:view_player(plr_to_watch) else p:view_player(p) end else p:view_player(p) end end end function overlay() for p in Players() do if(timer > 150) then p.overlays[0].color = "green" else p.overlays[0].color = "red" end p.overlays[0].text = math.floor(timer / 30) p.overlays[1].color = "green" if(in_first ~= nil) then p.overlays[1].icon = get_icon(in_first.team.mnemonic) else p.overlays[1].icon = get_icon("neutral") end p.overlays[2].color = "green" if(in_second ~= nil) then p.overlays[2].icon = get_icon(in_second.team.mnemonic) else p.overlays[2].icon = get_icon("neutral") end p.overlays[3].color = "green" if(in_third ~= nil) then p.overlays[3].icon = get_icon(in_third.team.mnemonic) else p.overlays[3].icon = get_icon("neutral") end if(teams) then if(in_first ~= nil) then p.overlays[1].text = string.upper(in_first.team.mnemonic) else p.overlays[1].text = "N/A" end if(in_second ~= nil) then p.overlays[2].text = string.upper(in_second.team.mnemonic) else p.overlays[2].text = "N/A" end if(in_third ~= nil) then p.overlays[3].text = string.upper(in_third.team.mnemonic) else p.overlays[3].text = "N/A" end else if(in_first ~= nil) then p.overlays[1].text = string.sub(in_first.name, 1, 12) else p.overlays[1].text = "N/A" end if(in_second ~= nil) then p.overlays[2].text = string.sub(in_second.name, 1, 12) else p.overlays[2].text = "N/A" end if(in_third ~= nil) then p.overlays[3].text = string.sub(in_third.name, 1, 12) else p.overlays[3].text = "N/A" end end if(not p.dead and get_teams_left() == 1) then p.overlays[5].color = "red" p.overlays[5].text = " LAST MAN STANDING" else p.overlays[5].text = "" end if(POPE_MODE) then -- Because I'm a douchebag. p.overlays[5].color = "red" if(p._spaz_timer > 0) then p.overlays[5].text = " POPE MODE!" else p.overlays[5].text = "" end end end end function get_icon(color) --takes mnemonic or index return string.gsub(icon_shape, "COLOR", hex[color]) -- Thanks irons. It feels weird to thank myself though. end function update_score() for p in Players() do p.points = p._score end end function end_round_early() local num_alive = 0 local alive_plr = nil for p in Players() do if(not p.dead) then num_alive = num_alive + 1 alive_plr = p end end if(num_alive == 1 and not just_reset) then if(in_first == alive_plr) then end_round(1) return end end if(num_alive == 0 and not just_reset) then end_round(2) return end -- Check teams if(not just_reset and teams and get_teams_left() == 1 and team_left_has_hill()) then end_round(1) end end function get_teams_left() -- The gay lua way. local teams = {} for p in Players() do if(not p.dead) then local team = p.team if(# teams == 0) then teams[1] = team end for k = 1, # teams, 1 do if(teams[k] == team) then break elseif(teams[k] ~= team and k == # teams) then teams[# teams+1] = team end end end end return # teams end function team_left_has_hill() for p in Players() do if(not p.dead) then if(in_first ~= nil and in_first.team == p.team) then return true else return false end end end return false end function lua_compass() for p in Players() do if(p.monster.polygon.type == "hill") then p.compass:all_on() else p.compass.beacon = true end end end function play_sound() -- Annoying sounds are always necessary. if(timer == 150 or timer == 120 or timer == 90 or timer == 60 or timer == 30) then for p in Players() do p:play_sound("computer login", 1.3) end end end function loldeadbody() -- There's nothing funnier than a dead body. for p in Players() do if(POPE_MODE) then if(p.dead and p._waiting and p._spaz_timer > 0) then p:teleport(dead_body_repository) elseif(p.dead and p._waiting) then p:position(dead_body_repository.x, dead_body_repository.y, dead_body_repository.z, dead_body_repository) p.external_velocity.x = 0 p.external_velocity.y = 0 p.external_velocity.z = 0 end elseif(p.dead and p._waiting and p.monster.polygon ~= dead_body_repository and p.head_below_media) then p:position(dead_body_repository.x, dead_body_repository.y, dead_body_repository.z, dead_body_repository) p.external_velocity.x = 0 p.external_velocity.y = 0 p.external_velocity.z = 0 end end end function one_place_per_team() -- Horrible hack if(in_first ~= nil and in_second ~= nil and in_first.team == in_second.team) then in_second = in_third in_third = in_fourth end if(in_first ~= nil and in_third ~= nil and in_first.team == in_third.team) then in_third = in_fourth end if(in_first ~= nil and in_fourth ~= nil and in_first.team == in_fourth.team) then in_fourth = nil end if(in_second ~= nil and in_third ~= nil and in_second.team == in_third.team) then in_third = in_fourth end if(in_second ~= nil and in_fourth ~= nil and in_second.team == in_fourth.team) then in_fourth = nil end if(in_third ~= nil and in_fourth~= nil and in_third.team == in_fourth.team) then in_fourth = nil end if(in_third == nil and in_fourth ~= nil) then in_third = in_fourth in_fourth = nil end end