Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Dodgeball
- -- For Stock Halo PC/CE Maps, recommended for small indoor maps with 4 or more players
- -- by H® Shaft
- -- Dodgeball:
- -- Designed for TEAM games only!
- -- Throw a plasma grenade at the enemy, it explodes/kills them immediately then puts them on the killers team.
- -- The round is won when all players are on the same team, and repeats for 3 rounds (editable: see 'max_rounds' below)
- -- The only ways to kill enemies are with Plasma Grenades (Stickies) and Melee
- -- When you kill an enemy, you will be given 2 more Stickies (plasma nades)
- -- When you are killed, you will spawn where you died (editable: see 'spawn_death_coords' below)
- -- At spawn, players are given a shotgun with no ammo, 2 sticky nades, and cannot pickup any other weapons.
- -- Gametype should be TEAM PLAY, Weapons to Normal/Generic, infinite grenades to NO, Auto team balance to YES, Friendly Fire set to OFF
- -- Premade gametype, works with Halo PC and CE: Link: https://www.mediafire.com/?xgrixdwiwwjt8x2
- -- Multiply plasma grenade damaged by this amount (should be greater than 0, 1 for no change, 2 for instant death, no need to go higher)
- damage_multiplier = 2
- -- Join Message
- join_message = "Welcome to DODGEBALL! Type HELP for more info."
- -- grenade quantities (for infinite sticky nades should be left at: frags 0, plasma 99)
- frag_count = 0
- plasma_count = 2
- -- time (in seconds) the last man will be invulnerable
- invulnerable_duration = 10
- -- respawn where you were killed by enemy? (for bloodier games) true = spawn where you die, false = let halo handle it
- spawn_death_coords = true -- disabled for Gephyrophobia, Damnation to prevent respawning mid-air
- -- number of rounds on each map, minimum of 1, dont use 0 or negative numbers
- max_rounds = 3
- -- message shown to team killer
- tk_message = "DON'T KILL OR ATTACK YOUR OWN TEAM!!"
- -- Anounce to all when a player switches teams? Set to false if other scripts already announce this to reduce chat-spam
- announce_team_switch = false
- -- don't edit --
- api_version = "1.9.0.0"
- game_started = false
- team_play = false
- lastman = 0
- cur_round = 1
- temp = {}
- last_damage = {}
- killed_by_nothing = {}
- team_score = {}
- function OnScriptLoad()
- register_callback(cb['EVENT_GAME_START'], "OnNewGame")
- register_callback(cb['EVENT_GAME_END'], "OnGameEnd")
- register_callback(cb['EVENT_SPAWN'], "OnPlayerSpawn")
- register_callback(cb['EVENT_OBJECT_SPAWN'], "OnObjectSpawn")
- register_callback(cb['EVENT_DAMAGE_APPLICATION'], "OnDamageApplication")
- register_callback(cb['EVENT_DIE'], "OnPlayerDie")
- register_callback(cb['EVENT_JOIN'], "OnPlayerJoin")
- register_callback(cb['EVENT_LEAVE'], "OnPlayerLeave")
- register_callback(cb['EVENT_TEAM_SWITCH'], "OnTeamSwitch")
- register_callback(cb['EVENT_CHAT'], "OnPlayerChat")
- if get_var(0, "$gt") ~= "n/a" then
- OnNewGame()
- game_ticks = 0
- team_score["red"] = 0
- team_score["blue"] = 0
- end
- execute_command("block_tc 1")
- execute_command("msg_prefix \"*DODGEBALL* \"")
- end
- function OnScriptUnload()
- temp = {}
- last_damage = {}
- killed_by_nothing = {}
- execute_command("msg_prefix \"** SAPP ** \"")
- execute_command("enable_object weapons\\shotgun\\shotgun")
- end
- function OnNewGame()
- team_score["red"] = 0
- team_score["blue"] = 0
- BalanceTeams()
- game_ticks = 0
- map_name = get_var(0,"$map")
- team_play = getteamplay()
- -- check compatibility
- if not team_play then
- local MODE = get_var(0,"$mode")
- local str1 = string.format("Dodgeball script NOT compatible with FFA gametypes, %s is NOT a team game!", tostring(MODE))
- execute_command("log_note \""..str1.."\"")
- cprint(str1)
- execute_command("sv_map_next")
- for i=1,16 do
- if player_present(i) then
- say(i, str1)
- end
- end
- end
- for i=1,16 do
- if player_present(i) then
- last_damage[i] = 0
- temp[i] = {}
- killed_by_nothing[i] = false
- end
- end
- execute_command("disable_object weapons\\shotgun\\shotgun")
- GetMetaIDs()
- game_started = true
- cur_round = 1
- timer(1000, "NewRound")
- timer(60000, "ShowScores")
- end
- function OnGameEnd()
- game_started = false
- timer(5000, "EndTimer")
- for i=1,16 do
- if player_present(i) then
- last_damage[i] = 0
- temp[i] = {}
- killed_by_nothing[i] = false
- end
- end
- end
- function EndTimer()
- if get_var(0, "$pn") ~= "0" then
- -- set default scores to zero if nil
- if team_score["red"] == nil then team_score["red"] = 0 end
- if team_score["blue"] == nil then team_score["blue"] = 0 end
- local insult = GenerateInsult(noun)
- -- announce winner - if there is one
- for i=1,16 do
- if player_present(i) then
- -- red
- if team_score["red"] > team_score["blue"] then
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "|cRED team wins the game!")
- rprint(i, "\n")
- rprint(i, "\n")
- -- blue
- elseif team_score["blue"] > team_score["red"] then
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "|cBLUE team wins the game!")
- rprint(i, "\n")
- rprint(i, "\n")
- -- stalemate
- elseif team_score["red"] == team_score["blue"] then
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "|cSTALEMATE!")
- if insult ~= nil then rprint(i,"|cStalemate?! What a bunch of " .. insult .. "s!") end
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- end
- end
- end
- end
- return false
- end
- function OnPlayerJoin(PlayerIndex)
- if game_ticks > 8 and get_var(0, "$pn") == "1" then
- if not game_started then game_started = true end
- execute_command("sv_map_reset")
- end
- killed_by_nothing[PlayerIndex] = false
- last_damage[PlayerIndex] = 0
- temp[PlayerIndex] = {}
- say(PlayerIndex, join_message)
- timer(3000, "TeamWelcome", get_var(PlayerIndex,"$team"), PlayerIndex)
- end
- function OnPlayerLeave(PlayerIndex)
- if game_started then
- EndCheck(PlayerIndex)
- end
- killed_by_nothing[PlayerIndex] = nil
- last_damage[PlayerIndex] = nil
- temp[PlayerIndex] = nil
- end
- function OnPlayerChat(PlayerIndex, Message)
- local response = nil
- local isadmin = nil
- if (tonumber(get_var(PlayerIndex,"$lvl"))) >= 1 then isadmin = true else isadmin = false end
- local Message = string.lower(Message)
- if (Message == "balance") then
- if isadmin then
- response = false
- BalanceTeams()
- else
- response = true
- end
- end
- if (Message == "help") or (Message == "/help") or (Message == "@help") then
- response = false
- say(PlayerIndex, "Dodgeball: When you kill the enemy, they join your team.")
- say(PlayerIndex, "You can only kill enemies with plasma grenades or by melee.")
- say(PlayerIndex, "Play ".. max_rounds .." rounds per map.")
- say(PlayerIndex, "Round is over when all players are on the same team.")
- end
- return response
- end
- function EndCheck(PlayerIndex)
- local name = get_var(PlayerIndex, "$name")
- local team = get_var(PlayerIndex,"$team")
- local reds = tonumber(get_var(0, "$reds")) - 1
- local blues = tonumber(get_var(0, "$blues")) - 1
- local stickies
- local lastman = 0
- local insult = GenerateInsult(noun)
- -- set default scores to zero if nil
- if team_score["red"] == nil then team_score["red"] = 0 end
- if team_score["blue"] == nil then team_score["blue"] = 0 end
- -- last red
- if (team == "red") and (reds == 1) then
- stickies = tonumber(get_var(0, "$blues"))
- for i = 1, 16 do
- if get_var(i, "$team") == "red" and i ~= PlayerIndex then
- lastman = i
- break
- end
- end
- for i=1,16 do
- if player_present(i) then
- rprint(i, "|c" .. get_var(lastman, "$name") .. " is the last RED player alive and is untouchable for 10 seconds!")
- end
- end
- timer(invulnerable_duration * 1000, "InvulnerableRemove", lastman)
- execute_command_sequence("god me;s me 1.75;hp me +2", lastman)
- execute_command("camo me " ..invulnerable_duration, lastman)
- execute_command("nades me +" ..stickies.. " 2", lastman)
- elseif (team == "red") and (reds == 0) and (get_var(0, "$blues") > "0") then
- if max_rounds ~= cur_round then
- team_score["blue"] = team_score["blue"] + 1
- cur_round = cur_round + 1
- game_ticks = 0
- timer(1000, "NewRound")
- for i=1,16 do
- if player_present(i) then
- rprint(i, "|c" .. name .. " (RIP) was the last red player!")
- -- announce round winner
- if team_score["red"] > team_score["blue"] then
- rprint(i, "|cRED team wins the round!")
- elseif team_score["blue"] > team_score["red"] then
- rprint(i, "|cBLUE team wins the round!")
- elseif team_score["red"] == team_score["blue"] then
- rprint(i, "|cTIED UP!")
- end
- end
- end
- else
- team_score["blue"] = team_score["blue"] + 1
- for i=1,16 do
- if player_present(i) then
- rprint(i, "|c" .. name .. " (RIP) was the last red player!")
- end
- end
- execute_command("sv_map_next")
- end
- end
- -- last blue
- if (team == "blue") and (blues == 1) then
- stickies = tonumber(get_var(0, "$reds"))
- for i = 1, 16 do
- if (get_var(i, "$team") == "blue") and (i ~= PlayerIndex) then
- lastman = i
- break
- end
- end
- for i=1,16 do
- if player_present(i) then
- rprint(i, "|c" .. get_var(lastman, "$name") .. " is the last BLUE player alive and is untouchable for 10 seconds!")
- end
- end
- timer(invulnerable_duration * 1000, "InvulnerableRemove", lastman)
- execute_command_sequence("god me;s me 1.75;hp me +2", lastman)
- execute_command("camo me " ..invulnerable_duration, lastman)
- execute_command("nades me +" ..stickies.. " 2", lastman)
- elseif (team == "blue") and (blues == 0) and (get_var(0, "$reds") > "0") then
- if max_rounds ~= cur_round then
- team_score["red"] = team_score["red"] + 1
- cur_round = cur_round + 1
- game_ticks = 0
- timer(1000, "NewRound")
- for i=1,16 do
- if player_present(i) then
- rprint(i, "|c" .. name .. " (RIP) was the last blue player!")
- -- announce round winner
- if team_score["red"] > team_score["blue"] then
- rprint(i, "|cRED team wins the round!")
- elseif team_score["blue"] > team_score["red"] then
- rprint(i, "|cBLUE team wins the round!")
- elseif team_score["red"] == team_score["blue"] then
- rprint(i, "|cTIED UP!")
- end
- end
- end
- else
- team_score["red"] = team_score["red"] + 1
- for i=1,16 do
- if player_present(i) then
- rprint(i, "|c" .. name .. " (RIP) was the last blue player!")
- end
- end
- execute_command("sv_map_next")
- end
- end
- end
- function InvulnerableRemove(PlayerIndex)
- execute_command("ungod me", PlayerIndex)
- return false
- end
- function NewRound()
- game_ticks = game_ticks + 1
- if game_ticks == 2 then
- BalanceTeams()
- if team_score["red"] == nil then team_score["red"] = 0 end
- if team_score["blue"] == nil then team_score["blue"] = 0 end
- for i=1,16 do
- if player_present(i) then
- rprint(i, "|cStarting a New Round!")
- end
- end
- return true
- elseif game_ticks == 3 then
- for i=1,16 do
- if player_present(i) then
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "|cStarting in 5")
- end
- end
- return true
- elseif game_ticks == 4 then
- for i=1,16 do
- if player_present(i) then
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "|cStarting in 4")
- end
- end
- return true
- elseif game_ticks == 5 then
- for i=1,16 do
- if player_present(i) then
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "|cStarting in 3")
- end
- end
- return true
- elseif game_ticks == 6 then
- for i=1,16 do
- if player_present(i) then
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "|cStarting in 2")
- end
- end
- return true
- elseif game_ticks == 7 then
- for i=1,16 do
- if player_present(i) then
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "|cStarting in 1")
- end
- end
- return true
- elseif game_ticks == 8 then
- game_ticks = 9
- game_started = true
- execute_command("sv_map_reset")
- for i=1,16 do
- if player_present(i) then
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "\n")
- rprint(i, "|cRound " .. cur_round .. " of " .. max_rounds .. " rounds.")
- rprint(i, "|c--- PLAY BALL! ---")
- rprint(i, "\n")
- rprint(i, "\n")
- end
- end
- return false
- else
- return true
- end
- end
- function BalanceTeams()
- if not team_play then return end
- local reds = tonumber(get_var(0,"$reds"))
- local blues = tonumber(get_var(0,"$blues"))
- local bigger_team = nil
- while TeamsAreUneven() do
- if (reds > blues + 1) then
- bigger_team = "red"
- execute_command("st rand" .. bigger_team)
- elseif (blues > reds + 1) then
- bigger_team = "blue"
- execute_command("st rand" .. bigger_team)
- end
- if (reds == blues) or (reds == blues + 1) or (blues == reds + 1) then break end
- end
- end
- function OnPlayerSpawn(PlayerIndex)
- -- set grenade counts as they are set above
- if player_present(PlayerIndex) then
- local player_object = get_dynamic_player(PlayerIndex)
- local Deaths = tonumber(get_var(PlayerIndex, "$deaths"))
- execute_command_sequence("s me 1;nades me 0;wdel me 0", PlayerIndex)
- local ObjectID = spawn_object("weap", "weapons\\shotgun\\shotgun")
- assign_weapon(ObjectID, PlayerIndex)
- execute_command_sequence("ammo me 0 5;mag me 0 5;", PlayerIndex)
- execute_command_sequence("nades me " .. plasma_count .. " 2", PlayerIndex)
- last_damage[PlayerIndex] = 0
- if spawn_death_coords and (temp[PlayerIndex][1] ~= nil) and (killed_by_nothing[PlayerIndex] == false) then
- if map_name ~= "gephyrophobia" or map_name ~= "damnation" then
- local player_object = get_dynamic_player(PlayerIndex)
- local player_obj_id = read_dword(get_player(PlayerIndex) + 0x34)
- if (player_object ~= 0) then
- moveobject(player_obj_id, temp[PlayerIndex][1], temp[PlayerIndex][2], temp[PlayerIndex][3])
- end
- end
- temp[PlayerIndex] = {}
- end
- if Deaths > 14 then
- timer(6000, "GiveOverShield", PlayerIndex)
- end
- end
- end
- function OnTeamSwitch(PlayerIndex)
- if game_started then
- if team_play then
- if (killed_by_nothing[PlayerIndex] == true) then
- if announce_team_switch then
- say_all(get_var(PlayerIndex,"$name") .. " switched to the " .. get_var(PlayerIndex,"$team") .. " team.")
- end
- killed_by_nothing[PlayerIndex] = false
- temp[PlayerIndex] = {}
- timer(1000, "TeamWelcome", get_var(PlayerIndex,"$team"), PlayerIndex)
- end
- end
- end
- end
- function ShowScores()
- if game_started then
- if team_score["red"] == nil then team_score["red"] = 0 end
- if team_score["blue"] == nil then team_score["blue"] = 0 end
- for i=1,16 do
- if player_present(i) then
- if game_ticks > 8 then
- rprint(i, "|cRounds won: Red: " .. team_score["red"] .. " vs. Blue: " .. team_score["blue"])
- end
- end
- end
- return true
- else
- return false
- end
- end
- function OnPlayerDie(PlayerIndex, KillerIndex)
- if game_started then
- -- delete dropped grenades
- execute_command('nades me 0', PlayerIndex)
- local player_object = get_dynamic_player(PlayerIndex)
- local vehicle_objectid = read_dword(player_object + 0x11C)
- local vehicle_object = get_object_memory(vehicle_objectid)
- local vname = get_var(PlayerIndex, "$name")
- local vteam = get_var(PlayerIndex, "$team")
- local killer = tonumber(KillerIndex)
- if (killer == -1) then
- if last_damage[PlayerIndex] == 0 then
- killed_by_nothing[PlayerIndex] = true
- elseif last_damage[PlayerIndex] == distance_damage then
- last_damage[PlayerIndex] = 0
- killed_by_nothing[PlayerIndex] = false
- end
- elseif (killer == 0) then
- if last_damage[PlayerIndex] == veh_damage then
- last_damage[PlayerIndex] = 0
- end
- elseif (killer > 0) then
- local kname = get_var(KillerIndex, "$name")
- local kteam = get_var(KillerIndex, "$team")
- if PlayerIndex == killer then -- suicide
- if game_started then
- EndCheck(PlayerIndex)
- end
- elseif (team_play and (kteam == vteam) and (PlayerIndex ~= KillerIndex)) then -- teamkill/betray
- if game_started then
- rprint(KillerIndex, tk_message)
- kill(KillerIndex)
- temp[PlayerIndex] = {}
- EndCheck(PlayerIndex)
- end
- elseif PlayerIndex ~= KillerIndex then -- killed by another player
- if last_damage[PlayerIndex] == "melee" then
- local x,y,z = read_vector3d(player_object + 0x5C)
- temp[PlayerIndex][1] = x
- temp[PlayerIndex][2] = y
- temp[PlayerIndex][3] = z
- elseif last_damage[PlayerIndex] == explosion_damage then
- local x,y,z = read_vector3d(player_object + 0x5C)
- if (vehicle_object ~= 0) then
- temp[PlayerIndex] = {}
- else
- temp[PlayerIndex][1] = x
- temp[PlayerIndex][2] = y
- temp[PlayerIndex][3] = z
- end
- end
- if game_started then
- EndCheck(PlayerIndex)
- execute_command("st", PlayerIndex)
- execute_command("nades me +1 2", KillerIndex)
- end
- end
- end
- last_damage[PlayerIndex] = 0
- end
- end
- function TeamWelcome(team, PlayerIndex)
- if game_started and team_play then
- local insult = GenerateInsult(noun)
- if team == "red" then
- say(PlayerIndex, "YOU'RE RED. KILL THE BLUES!")
- elseif team == "blue" then
- say(PlayerIndex, "YOU'RE BLUE. KILL THE REDS!")
- end
- if insult ~= nil then say(PlayerIndex, "Don't be a whiny little " .. insult .. "! KILL THEM! ") end
- end
- return false
- end
- function OnDamageApplication(PlayerIndex, CauserIndex, MetaID, Damage, HitString, Backtap)
- if player_present(PlayerIndex) then
- local receiver_team = get_var(PlayerIndex, "$team")
- local causer_team = get_var(CauserIndex, "$team")
- local new_damage = (Damage * damage_multiplier)
- last_damage[PlayerIndex] = MetaID
- -- increase plasma explosion damage to enemies, don't harm self or team
- if (MetaID == explosion_damage) then
- if (PlayerIndex and PlayerIndex ~= CauserIndex) then
- if (receiver_team ~= causer_team) then
- last_damage[PlayerIndex] = explosion_damage
- return true, new_damage
- else
- return true, 0
- end
- end
- end
- if (MetaID == shockwave_damage) or (MetaID == attached_damage) then
- if (PlayerIndex and PlayerIndex ~= CauserIndex) then
- if (receiver_team ~= causer_team) then
- last_damage[PlayerIndex] = explosion_damage
- end
- end
- end
- if (MetaID == falling_damage) then
- last_damage[PlayerIndex] = falling_damage
- return true, falling_damage
- end
- if (MetaID == distance_damage) then
- last_damage[PlayerIndex] = distance_damage
- return true, distance_damage
- end
- -- block all damage done by vehicle and hand held weapons, and vehicle splatter damage (it's dodgeball, derp)
- if (MetaID == veh_damage) or (MetaID == banshee_bolt) or (MetaID == banshee_explode) or
- (MetaID == turret_bolt) or (MetaID == ghost_bolt) or (MetaID == tank_shell) or
- (MetaID == tank_bullet) or (MetaID == chain_bullet) or (MetaID == assault_bullet) or
- (MetaID == flame_explode) or (MetaID == needle_detonate) or (MetaID == needle_explode) or
- (MetaID == needle_impact) or (MetaID == pistol_bullet) or (MetaID == ppistol_bolt) or
- (MetaID == ppistol_charge) or (MetaID == prifle_bolt) or (MetaID == pcannon_explode) or
- (MetaID == rocket_explode) or (MetaID == shotgun_pellet) or (MetaID == sniper_bullet) then
- return true, 0
- end
- -- make melee damage instant kill to enemies
- local tag_address = read_dword(0x40440000)
- local tag_count = read_dword(0x4044000C)
- for i=0,tag_count-1 do
- local tag = tag_address + 0x20 * i
- local tag_name = read_string(read_dword(tag + 0x10))
- local tag_class = read_dword(tag)
- local tag_data = read_dword(tag + 0x14)
- if (tag_class == 1785754657) and string.find(tag_name, "melee") then
- if (receiver_team ~= causer_team) then
- last_damage[PlayerIndex] = "melee"
- if (read_word(tag_data + 0x1C6) == 6) then
- write_float(tag_data + 0x1D0, 500)
- write_float(tag_data + 0x1D4, 500)
- write_float(tag_data + 0x1D8, 500)
- write_bit(tag_data + 0x1C8, 3, 1)
- end
- else
- return true, 0
- end
- end
- end
- end
- end
- function OnObjectSpawn(PlayerIndex, MapID, ParentID, ObjectID)
- -- edit biped and stickies --
- local tag_address = read_dword(0x40440000)
- local tag_count = read_dword(0x4044000C)
- for i=0,tag_count-1 do
- local tag = tag_address + 0x20 * i
- local tag_name = read_string(read_dword(tag + 0x10))
- local tag_class = read_dword(tag)
- local tag_data = read_dword(tag + 0x14)
- -- biped grenade throwing velocity from 10 to 15
- if (tag_class == 1651077220 and tag_name == "characters\\cyborg_mp\\cyborg_mp") then
- write_dword(tag_data + 0x2c0, 1097859072) -- biped grenade throwing velocity from 10 to 15/1097859072
- end
- -- plasma grenade, changed to explode on contact with anything
- if (tag_class == 1886547818 and tag_name == "weapons\\plasma grenade\\plasma grenade") then
- write_dword(tag_data + 0x1bc, 0) -- det timer from
- write_dword(tag_data + 0x1c0, 0) -- det timer to:
- write_dword(tag_data + 0x180, 0x1) -- det timer starts 0 = immed, 1 = after bounce, 2 at rest)
- write_dword(tag_data + 0x1a0, 0.1) -- collision radius 0.1 world units
- write_dword(tag_data + 0x220, 4294967295) -- (nulled/4294967295) attached det damage nulled out
- write_dword(tag_data + 0x17c, 2) -- Detonation Max Time if Attached
- write_dword(tag_data + 0x2c0, 1097859072) -- biped grenade throwing velocity from 10 to 15/1097859072
- write_dword(tag_data + 0x1c8, 1124073472) -- detonation max range from 0 to 128/1124073472
- write_dword(tag_data + 0x1d4, 100) -- physics air damage range from 10 to 100/1120403456
- write_dword(tag_data + 0x94, 4) -- detonation start To/event, effect -- 4 seconds/1082130432
- write_bit(tag_data + 0x1C8, 3, 1) -- doesn't hurt team: 1 = true, 0 = false
- -- default/potential material responses --
- write_dword(tag_data + 0x33c, 65536)
- write_dword(tag_data + 0x344, 1078310993)
- SwapDependency(tag_data + 0x34c, "weapons\\rocket launcher\\effects\\impact dirt", 1701209701)
- write_dword(tag_data + 0x360, 65536)
- write_dword(tag_data + 0x3dc, 65536)
- write_dword(tag_data + 0x3e4, 1078310993)
- SwapDependency(tag_data + 0x3ec, "weapons\\rocket launcher\\effects\\impact dirt", 1701209701)
- write_dword(tag_data + 0x400, 65536)
- write_dword(tag_data + 0x47c, 65536)
- write_dword(tag_data + 0x484, 1078320705)
- SwapDependency(tag_data + 0x48c, "weapons\\plasma grenade\\effects\\material explosion", 1701209701)
- write_dword(tag_data + 0x4a0, 65536)
- write_dword(tag_data + 0x51c, 65536)
- write_dword(tag_data + 0x524, 1078320705)
- SwapDependency(tag_data + 0x52c, "weapons\\plasma grenade\\effects\\material explosion", 1701209701)
- write_dword(tag_data + 0x540, 65536)
- write_dword(tag_data + 0x5bc, 65536)
- write_dword(tag_data + 0x5c4, 1078320705)
- SwapDependency(tag_data + 0x5cc, "weapons\\plasma grenade\\effects\\material explosion", 1701209701)
- write_dword(tag_data + 0x5e0, 65536)
- write_dword(tag_data + 0x65c, 65536)
- write_dword(tag_data + 0x664, 1078320705)
- SwapDependency(tag_data + 0x66c, "weapons\\plasma grenade\\effects\\material explosion", 1701209701)
- write_dword(tag_data + 0x680, 65536)
- write_dword(tag_data + 0x6fc, 65536)
- write_dword(tag_data + 0x704, 1078320705)
- SwapDependency(tag_data + 0x70c, "weapons\\plasma grenade\\effects\\material explosion", 1701209701)
- write_dword(tag_data + 0x720, 65536)
- write_dword(tag_data + 0x79c, 65536)
- write_dword(tag_data + 0x7a4, 1078320705)
- SwapDependency(tag_data + 0x7ac, "weapons\\plasma grenade\\effects\\material explosion", 1701209701)
- write_dword(tag_data + 0x7c0, 65536)
- write_dword(tag_data + 0x83c, 65536)
- write_dword(tag_data + 0x844, 1078320705)
- SwapDependency(tag_data + 0x84c, "weapons\\plasma grenade\\effects\\material explosion", 1701209701)
- write_dword(tag_data + 0x860, 65536)
- write_dword(tag_data + 0x8dc, 65536)
- write_dword(tag_data + 0x8e4, 1078320705)
- SwapDependency(tag_data + 0x8ec, "weapons\\plasma grenade\\effects\\material explosion", 1701209701)
- write_dword(tag_data + 0x97c, 65536)
- write_dword(tag_data + 0x984, 1078320705)
- SwapDependency(tag_data + 0x98c, "weapons\\plasma grenade\\effects\\material explosion", 1701209701)
- write_dword(tag_data + 0xa1c, 65536)
- write_dword(tag_data + 0xa24, 1078320705)
- SwapDependency(tag_data + 0xa2c, "weapons\\plasma grenade\\effects\\material explosion", 1701209701)
- write_dword(tag_data + 0xa40, 65536)
- write_dword(tag_data + 0xabc, 65536)
- write_dword(tag_data + 0xac4, 1078320705)
- SwapDependency(tag_data + 0xacc, "weapons\\plasma grenade\\effects\\material explosion", 1701209701)
- write_dword(tag_data + 0xae0, 65536)
- write_dword(tag_data + 0xb5c, 65536)
- write_dword(tag_data + 0xb64, 1078320705)
- SwapDependency(tag_data + 0xb6c, "weapons\\plasma grenade\\effects\\material explosion", 1701209701)
- write_dword(tag_data + 0xb80, 65536)
- write_dword(tag_data + 0xbfc, 65536)
- write_dword(tag_data + 0xc04, 1078320705)
- SwapDependency(tag_data + 0xc0c, "weapons\\plasma grenade\\effects\\material explosion", 1701209701)
- write_dword(tag_data + 0xc20, 65536)
- write_dword(tag_data + 0xc9c, 65536)
- write_dword(tag_data + 0xca4, 1078320705)
- SwapDependency(tag_data + 0xcac, "weapons\\plasma grenade\\effects\\material explosion", 1701209701)
- write_dword(tag_data + 0xcc0, 65536)
- write_dword(tag_data + 0xd3c, 65536)
- write_dword(tag_data + 0xd44, 1078320705)
- SwapDependency(tag_data + 0xd4c, "weapons\\plasma grenade\\effects\\material explosion", 1701209701)
- write_dword(tag_data + 0xd60, 0)
- write_dword(tag_data + 0xddc, 65536)
- write_dword(tag_data + 0xde4, 1078320705)
- SwapDependency(tag_data + 0xdec, "weapons\\plasma grenade\\effects\\material explosion", 1701209701)
- write_dword(tag_data + 0xe00, 65536)
- write_dword(tag_data + 0xe7c, 65536)
- write_dword(tag_data + 0xe84, 1078320705)
- SwapDependency(tag_data + 0xe8c, "weapons\\plasma grenade\\effects\\material explosion", 1701209701)
- write_dword(tag_data + 0xf1c, 65536)
- write_dword(tag_data + 0xf24, 1078320705)
- SwapDependency(tag_data + 0xf2c, "weapons\\plasma grenade\\effects\\material explosion", 1701209701)
- write_dword(tag_data + 0xf40, 65536)
- write_dword(tag_data + 0xfbc, 65536)
- write_dword(tag_data + 0xfc4, 1078320705)
- SwapDependency(tag_data + 0xfcc, "weapons\\plasma grenade\\effects\\material explosion", 1701209701)
- write_dword(tag_data + 0xfe0, 65536)
- write_dword(tag_data + 0x105c, 65536)
- write_dword(tag_data + 0x1064, 1078320705)
- SwapDependency(tag_data + 0x106c, "weapons\\plasma grenade\\effects\\material explosion", 1701209701)
- write_dword(tag_data + 0x1080, 65536)
- write_dword(tag_data + 0x10fc, 65536)
- write_dword(tag_data + 0x1104, 1078320705)
- SwapDependency(tag_data + 0x110c, "weapons\\plasma grenade\\effects\\material explosion", 1701209701)
- write_dword(tag_data + 0x1120, 65536)
- write_dword(tag_data + 0x119c, 65536)
- write_dword(tag_data + 0x11a4, 1078320705)
- SwapDependency(tag_data + 0x11ac, "weapons\\plasma grenade\\effects\\material explosion", 1701209701)
- write_dword(tag_data + 0x11c0, 65536)
- write_dword(tag_data + 0x123c, 65536)
- write_dword(tag_data + 0x1244, 1078320705)
- SwapDependency(tag_data + 0x124c, "weapons\\plasma grenade\\effects\\material explosion", 1701209701)
- write_dword(tag_data + 0x1260, 65536)
- write_dword(tag_data + 0x12dc, 65536)
- write_dword(tag_data + 0x12e4, 1078320705)
- SwapDependency(tag_data + 0x12ec, "weapons\\plasma grenade\\effects\\material explosion", 1701209701)
- write_dword(tag_data + 0x1300, 65536)
- write_dword(tag_data + 0x137c, 65536)
- write_dword(tag_data + 0x1384, 1078320705)
- SwapDependency(tag_data + 0x138c, "weapons\\plasma grenade\\effects\\material explosion", 1701209701)
- write_dword(tag_data + 0x141c, 65536)
- write_dword(tag_data + 0x1424, 1078320705)
- SwapDependency(tag_data + 0x142c, "weapons\\plasma grenade\\effects\\material explosion", 1701209701)
- write_dword(tag_data + 0x1440, 65536)
- write_dword(tag_data + 0x14bc, 65536)
- write_dword(tag_data + 0x14c4, 1078312016)
- SwapDependency(tag_data + 0x14cc, "weapons\\rocket launcher\\effects\\impact water", 1701209701)
- write_dword(tag_data + 0x155c, 65536)
- write_dword(tag_data + 0x1564, 1078320705)
- SwapDependency(tag_data + 0x156c, "weapons\\plasma grenade\\effects\\material explosion", 1701209701)
- write_dword(tag_data + 0x1580, 65536)
- write_dword(tag_data + 0x15fc, 65536)
- write_dword(tag_data + 0x1604, 1078320705)
- SwapDependency(tag_data + 0x160c, "weapons\\plasma grenade\\effects\\material explosion", 1701209701)
- write_dword(tag_data + 0x1620, 65536)
- write_dword(tag_data + 0x169c, 65536)
- write_dword(tag_data + 0x16a4, 1078320705)
- SwapDependency(tag_data + 0x16ac, "weapons\\plasma grenade\\effects\\material explosion", 1701209701)
- write_dword(tag_data + 0x16c0, 65536)
- write_dword(tag_data + 0x173c, 65536)
- write_dword(tag_data + 0x1744, 1078320705)
- SwapDependency(tag_data + 0x174c, "weapons\\plasma grenade\\effects\\material explosion", 1701209701)
- end
- end
- -- replaces active camo with overshield
- if (MapID == equip_camo) then
- return true, equip_os
- end
- -- replaces frag nade projectiles with sticky nade projectiles
- if (MapID == proj_frag) then
- return true, proj_sticky
- end
- -- items returning false (blocked) should always be listed after items returning true, or they will be ignored by sapp
- -- block all weapons except shotguns (not blocking flag and oddball)
- if (MapID == weap_fuel_rod or MapID == weap_rocket_launcher or MapID == weap_sniper_rifle or
- MapID == weap_plasma_pistol or MapID == weap_plasma_rifle or MapID == weap_assault_rifle or
- MapID == weap_flamer or MapID == weap_needler or MapID == weap_pistol) then
- return false
- end
- -- block frag equipment
- if (MapID == equip_frags) then
- return false
- end
- -- block sticky (plasma nades) equipment
- if (MapID == equip_stickies) then
- return false
- end
- -- end
- return true
- end
- function GetMetaIDs()
- -- damage tags
- attached_damage = get_tag_info("jpt!", "weapons\\plasma grenade\\attached")
- explosion_damage = get_tag_info("jpt!", "weapons\\plasma grenade\\explosion")
- shockwave_damage = get_tag_info("jpt!", "weapons\\plasma grenade\\shock wave")
- falling_damage = get_tag_info("jpt!", "globals\\falling")
- distance_damage = get_tag_info("jpt!", "globals\\distance")
- veh_damage = get_tag_info("jpt!", "globals\\vehicle_collision")
- banshee_bolt = get_tag_info("jpt!", "vehicles\\banshee\\banshee bolt")
- banshee_explode = get_tag_info("jpt!", "vehicles\\banshee\\mp_fuel rod explosion")
- turret_bolt = get_tag_info("jpt!", "vehicles\\c gun turret\\mp bolt")
- ghost_bolt = get_tag_info("jpt!", "vehicles\\ghost\\ghost bolt")
- tank_shell = get_tag_info("jpt!", "vehicles\\scorpion\\shell explosion")
- tank_bullet = get_tag_info("jpt!", "vehicles\\scorpion\\bullet")
- chain_bullet = get_tag_info("jpt!", "vehicles\\warthog\\bullet")
- assault_bullet = get_tag_info("jpt!", "weapons\\assault rifle\\bullet")
- flame_explode = get_tag_info("jpt!", "weapons\\flamethrower\\explosion")
- needle_detonate = get_tag_info("jpt!", "weapons\\needler\\detonation damage")
- needle_explode = get_tag_info("jpt!", "weapons\\needler\\explosion")
- needle_impact = get_tag_info("jpt!", "weapons\\needler\\impact damage")
- pistol_bullet = get_tag_info("jpt!", "weapons\\pistol\\bullet")
- ppistol_bolt = get_tag_info("jpt!", "weapons\\plasma pistol\\bolt")
- ppistol_charged = get_tag_info("jpt!", "weapons\\plasma rifle\\charged bolt")
- prifle_bolt = get_tag_info("jpt!", "weapons\\plasma rifle\\bolt")
- pcannon_explode = get_tag_info("jpt!", "weapons\\plasma_cannon\\effects\\plasma_cannon_explosion")
- rocket_explode = get_tag_info("jpt!", "weapons\\rocket launcher\\explosion")
- shotgun_pellet = get_tag_info("jpt!", "weapons\\shotgun\\pellet")
- sniper_bullet = get_tag_info("jpt!", "weapons\\sniper rifle\\sniper bullet")
- -- biped
- mp_biped = get_tag_info("bipd", "characters\\cyborg_mp\\cyborg_mp")
- -- weapons
- weap_fuel_rod = read_dword(lookup_tag("weap", "weapons\\plasma_cannon\\plasma_cannon") + 12)
- weap_rocket_launcher = read_dword(lookup_tag("weap", "weapons\\rocket launcher\\rocket launcher") + 12)
- weap_sniper_rifle = read_dword(lookup_tag("weap", "weapons\\sniper rifle\\sniper rifle") + 12)
- weap_plasma_pistol = read_dword(lookup_tag("weap", "weapons\\plasma pistol\\plasma pistol") + 12)
- weap_plasma_rifle = read_dword(lookup_tag("weap", "weapons\\plasma rifle\\plasma rifle") + 12)
- weap_assault_rifle = read_dword(lookup_tag("weap", "weapons\\assault rifle\\assault rifle") + 12)
- weap_flamer = read_dword(lookup_tag("weap", "weapons\\flamethrower\\flamethrower") + 12)
- weap_needler = read_dword(lookup_tag("weap", "weapons\\needler\\mp_needler") + 12)
- weap_pistol = read_dword(lookup_tag("weap", "weapons\\pistol\\pistol") + 12)
- weap_shotgun = read_dword(lookup_tag("weap", "weapons\\shotgun\\shotgun") + 12)
- --projectiles
- proj_frag = read_dword(lookup_tag("proj", "weapons\\frag grenade\\frag grenade") + 12)
- proj_sticky = read_dword(lookup_tag("proj", "weapons\\plasma grenade\\plasma grenade") + 12)
- -- equipment
- equip_frags = read_dword(lookup_tag("eqip", "weapons\\frag grenade\\frag grenade") + 12)
- equip_stickies = read_dword(lookup_tag("eqip", "weapons\\plasma grenade\\plasma grenade") + 12)
- equip_camo = read_dword(lookup_tag("eqip", "powerups\\active camouflage") + 12)
- equip_os = read_dword(lookup_tag("eqip", "powerups\\over shield") + 12)
- end
- function get_tag_info(obj_type, obj_name)
- local tag = lookup_tag(obj_type, obj_name)
- return tag ~= 0 and read_dword(tag + 0xC) or nil
- end
- function SwapDependency(Address, ToTag, ToClass)
- local tag_address = read_dword(0x40440000)
- local tag_count = read_dword(0x4044000C)
- for i=0,tag_count-1 do
- local tag = tag_address + 0x20 * i
- if (read_dword(tag) == ToClass and read_string(read_dword(tag + 0x10)) == ToTag) then
- write_dword(Address, read_dword(tag + 0xC))
- return
- end
- end
- end
- function GiveOverShield(PlayerIndex)
- if player_alive(PlayerIndex) then
- local name = get_var(PlayerIndex,"$name")
- local insult = GenerateInsult(noun)
- rprint(PlayerIndex, "** " .. name .. " ** Do you LIKE losing?! Here's an over-shield! You " .. insult .. "!")
- local ObjectID = spawn_object("eqip", "powerups\\over shield")
- powerup_interact(ObjectID, PlayerIndex)
- end
- return false
- end
- function TeamsAreUneven()
- local red = tonumber(get_var(0,"$reds"))
- local blue = tonumber(get_var(0,"$blues"))
- if (red > blue + 1) or (blue > red + 1) then
- return true
- else
- return false
- end
- end
- function getteamplay()
- if get_var(0,"$ffa") == "0" then
- return true
- else
- return false
- end
- end
- function moveobject(ObjectID, x, y, z)
- local object = get_object_memory(ObjectID)
- if get_object_memory(ObjectID) ~= 0 then
- local veh_obj = get_object_memory(read_dword(object + 0x11C))
- write_vector3d((veh_obj ~= 0 and veh_obj or object) + 0x5C, x, y, z)
- end
- end
- function GenerateInsult(noun)
- noun = {"sister-kisser", "fart-finagler", "butt-shaker", "douche-nozzle", "pig-licker", "goober-face",
- "butt-licker", "fudge-stick", "dingle-berry", "tally-wacker", "troll-twat", "puss-nozzle", "numb-nut",
- "twizzle-tit", "crack-head", "turd-burglar", "sleeze-bag", "butt-munch", "goat-rapist", "chicken-choker",
- "panty-waist", "gutter-slut", "spit-bucket", "snot-plug", "butt-pickle", "anal-wart", "phlegm wad",
- "taint-painter", "goiter-monkey", "syphilis-siphon", "butt-monkey", "boar-tit", "scat-muncher", "slag-bucket",
- "yeasty-wench", "trailer-monkey", "lot-lizard", "$2-whore", "bagpipe-player", "toe-sucker", "puppy-killer",
- "nipple-canker", "snot-biscuit", "fanny-face", "piss-badger", "crap-magnet", "hippie-poser", "snot-clot" }
- local rand_noun = rand(1, #noun+1)
- local noun_type = string.format("%s", noun[rand_noun])
- if noun_type ~= nil then
- return noun_type
- end
- end
- function OnError(Message)
- print(debug.traceback())
- end
- -- Created by H® Shaft
- -- This is a complete re-write of Wizards dodgeball for phasor, with added pieces from sehee, and 002
- -- Visit http://halorace.org/forum/index.php
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement