PWADŽ)--Script created by TheBoltWhatever with the help of the SRB2 and the SRB2 Brasil Discord Servers --Thanks Jon, Mecha and Pacola for guiding me :thumbsup: --Inspired by ChrispyChars local btnSpin = 0 local btnJump = 0 local btnBackward = false local btnStrafeLeft = false local btnStrafeRight = false local isCharging = false addHook("SpinSpecial", function(player) if player.mo and player.mo.valid and player.mo.skin == "tails" if P_IsObjectOnGround(player.mo) //print("Highway, that's my scene") //print("I may look like a blur when you see me") if player.mo.state == S_PLAY_SPINDASH btnSpin = $ + TICRATE*1 if player.cmd.buttons & BT_JUMP --To prevent incompatibility with L_ClassicSpindash player.pflags = $1|PF_JUMPSTASIS btnJump = $ + TICRATE*1 end /*print("The man in the rain picked up his bag of secrets...") print("and journeyed up the mountainside") print("far above the clouds...")*/ end end end return false end) addHook("PlayerThink", function(player) if not (player.mo or player.mo.valid) return end if player.mo.skin == "tails" --To prevent getting tired in a ascending platform if player.mo.safetyCounter == nil player.mo.safetyCounter = 0 end --Also this: if player.mo.safetySwitch == nil player.mo.safetySwitch = false end if player.mo.skidSwitch == nil player.mo.skidSwitch = false end if player.mo.skidCounter == nil player.mo.skidCounter = 0 end if player.mo.deathByDrowning == nil player.mo.deathByDrowning = false end if player.mo.chargeTime == nil player.mo.chargeTime = 0 end if player.mo.soundCounter == nil player.mo.soundCounter = 0 end if player.mo.thrust == nil player.mo.thrust = 0 end if player.mo.maxThrust == nil player.mo.maxThrust = TICRATE*60 end if player.mo.minThrust == nil player.mo.minThrust = TICRATE*8 end if player.mo.flyingSound == nil player.mo.flyingSound = 0 end if player.mo.tailspin == nil player.mo.tailspin = false end --Check for "SpinAbility": if not (player.cmd.buttons & BT_USE) btnSpin = 0 end --Check for Jumping: if not (player.cmd.buttons & BT_JUMP) btnJump = 0 end if (btnJump ~= 0 and btnSpin ~= 0) isCharging = true else isCharging = false end if player.speed ~= 0 or P_IsObjectOnGround(player.mo) == false isCharging = false end if isCharging == true player.mo.state = S_PLAY_RUN P_DoSpinDashDust(player) player.pflags = $1|PF_FULLSTASIS player.mo.chargeTime = $ + TICRATE*1 player.mo.soundCounter = $ + TICRATE*1 else player.pflags = $ & ~(PF_FULLSTASIS) player.mo.chargeTime = 0 player.mo.soundCounter = 0 end --Plays the spindash sound when charging if (player.mo.soundCounter == TICRATE*1 and player.mo.skidCounter > 0) S_StartSound(player.mo, sfx_spndsh) elseif player.mo.soundCounter == TICRATE*16 S_StartSound(player.mo, sfx_spndsh) elseif player.mo.soundCounter == TICRATE*32 S_StartSound(player.mo, sfx_spndsh) elseif player.mo.soundCounter == TICRATE*48 S_StartSound(player.mo, sfx_spndsh) /*elseif player.mo.soundCounter == TICRATE*64 S_StartSound(player.mo, sfx_spndsh) elseif player.mo.soundCounter == TICRATE*80 S_StartSound(player.mo, sfx_spndsh)*/ end if player.mo.chargeTime ~= 0 player.mo.thrust = player.mo.chargeTime end --Prevents take-off when getting damage if P_PlayerInPain(player) then player.mo.thrust = 0 player.mo.state = S_PLAY_PAIN end --When not full charged: if (player.mo.thrust ~= 0 and player.mo.thrust <= player.mo.maxThrust and player.mo.thrust >= player.mo.minThrust) and isCharging == false if player.powers[pw_underwater] player.mo.state = S_PLAY_SWIM P_SetObjectMomZ(player.mo, (player.mo.thrust/200)*FRACUNIT, false) else player.mo.state = S_PLAY_FLY P_SetObjectMomZ(player.mo, (player.mo.thrust/100)*FRACUNIT, false) end player.mo.safetySwitch = true player.pflags = $ & ~(PF_FULLSTASIS) //P_SetObjectMomZ(player.mo, (player.mo.thrust/100)*FRACUNIT, false) player.powers[pw_tailsfly] = (tailsflytics - (player.mo.thrust/14)) --(255 ~ 130) player.pflags = $ | PF_THOKKED --THIS PLAYS THE putput SOUND WHEN FLYING player.pflags = $ | PF_CANCARRY --When fully charged: elseif player.mo.thrust >= player.mo.maxThrust and isCharging == false if player.powers[pw_underwater] player.mo.state = S_PLAY_SWIM P_SetObjectMomZ(player.mo, (player.mo.maxThrust/200)*FRACUNIT, false) else player.mo.state = S_PLAY_FLY P_SetObjectMomZ(player.mo, (player.mo.maxThrust/100)*FRACUNIT, false) end player.mo.safetySwitch = true player.pflags = $ & ~(PF_FULLSTASIS) //P_SetObjectMomZ(player.mo, (player.mo.maxThrust/100)*FRACUNIT, false) player.powers[pw_tailsfly] = ((tailsflytics/2) - 10) --(130, very specific right?) player.pflags = $ | PF_THOKKED player.pflags = $ | PF_CANCARRY end if player.mo.state == S_PLAY_FLY or player.mo.state == S_PLAY_SWIM player.mo.tailspin = true end if player.mo.safetySwitch == true player.mo.safetyCounter = $ + TICRATE*1 end if player.mo.safetyCounter == TICRATE*5 player.mo.safetyCounter = 0 player.mo.safetySwitch = false end if player.mo.tailspin == true if not player.mo.safetySwitch player.mo.thrust = 0 --Fix: Can't fly after a Tailspin while in CEZ Catapults player.pflags = $ & ~PF_JUMPED end if (P_IsObjectOnGround(player.mo) and not player.mo.safetySwitch) or (player.powers[pw_carry]) player.mo.tailspin = false end end --Skid Break: if (player.mo.state == S_PLAY_SKID) and btnBackward == true and not (player.mo.TwoDEngage) player.mo.skidSwitch = true end --Fixes: Skid doesn't work in 2D Mode if (player.mo.state == S_PLAY_SKID) and player.mo.TwoDEngage and not (btnBackward) if P_IsObjectOnGround(player.mo) if (player.mo.angle <= 0) --Looking left (Works) if (btnStrafeLeft) or (btnStrafeRight) player.mo.skidSwitch = true else player.mo.skidSwitch = false end end end end if player.mo.skidSwitch == true player.mo.skidCounter = $ + 1 end if player.mo.skidCounter == 10 player.mo.skidSwitch = false player.mo.skidCounter = 0 end if (player.mo.skidCounter > 0 and player.mo.skidCounter < 10) and (player.cmd.buttons & BT_SPIN) //and P_IsObjectOnGround(player.mo) //and not (player.mo.state == S_PLAY_ROLL) player.pflags = $ | PF_JUMPSTASIS player.mo.momx = 0; player.mo.momy = 0; player.mo.momz = 0 player.pflags = $ | PF_STARTDASH player.mo.state = S_PLAY_SPINDASH end if (player.mo.skidCounter == 0) and (player.speed == 0) and P_IsObjectOnGround(player.mo) and not ((player.pflags & PF_STARTDASH) or isCharging) player.mo.state = S_PLAY_STND end if not (player.mo.state == S_PLAY_SPINDASH or player.mo.state == S_PLAY_RUN or player.mo.state == S_PLAY_SKID) player.mo.skidSwitch = false player.mo.skidCounter = 0 end if (player.mo.skidCounter > 0) and (player.mo.skidCounter < 10) then player.mo.skidSwitch = true end --Fixes: _DEAD animation bugs if you die while charging a Tailspin if (player.playerstate ~= PST_LIVE) //print("OW") player.mo.thrust = 0 --Fixes: Playing _DEAD while dying by DROWNING or SPACEDROWN if player.mo.deathByDrowning == true player.mo.state = S_PLAY_DRWN else player.mo.state = S_PLAY_DEAD end end --Fixes: Prevent Spindash animation after being launched by a Mace Swing if player.mo.state == S_PLAY_SPINDASH and (player.powers[pw_carry] & CR_MACESPIN) then player.mo.state = S_PLAY_ROLL end --Fixes: Skid doesn't work on 2D Mode if (player.mo.flags2 & MF2_TWOD > 0) player.mo.TwoDEngage = true else player.mo.TwoDEngage = false end end //print("-----------------") //print("Spd:", player.speed) //print("SpinBtn: ",btnSpin) //print("JumpBtn: ",btnJump) //print("isCharging:", isCharging) //print("chargeTime: ",player.mo.chargeTime) //print("Thrust: ",player.mo.thrust) //print("Tailspin? ",player.mo.tailspin) //print("Max Thrust: ",player.mo.maxThrust) //print("On Ground? ",P_IsObjectOnGround(player.mo)) //print("Flight Time: ",player.powers[pw_tailsfly]) //print("Thokked? ",player.pflags & PF_THOKKED) //print("Jumped? ",player.pflags & PF_JUMPED) //print("JumpDown? ",player.pflags & PF_JUMPDOWN) //print("CanCarry? ",player.pflags & PF_CANCARRY) //print("flytics: ", tailsflytics) //print("Safety Switch? ", player.mo.safetySwitch) //print("Safety Counter: ", player.mo.safetyCounter) //print("btnBackward? ", btnBackward) //print("skidSwitch? ",player.mo.skidSwitch) //print("skidCounter: ",player.mo.skidCounter) //print("-----------------") //print(player.mo.deathByDrowning) //print(player.mo.angle) end) addHook("PlayerCmd", function(player, cmd) if cmd.forwardmove < 0 btnBackward = true else btnBackward = false end if (cmd.sidemove < 0) and not (cmd.sidemove == 0) btnStrafeLeft = true else btnStrafeLeft = false end if (cmd.sidemove > 0) and not (cmd.sidemove == 0) btnStrafeRight = true else btnStrafeRight = false end end) --Fixes: _DEAD replaces _DRWN due to the Tailspin _DEAD bug addHook("MobjDeath", function(target, inflictor, source, damagetype) if not target and target.valid return end if target.skin ~= "tails" return end if (damagetype == DMG_DROWNED or damagetype == DMG_SPACEDROWN) target.deathByDrowning = true else target.deathByDrowning = false end end) --Fixes: strange behavior with THZ smoke tubes addHook("TouchSpecial", function(special, toucher) if not toucher and toucher.valid return end if toucher.skin != "tails" return end if (isCharging == true) return true end end, MT_STEAM)Character 2 Status 0 Character 2 SkinName = tails DisplayName = Tails TagTextColor = SKINCOLOR_YELLOW TagOutlineColor = SKINCOLOR_BLUE PlayerText = ^7Tails^0 can get around many obstacles thanks to his ability to fly. ^7Ability:^0 Fly Double jump to start flying. Keep pressing jump to ascend or press spin to descend. When time runs out, he'll get tired and slowly sink back down. ^7Ability:^0 Tailspin Hold spin and then jump to start charging. Release to fly upwards quickly. He'll get tired faster afterwards. # k'LUA_TLSPw'SOC_TAIL