--almost all of the code here was "borrowed" from Royall's sniper laser script, knowing when you're dead --and properly cleaning up is quite important for any script applied directly to bots. --Trace is from a sample script written by Bazooks --This script is based on Parachute_Auto_Deploy, another script of mine --bots will need autojumps to utilize this script, due to it directly setting velocity --this script does not come with much innate cosmetic flair, you'll need to provide some of that yourself popfile-side --I'd recommend adding a jetpack cosmetic, like the jupiter jetpack and maybe throw in some unusual effects on some shoe cosmetics --this script can be specialized into some fun gimmicks like manntreads bombing or sentry buster tomfoolery, if you so wish --if you want to get started on that sort of thing, check "trace" under globals.lua local function getEyeAngles(player) --function from royal, used for the overpass check local pitch = player["m_angEyeAngles[0]"] local yaw = player["m_angEyeAngles[1]"] return Vector(pitch, yaw, 0) end local function removeCallbacks(player, callbacks) if not IsValid(player) then return end for _, callbackId in pairs(callbacks) do player:RemoveCallback(callbackId) end end function CheckGround(_, activator) local callbacks = {} local check local terminated = false local Zvalue local forwardBackMovement = 0 local leftRightMovement = 0 local upDownMovement = 0 local keyWasPressed = false local StopJetpacking local function terminate() if terminated then return end terminated = true timer.Stop(check) timer.Stop(update) removeCallbacks(activator, callbacks) end activator:AddCallback(ON_KEY_PRESSED, function(_, key) --oh boy, I can't wait for a clean switch statement to be sent to the if statement spam dimension. if key == IN_BACK then forwardBackMovement = forwardBackMovement - 600 print(forwardBackMovement) keyWasPressed = true if forwardBackMovement < -600 then forwardBackMovement = -600 end end if key == IN_FORWARD then forwardBackMovement = forwardBackMovement + 600 print(forwardBackMovement) keyWasPressed = true if forwardBackMovement > 600 then forwardBackMovement = 600 end end if key == IN_MOVELEFT then leftRightMovement = leftRightMovement + 600 print(leftRightMovement) keyWasPressed = true if leftRightMovement > 600 then leftRightMovement = 600 end end if key == IN_MOVERIGHT then leftRightMovement = leftRightMovement - 600 print(leftRightMovement) keyWasPressed = true if leftRightMovement < -600 then leftRightMovement = -600 end end end) activator:AddCallback(ON_KEY_RELEASED, function(_, key) --oh boy, I can't wait for a clean switch statement to be sent to the if statement spam dimension. if key == IN_BACK then forwardBackMovement = forwardBackMovement + 600 print(forwardBackMovement) keyWasPressed = false if forwardBackMovement > 600 then forwardBackMovement = 600 end end if key == IN_FORWARD then forwardBackMovement = forwardBackMovement - 600 print(forwardBackMovement) keyWasPressed = false if forwardBackMovement < -600 then forwardBackMovement = -600 end end if key == IN_MOVELEFT then leftRightMovement = leftRightMovement - 600 print(leftRightMovement) keyWasPressed = false if leftRightMovement < -600 then leftRightMovement = -600 end end if key == IN_MOVERIGHT then leftRightMovement = leftRightMovement + 600 print(leftRightMovement) keyWasPressed = false if leftRightMovement > 600 then leftRightMovement = 600 end end end) check = timer.Create(0.015, function() if not IsValid(activator) or not activator:IsAlive() then terminate() return end --sine wave function Zvalue = 74 * math.sin((CurTime() / 3)) + 330 --print (Zvalue) local TraceDownwards = { start = activator, -- Start position vector. Can also be set to entity, in this case the trace will start from entity eyes position endpos = nil, -- End position vector. If nil, the trace will be fired in `angles` direction with `distance` length distance = 8192, -- Used if endpos is nil angles = Vector(90,0,0), -- Used if endpos is nil mask = MASK_SOLID, -- Solid type mask, see MASK_* globals collisiongroup = COLLISION_GROUP_DEBRIS, -- Pretend the trace to be fired by an entity belonging to this group. See COLLISION_GROUP_* globals mins = Vector(0,0,0), -- Extends the size of the trace in negative direction maxs = Vector(0,0,0), -- Extends the size of the trace in positive direction filter = nil -- Entity to ignore. Can be a single entity, table of entities, or a function with a single entity parameter } local TraceUpwards = { start = activator, -- Start position vector. Can also be set to entity, in this case the trace will start from entity eyes position endpos = nil, -- End position vector. If nil, the trace will be fired in `angles` direction with `distance` length distance = 500, -- Used if endpos is nil angles = Vector(180,0,0), -- Used if endpos is nil mask = MASK_SOLID, -- Solid type mask, see MASK_* globals collisiongroup = COLLISION_GROUP_DEBRIS, -- Pretend the trace to be fired by an entity belonging to this group. See COLLISION_GROUP_* globals mins = Vector(0,0,0), -- Extends the size of the trace in negative direction maxs = Vector(0,0,0), -- Extends the size of the trace in positive direction filter = nil -- Entity to ignore. Can be a single entity, table of entities, or a function with a single entity parameter } local eyeAngles = getEyeAngles(activator) local TraceForwards = { start = activator, distance = 40, angles = eyeAngles, mask = MASK_SOLID, collisiongroup = COLLISION_GROUP_DEBRIS, } local downTraceTable = util.Trace(TraceDownwards) ZvalueDown = downTraceTable["StartPos"] - downTraceTable["HitPos"] - 68 local UpTraceTable = util.Trace(TraceUpwards) --ceiling check local ForwardTraceTable = util.Trace(TraceForwards) --face against overpass check if UpTraceTable["Hit"] == true or ForwardTraceTable["Hit"] == true then StopJetpacking = true elseif ZvalueDown[3] == 0 then StopJetpacking = true else StopJetpacking = false end --print (StopJetpacking) if ZvalueDown[3] >= (Zvalue + 100) and StopJetpacking == false then upDownMovement = 0 elseif ZvalueDown[3] < (Zvalue + 100) then upDownMovement = 480 --print ("deploy parachute") end if StopJetpacking == false then --activator:SetForwardVelocity(forwardBackMovement) activator:RunScriptCode("activator.SetAbsVelocity(Vector(" .. forwardBackMovement .. ", " .. leftRightMovement .. ", " .. upDownMovement .. " ));", activator) if keyWasPressed == false then leftRightMovement = math.floor(leftRightMovement * 0.99) forwardBackMovement = math.floor(forwardBackMovement * 0.99) end end end, 0) --negative y right, positive y left, positive x forward, negative x backward callbacks.died = activator:AddCallback(ON_DEATH, function() terminate() end) callbacks.removed = activator:AddCallback(ON_REMOVE, function() terminate() end) callbacks.spawned = activator:AddCallback(ON_SPAWN, function() terminate() end) end