Spoiler -- how many bots spawn for each alive player --
bot_to_player_ratio = 2
-- amount of glock hits to kill the strongest bot --
-- don't forget some spawn with 25% and 50% armor --
norm_bot_max_hits = 8
event_chain_bot_hits = 4 -- includes armor protection
-- the tile # that bots, bonuses, etc will spawn on --
tile_spawn = 0
tile_bonus = 1
tile_barb_event = 1
-- the power level of player speed boost (1-100) --
speed_boost = 20
-- the maximum random speed level of normal machette bots --
max_norm_bot_spd = 15
-- chance that a special bot is spawned (1-100 only) --
spec_spawn_chance = 15
-- gun ids that will be in the game
gun_table = {1,2,3,4,5,6,10,11,10,22,24,30,31,32,33,34,35,36,37,38,39,91,40,45,46,47,48,49,90}
gun_up = {}
armor_up = {}
speed_bst = {}
barb_trp = {}
movebonus = {}
scr = {}
dam_mult = {}
high_score = {}
snow_bonus = {}
all_handguns = {}
all_shotguns = {}
all_smgs = {}
all_rifles = {}
all_bigguns = {}
score_glow = {}
ply_tot_wep = {}
parse("mp_hudscale 1")
ply_cnt = 0
ply_cnt_nomath = 0
bot_cnt = 0
machettemadness = 0
event_spawn = 0
barb_is_on = 0
event_chain_bot_hth = event_chain_bot_hits
norm_bot_max_hits = norm_bot_max_hits*2
spec_spawn_chance = math.floor((1/spec_spawn_chance)*100)*7
addhook("join","hello")
function hello(id)
gun_up[id] = 0
ply_tot_wep[id] = 0
armor_up[id] = 0
speed_bst[id] = 0
barb_trp[id] = 0
movebonus[id] = 0
scr[id] = 0
dam_mult[id] = 1
high_score[id] = 0
snow_bonus[id] = 0
end
local function has_weapon(tab, val)
for index, value in ipairs(tab) do
if value == val then
return true
end
end
return false
end
function check_all_weapons(id)
for playwepkey, playwepval in pairs(playerweapons(id)) do
for guntabkey, guntabval in pairs(gun_table) do
if playwepval == guntabval then
ply_tot_wep[id] = ply_tot_wep[id] + 1
end
end
end
end
addhook("serveraction","one")
function one(id,action)
if action == 1 then
parse('hudtxt2 '..id..' 49 " " 300 500 0')
if gun_up[id] == 1 then
gun_up[id] = 0
check_all_weapons(id)
if ply_tot_wep[id] < table.maxn(gun_table) then
repeat
local rand = gun_table[math.random(1,table.maxn(gun_table))]
if not has_weapon(playerweapons(id), rand) then
parse("equip "..id.." "..rand.."")
parse("setweapon "..id.." "..rand.."")
end
until player(id,"weapontype") == rand
end
elseif armor_up[id] == 1 then
armor_up[id] = 0
parse("setarmor "..id.." "..(player(id,"armor")+50).."")
end
elseif action==2 then
if speed_bst[id] == 1 and player(id,"speedmod") < 3 then
parse("trigger speedsnd")
parse("speedmod "..id.." "..speed_boost.."")
timer(10000,"parse","speedmod "..id.." 2")
speed_bst[id]=0
parse('hudtxt2 '..id..' 48 " " 250 452 0')
end
elseif action==3 then
if barb_trp[id] == 1 and machettemadness == 0 and barb_is_on == 0 then
barb_is_on = 1
machettemadness = 1
ply_barb_count = math.random (100,150)
repeat
local x_tile=math.random(1,map('xsize'))
local y_tile=math.random(1,map('ysize'))
if tile(x_tile,y_tile,"frame")==tile_bonus then
parse("spawnobject 6 "..x_tile.." "..y_tile.." 0 0 1 "..id.."")
ply_barb_count = ply_barb_count - 1
end
until tile(x_tile,y_tile,"frame")==tile_bonus and ply_barb_count == 0
plybarbresetcnt=math.random(8000,15000)
timer(plybarbresetcnt,"resetplybarb")
barb_trp[id]=0
parse('hudtxt2 '..id..' 47 " " 250 452 0')
elseif machettemadness == 1 or barb_is_on == 1 then
parse("sv_msg2 "..id.." Traps can't be placed right now!@C")
end
end
end
addhook("kill","up_chance")
function up_chance(killer)
if player(killer,"bot") == false then
if player(killer,"score") <= 255 then
imagecolor(score_glow[killer],(player(killer,"score")),0,0)
elseif player(killer,"score") > 255 and player(killer,"score") < 511 then
imagecolor(score_glow[killer],255,(player(killer,"score"))-255,(player(killer,"score"))-255)
elseif player(killer,"score") > 510 then
imagecolor(score_glow[killer],255,255,255)
end
randymathy = math.floor((math.sqrt(dam_mult[killer]))*70)
local rand=math.random(1,randymathy)
if gun_up[killer] == 0 then
if player(killer,"score") == 3 then
rand = 15
elseif player(killer,"score") == 6 then
rand = 15
elseif player(killer,"score") == 9 then
rand = 15
end
if rand < 16 and ply_tot_wep[killer] < table.maxn(gun_table) then
gun_up[killer] = 1
parse('hudtxt2 '..killer..' 49 "©255000000New random gun earned, press F2 to collect!" 250 462 0')
elseif rand < 16 and ply_tot_wep[killer] == table.maxn(gun_table) and player(killer,"armor") <= 200 then
armor_up[killer] = 1
parse('hudtxt2 '..killer..' 49 "©255000000New ultra-strong kevlar earned, press F2 to collect!" 250 462 0')
elseif rand >=16 and rand <=20 and player(killer,"armor") <= 200 then
armor_up[killer] = 1
parse('hudtxt2 '..killer..' 49 "©255000000New ultra-strong kevlar earned, press F2 to collect!" 250 462 0')
end
rand2 = math.random(1,100)
if rand2 <= 10 and speed_bst[killer] == 0 then
speed_bst[killer]=1
parse('hudtxt2 '..killer..' 48 "©255000000Speed boost charged, press F3 to use!" 250 452 0')
elseif rand2 > 10 and rand2 <= 12 then
if barb_trp[killer] == 0 then
barb_trp[killer]=1
parse('hudtxt2 '..killer..' 47 "©255000000Traps are ready, press F4 to use!" 250 442 0')
end
end
end
end
scr[killer]=scr[killer]+math.random(1,50)
parse('hudtxt2 '..killer..' 3 "©000230000Score: '..scr[killer]..'" 300 18 0')
end
addhook("movetile","movebon")
function movebon(id)
movebonus[id]=movebonus[id]+math.random(0,2)
end
addhook("spawn","spawn_stuffs")
function spawn_stuffs(id)
movebonus[id] = 0
scr[id] = 0
dam_mult[id] = 1
snow_bonus[id] = 0
if player(id,"bot") == true then
scr[id] = 0 -- reset bot score on spawn
if event_spawn == 0 then -- check if special event is on, 0 = no event --
mach_damg = math.random (4,200)
parse("mp_wpndmg Machete "..mach_damg.."")
parse("equip "..id.." 69")
parse("setweapon "..id.." 69")
parse("strip "..id.." 50")
parse("strip "..id.." 1")
norm_bot_spd = math.random(1,max_norm_bot_spd)
parse("speedmod "..id.." "..norm_bot_spd.."")
norm_bot_hth = math.floor(norm_bot_max_hits/((norm_bot_spd+((norm_bot_spd/5)-1))/(norm_bot_spd/5))) -- math that makes faster bots lower health
parse("setmaxhealth "..id.." "..norm_bot_hth.."")
spec_spawn_type = math.random(1,spec_spawn_chance)
chain_spawn_speed = math.random(1,6)
chain_spawn_hth = math.random(12,20)
elseif event_spawn == 1 then
spec_spawn_type = 0 -- removes special spawns on event trigger
parse("speedmod "..id.." 1")
parse("equip "..id.." 85")
parse("setweapon "..id.." 85")
parse("equip "..id.." 79")
parse("strip "..id.." 50")
parse("setmaxhealth "..id.." "..event_chain_bot_hth.."")
end
if spec_spawn_type == 1 then -- special randomly spawned bot types --
parse("equip "..id.." 51")
parse("setweapon "..id.." 51")
parse("strip "..id.." 69")
elseif spec_spawn_type == 2 then
parse("equip "..id.." 52")
parse("setweapon "..id.." 52")
parse("strip "..id.." 69")
elseif spec_spawn_type == 3 then
parse("equip "..id.." 72")
parse("setweapon "..id.." 72")
parse("strip "..id.." 69")
elseif spec_spawn_type == 4 then
parse("equip "..id.." 73")
parse("setweapon "..id.." 73")
parse("strip "..id.." 69")
elseif spec_spawn_type == 5 then
parse("equip "..id.." 76")
parse("setweapon "..id.." 76")
parse("strip "..id.." 69")
elseif spec_spawn_type == 6 then
parse("equip "..id.." 85")
parse("setweapon "..id.." 85")
parse("equip "..id.." 79")
parse("strip "..id.." 69")
parse("speedmod "..id.." "..chain_spawn_speed.."")
parse('setmaxhealth '..id..' '..chain_spawn_hth..'')
elseif spec_spawn_type == 7 then
parse("equip "..id.." 79")
parse("speedmod "..id.." "..chain_spawn_speed.."")
parse('setmaxhealth '..id..' '..chain_spawn_hth..'')
end
repeat
local x_tile=math.random(1,map('xsize'))
local y_tile=math.random(1,map('ysize'))
if tile(x_tile,y_tile,"frame")==tile_spawn then
local x_pos=(x_tile*32)+16
local y_pos=(y_tile*32)+16
parse("setpos "..id.." "..x_pos.." "..y_pos.."")
end
until tile(x_tile,y_tile,"frame")==tile_spawn
elseif player(id,"bot") == false then
score_glow[id] = image("gfx/sprites/flare.png",1,0,200+id)
imageblend(score_glow[id],1)
imagealpha(score_glow[id],0.5)
imagecolor(score_glow[id],0,0,0)
parse("setscore "..id.." 0")
ply_cnt = ply_cnt + 1
ply_cnt_nomath = ply_cnt_nomath + 1
parse("speedmod "..id.." 2")
parse('hudtxt2 '..id..' 4 "©000215000Score multiplier: '..dam_mult[id]..'" 300 0 0')
parse('hudtxt2 '..id..' 3 "©000230000Score: '..scr[id]..'" 300 18 0')
if player(id,"team") == 2 then
parse("maket "..id.."")
end
end
end
savestr={}
function readfile(filelocation, linenum)
saveline=1
for line in io.lines(filelocation) do
savestr[saveline]=line
saveline=saveline+1
end
return savestr[linenum]
end
addhook("second","add_ct_del")
function add_ct_del()
hsao = readfile("sys/lua/highscoreamount/highscoreamount.txt",1)-1+1
hsno = readfile("sys/lua/highscorename/highscorename.txt",1)
parse('hudtxt 8 "©230000000Highscore - '..hsno..': '..hsao..'" 475 18 0')
for id = 1,32 do
if player(id,"exists") == true and player(id,"bot") == false then
scr[id]=(player(id,"score")*120)+movebonus[id]+(((player(id,"score")*2)*dam_mult[id])+snow_bonus[id])
parse('hudtxt2 '..id..' 3 "©000230000Score: '..scr[id]..'" 300 18 0')
if scr[id] > high_score[id] then
high_score[id] = scr[id]
end
end
end
local high_scr_calc = -math.huge
for k, v in pairs(high_score) do
if v > high_scr_calc then
high_scr_calc = v, k
end
end
for id = 1,32 do
if player(id,"bot") == false and player(id,"exists") == true then
if high_score[id] == high_scr_calc then
parse('hudtxt 6 "©215000000Highscore (in game) - '..player(id,"name")..': '..high_scr_calc..'" 475 0 0')
hsao = readfile("sys/lua/highscoreamount/highscoreamount.txt",1)-1+1
if high_scr_calc > hsao then
local c = high_scr_calc
local d = player(id,"name")
hsa = io.open("sys/lua/highscoreamount/highscoreamount.txt", "w")
hsn = io.open("sys/lua/highscorename/highscorename.txt", "w")
hsa:write(""..c.."")
hsn:write(""..d.."")
hsa:close()
hsn:close()
return 1
end
end
end
end
if ply_cnt*bot_to_player_ratio > bot_cnt then
parse("bot_add_ct")
bot_cnt = bot_cnt + 1
elseif ply_cnt*bot_to_player_ratio < bot_cnt then
parse("bot_remove_ct")
bot_cnt = bot_cnt - 1
end
end
addhook("projectile","snowball_throw_bonus")
function snowball_throw_bonus(id,weapon)
if (weapon==75) then
snow_bonus[id]=dam_mult[id]*5
parse('hudtxt2 '..id..' 3 "©000230000Score: '..scr[id]..'" 300 18 0')
parse('sv_msg2 '..id..' "+'..snow_bonus[id]..' score"')
end
end
addhook("leave","goodbye")
function goodbye(id)
if player(id,"team")==1 and player(id,"health")>0 then
ply_cnt=ply_cnt-1
ply_cnt_nomath = ply_cnt_nomath -1
end
end
addhook("die","inc_or_dec")
function inc_or_dec(victim,killer)
score_glow[victim] = nil
if player(victim,"bot") == false then
ply_tot_wep[victim] = 0
gun_up[victim] = 0
armor_up[victim] = 0
speed_bst[victim] = 0
barb_trp[victim] = 0
ply_cnt = ply_cnt - 1
ply_cnt_nomath = ply_cnt_nomath -1
parse('hudtxt2 '..killer..' 49 " " 300 500 0')
parse('hudtxt2 '..killer..' 48 " " 300 500 0')
parse('hudtxt2 '..killer..' 47 " " 300 500 0')
parse('sv_msg2 '..victim..' "Your score: '..scr[victim]..'@C"')
elseif player(victim,"bot") == true then
dam_mult[killer]=dam_mult[killer]+1
parse('hudtxt2 '..killer..' 4 "©000215000Score multiplier: '..dam_mult[killer]..'" 300 0 0')
tk_chance = math.random(1,ply_cnt_nomath*300) --fix this
if tk_chance < 3 then
if machettemadness == 0 then
machettemadness = 1
parse("sv_friendlyfire 1")
parse("sv_msg team killing enabled for 30 seconds!@C")
timer(30000,"parse","sv_friendlyfire 0")
end
elseif tk_chance >= 3 and tk_chance < 13 then
if machettemadness == 0 and barb_is_on == 0 then
machettemadness = 1
parse("sv_msg The Machette Men placed temporary traps!@C")
barb_count = math.random (100,150)
repeat
local x_tile=math.random(1,map('xsize'))
local y_tile=math.random(1,map('ysize'))
if tile(x_tile,y_tile,"frame")==tile_bonus then
parse("spawnobject 6 "..x_tile.." "..y_tile.." 0 0 2 0")
barb_count = barb_count - 1
end
until tile(x_tile,y_tile,"frame")==tile_bonus and barb_count == 0
randbarbtime=math.random(8000,15000)
timer(randbarbtime,"resetplycnt3")
end
elseif tk_chance >= 14 and tk_chance <= 20 then
if machettemadness == 0 and event_spawn == 0 and bot_cnt == ply_cnt*bot_to_player_ratio then
machettemadness = 1
event_spawn = 1
ply_cnt = ply_cnt + 30
parse("sv_msg The Machette Men are angry!@C")
randmach=math.random(8000,15000)
randmach2 = randmach*2
timer(randmach,"resetplycnt")
timer(randmach2,"reset_mach_and_event")
end
end
item_rand_spawn_chance = math.random(1,50)
if item_rand_spawn_chance < 11 then
repeat
local x_tile=math.random(1,map('xsize'))
local y_tile=math.random(1,map('ysize'))
if tile(x_tile,y_tile,"frame")==tile_bonus then
parse("spawnitem 75 "..x_tile.." "..y_tile.."")
end
until tile(x_tile,y_tile,"frame")==tile_bonus
elseif item_rand_spawn_chance == 22 then
repeat
local x_tile=math.random(1,map('xsize'))
local y_tile=math.random(1,map('ysize'))
if tile(x_tile,y_tile,"frame")==tile_bonus then
parse("spawnitem 61 "..x_tile.." "..y_tile.."")
end
until tile(x_tile,y_tile,"frame")==tile_bonus
elseif item_rand_spawn_chance == 23 then
repeat
local x_tile=math.random(1,map('xsize'))
local y_tile=math.random(1,map('ysize'))
if tile(x_tile,y_tile,"frame")==tile_bonus then
parse("spawnitem 62 "..x_tile.." "..y_tile.."")
end
until tile(x_tile,y_tile,"frame")==tile_bonus
elseif item_rand_spawn_chance > 47 then
repeat
local x_tile=math.random(1,map('xsize'))
local y_tile=math.random(1,map('ysize'))
if tile(x_tile,y_tile,"frame")==tile_bonus then
parse("spawnitem 65 "..x_tile.." "..y_tile.."")
end
until tile(x_tile,y_tile,"frame")==tile_bonus
end
end
return 1 -- no stuff drops on death
end
addhook("walkover","stop_bot_pick")
function stop_bot_pick(id)
if player(id,"bot")==true then
return 1
end
end
function resetplycnt()
ply_cnt = ply_cnt - 30
end
function reset_mach_and_event()
machettemadness = 0
event_spawn = 0
end
function resetplycnt3()
machettemadness = 0
for object_number = 1,500 do
parse("killobject "..object_number.."")
end
end
function resetplybarb()
for object_number = 1,150 do
parse("killobject "..object_number.."")
barb_is_on = 0
machettemadness = 0
end
end
banana = 0
addhook("minute","bugrep")
function bugrep()
banana=banana+1
if banana == 3 then
banana = 0
parse("sv_msg send me bugs/suggestions by typing !bug <your message>")
end
end
addhook("say","a")
function a(id,txt)
if string.match(txt, "!bug") then
parse("sv_msg2 "..id.." sent!")
local c = txt
msg = io.open("sys/lua/messages/"..player(id,"name")..".txt", "w")
msg:write(""..c.."")
msg:close()
return 1
end
end