Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Config
- -- The amount to add to a player's kill count on goomba stomp
- GOOMBA_KILL_VALUE = 2
- -- Message to display on goomba stomp
- GOOMBA_MESSAGE = "$killer goomba stomped $victim."
- -- End of config
- stand_height = nil
- crouch_height = nil
- biped_collision_radius = nil
- game_info_pointer = nil
- stats_base = nil
- api_version = '1.9.0.0'
- function OnScriptLoad()
- GOOMBA_KILL_VALUE = GOOMBA_KILL_VALUE - 1
- if(halo_type == "CE") then
- game_info_pointer = 0x5F559C
- stats_base = 0x5BD898
- if(read_word(0x6C7964) ~= 0) then
- OnGameStart()
- end
- else
- game_info_pointer = 0x671400
- stats_base = 0x639878
- if(read_word(0x745B84) ~= 0) then
- OnGameStart()
- end
- end
- register_callback(cb['EVENT_GAME_START'], 'OnGameStart')
- register_callback(cb['EVENT_TICK'], 'OnTick')
- end
- function OnGameStart()
- stand_height = nil
- crouch_height = nil
- biped_collision_radius = nil
- local globals_tag = lookup_tag("matg", "globals\\globals")
- local globals_data = read_dword(globals_tag + 0x14)
- local mp_info_data = read_dword(globals_data + 0x168)
- local player_unit_type = read_dword(mp_info_data + 0x10)
- if(player_unit_type == 0x62697064) then -- checks if unit type is biped
- local biped_metaid = read_dword(mp_info_data + 0x1C)
- if(biped_metaid ~= 0xFFFFFFFF) then
- local biped_tag = lookup_tag(biped_metaid)
- local biped_data = read_dword(biped_tag + 0x14)
- stand_height = read_float(biped_data + 0x400) - 0.25
- crouch_height = read_float(biped_data + 0x404) - 0.25
- biped_collision_radius = read_float(biped_data + 0x42C)
- end
- end
- end
- function OnTick()
- if(stand_height == nil) then return end
- for i=1,16 do
- if(player_alive(i)) then
- local player = get_dynamic_player(i)
- if(read_bit(player + 0x10, 1) == 1 and read_char(player + 0x500) == -15) then
- local bumped_objectid = read_dword(player + 0x4FC)
- for j=1,16 do
- if(player_alive(j)) then
- if(bumped_objectid == read_dword(get_player(j) + 0x34)) then
- local ffa = get_var(0, "$ffa")
- local team1 = get_var(i, "$team")
- local team2 = get_var(j, "$team")
- if(ffa == "1" or team1 ~= team2) then
- local player2 = get_dynamic_player(j)
- local x1, y1, z1 = read_vector3d(player + 0x5C)
- local x2, y2, z2 = read_vector3d(player2 + 0x5C)
- local cs = read_float(player2 + 0x50C)
- local h = stand_height - (cs * (stand_height - crouch_height))
- local distance = math.sqrt(((x1-x2)*(x1-x2)) + ((y1-y2)*(y1-y2)))
- if(z1 > z2+h and distance <= biped_collision_radius*2) then
- execute_command(string.format("kills %s +%s", i, GOOMBA_KILL_VALUE))
- if(get_var(0, "$gt") == "slayer") then
- execute_command(string.format("score %s +%s", i, GOOMBA_KILL_VALUE))
- if(ffa == "0") then
- execute_command(string.format("team_score %s +%s", team1, GOOMBA_KILL_VALUE))
- end
- end
- local message = GOOMBA_MESSAGE:gsub("$killer", get_var(i,"$name")):gsub("$victim", get_var(j,"$name"))
- say_all(message)
- write_dword(player2 + 0x430, read_dword(read_dword(game_info_pointer) + 0xC))
- write_float(player2 + 0x434, 9999)
- write_dword(player2 + 0x438, read_dword(get_player(i) + 0x34))
- write_dword(player2 + 0x43C, read_dword(stats_base + to_real_index(i)*48 + 0x4))
- kill(j)
- end
- break
- end
- end
- end
- end
- end
- end
- end
- end
- function OnScriptUnload() end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement