// March of the Machines (V1.0) // A simple lua script absurdly buffing bots, for masochists looking for a challenge //----------------- // Commands, pretty self explained // Made only with solo in mind, but should work in netplay too local mm_enabled = 1 COM_AddCommand("mm_enable", function(player, var) if tonumber(var) == 0 or var == "off" CONS_Printf(player, "MM disabled. Bots will hold back from now.") mm_enabled = 0 elseif tonumber(var) == 1 or var == "on" CONS_Printf(player, "MM enabled. Good luck.") mm_enabled = 1 elseif tonumber(var) == 2 or var == "hard" CONS_Printf(player, "MM Hard Mode enabled. Wait, it can be harder?") mm_enabled = 2 elseif tonumber(var) == 3 or var == "fair" CONS_Printf(player, "MM Fair Mode enabled. No huge buffs, only the small changes.") mm_enabled = 3 else CONS_Printf(player, "0/off for disable, 1/on for enable, 2/hard for Hard Mode, 3/fair for Fair Mode") end end) // A simplified and tweaked version of the AvoidObstacles function used in the SRB2 Kart Player Bots mod // The goal here is to make this function DRRR compatible and making it less laggy (or at least trying to) // Original SRB2 Kart Player Bots mod script by Sonic1983 local function AvoidObstacles(mo, obstacles) local player = mo.player if obstacles and obstacles.valid and obstacles.health and R_PointToDist2(mo.x, mo.y, obstacles.x, obstacles.y) < 350*mo.scale // Base value : 512*FRACUNIT, using mo.scale because of the mobjscale being different for each map. Reducing detection distance because of lag. and P_CheckSight(mo, obstacles) // Doing specific obstacles checks here because scanning all obstacles makes it even more laggy // *Gru pointing a gun on you* You want to dodge items? Name all item objects and (obstacles.type == MT_EGGMANITEM or obstacles.type == MT_BANANA or obstacles.type == MT_EGGMANITEM_SHIELD or obstacles.type == MT_BANANA_SHIELD or obstacles.type == MT_ORBINAUT or (obstacles.type == MT_ORBINAUT_SHIELD and obstacles.target != mo) or obstacles.type == MT_JAWZ or (obstacles.type == MT_JAWZ_SHIELD and obstacles.target != mo) or obstacles.type == MT_SSMINE or obstacles.type == MT_SSMINE_SHIELD or obstacles.type == MT_LANDMINE or obstacles.type == MT_DUELBOMB or obstacles.type == MT_BALLHOG or obstacles.type == MT_HYUDORO or obstacles.type == MT_HYUDORO_CENTER or obstacles.type == MT_DROPTARGET or obstacles.type == MT_DROPTARGET_SHIELD or obstacles.type == MT_GACHABOM_REBOUND or obstacles.type == MT_LSZ_EGGBALL or obstacles.type == MT_KART_LEFTOVER or obstacles.type == MT_GARDENTOP or obstacles.type == MT_BUBBLESHIELD or obstacles.type == MT_FALLINGROCK or (obstacles.type == MT_PLAYER and obstacles != mo and obstacles.player)) local angle = R_PointToAngle2(0, 0, mo.momx, mo.momy) local angle2 = R_PointToAngle2(mo.x, mo.y, obstacles.x, obstacles.y) local anglediff = angle - angle2 if anglediff == 0 mo.angle = $1 + ANG2 P_Thrust(mo, mo.angle+ANGLE_90, mo.scale) // Still using mo.scale instead of FRACUNIT. Also increasing base thrust elseif anglediff > 0 mo.angle = $1 + ANG2 P_Thrust(mo, mo.angle+ANGLE_90, mo.scale) elseif anglediff < 0 mo.angle = $1 - ANG2 P_Thrust(mo, mo.angle-ANGLE_90, mo.scale) end end end addHook("ThinkFrame", function(player) for player in players.iterate do if player.mo != nil and player.mo.valid and player.bot // Are you a bot ? // Is the script enabled ? if mm_enabled == 1 // Rubberbanding buff player.speedboost = (FRACUNIT/3) + (player.position*FRACUNIT/10) // Double item if player.itemtype <= 0 player.justHadItem = 0 // Preventing loops elseif player.itemtype > 0 and player.justHadItem == 0 and player.itemtype != 13 // Double shrink makes the game laggy and player.itemtype != 11 // Double SPB is useless player.justHadItem = 1 player.itemamount = $ * 2 end // Random boosts if (leveltime > starttime) and not player.exiting local randomnumber = P_RandomRange(200, 600) if (leveltime % randomnumber) == 0 K_DoSneaker(player, 1) end end // Dodging behavior if not player.invincibilitytime and not (player.growshrinktimer > 0) and player.spinouttimer == 0 and not player.exiting and (leveltime > starttime) and P_IsObjectOnGround(player.mo) searchBlockmap("objects", AvoidObstacles, player.mo, player.mo.x-RING_DIST*2, player.mo.x+RING_DIST*2, player.mo.y-RING_DIST*2, player.mo.y+RING_DIST*2) end // Startboost modifications if (leveltime < starttime) if player.spindash > 3 // Making bots not commiting sudoku with their spindash before the race begins player.spindash = 0 end elseif (leveltime == starttime) // Forcing a huge boost at the moment the race begins player.sneakertimer = 10 player.numsneakers = 13 end // Voltage usage if player.trickcharge and P_IsObjectOnGround(player.mo) P_Thrust(player.mo, player.mo.angle, player.speed/2) S_StartSound(player.mo, sfx_gshba) player.trickcharge = 0 player.infinitether = TICRATE*2 end end // Did you anger the false gods ? if mm_enabled == 2 // Huge speed buff player.speedboost = (FRACUNIT/2) + (player.position*FRACUNIT/10) // Triple item if player.itemtype <= 0 player.justHadItem = 0 elseif player.itemtype > 0 and player.justHadItem == 0 and player.itemtype != 13 // Imagine 3 shrinks and player.itemtype != 11 // No player.justHadItem = 1 player.itemamount = $ * 3 end // Random invincibilities if (leveltime > starttime) and not player.exiting local randomnumber = P_RandomRange(200, 600) if (leveltime % randomnumber) == 0 player.invincibilitytimer = $ + 35 end end // Dodging behavior if not player.invincibilitytime and not (player.growshrinktimer > 0) and player.spinouttimer == 0 and not player.exiting and (leveltime > starttime) and P_IsObjectOnGround(player.mo) searchBlockmap("objects", AvoidObstacles, player.mo, player.mo.x-RING_DIST*2, player.mo.x+RING_DIST*2, player.mo.y-RING_DIST*2, player.mo.y+RING_DIST*2) end // Absurd startboost modifications if (leveltime < starttime) if player.spindash > 0 player.spindash = 0 end elseif (leveltime == starttime) // Yeet player.sneakertimer = 10*(16-player.position) player.numsneakers = 15 end // Voltage usage if player.trickcharge and P_IsObjectOnGround(player.mo) P_Thrust(player.mo, player.mo.angle, player.speed/2) S_StartSound(player.mo, sfx_gshba) player.trickcharge = 0 player.infinitether = TICRATE*2 end end // No bullshit if mm_enabled == 3 // Dodging behavior if not player.invincibilitytime and not (player.growshrinktimer > 0) and player.spinouttimer == 0 and not player.exiting and (leveltime > starttime) and P_IsObjectOnGround(player.mo) searchBlockmap("objects", AvoidObstacles, player.mo, player.mo.x-RING_DIST*2, player.mo.x+RING_DIST*2, player.mo.y-RING_DIST*2, player.mo.y+RING_DIST*2) end // Startboost modifications if (leveltime < starttime) if player.spindash > 3 // Making bots not commiting sudoku with their spindash before the race begins player.spindash = 0 end elseif (leveltime == starttime) // Forcing a huge boost at the moment the race begins player.sneakertimer = 10 player.numsneakers = 13 end // Voltage usage if player.trickcharge and P_IsObjectOnGround(player.mo) P_Thrust(player.mo, player.mo.angle, player.speed/2) S_StartSound(player.mo, sfx_gshba) player.trickcharge = 0 player.infinitether = TICRATE*2 end end end end end)