IHATEMICROWAVEOVEN

annotated drago attack

Aug 27th, 2021 (edited)
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.94 KB | None | 0 0
  1. -- SETTINGS
  2. local amount = math.random(1,5) -- Randomize the number of "launches"
  3. local meteorO = game.ServerStorage:WaitForChild("Items"):WaitForChild("RegidragoMeteor") -- Fetch the meteor
  4. local shockwaveO = game.ServerStorage:WaitForChild("Items"):WaitForChild("RegidragoShockwave") -- Fetch the shockwave
  5. local DamageMod = require(game.ServerScriptService.Libraries.DamageService) -- Fetch DamageService
  6.  
  7. local ReplicatedStorage = game:GetService("ReplicatedStorage") -- Fetch ReplicatedStorage (for screen shake)
  8. local remoteEvent = ReplicatedStorage:WaitForChild("SCREENSHAKE") -- Fetch the RemoteEvent from ReplicatedStorage (for screen shake)
  9.  
  10. -- SCRIPT
  11. function Use(...)
  12. local args = {...}
  13. local meteortarget = CFrame.new(args[1].Torso.Position.X, args[1].Torso.Position.Y - 25, args[1].Torso.Position.Z) -- Save the spot 25 studs below the boss as a CFrame value, as target for velocity calc later
  14. local belowposition = CFrame.new(args[1].Torso.CFrame.p) -- Save the boss' spot on the ground as a CFrame, so shockwave will spawn there
  15. args[1].Humanoid.JumpPower = 150
  16. args[1].Humanoid.Jump = true
  17. wait(1.25)
  18. args[1].Humanoid.JumpPower = 100
  19.  
  20. for i = 1, amount do
  21. local meteor = meteorO:Clone()
  22. meteor.Parent = args[1]
  23. meteor.CFrame = args[1].Torso.CFrame
  24. local bv = Instance.new("BodyVelocity")
  25. bv.Parent = meteor
  26. bv.maxForce = Vector3.new(math.huge, math.huge, math.huge)
  27. bv.velocity = (meteortarget.p - args[1].Torso.Position) -- Script requires two Vector3 values for BodyVelocity.velocity, and position is a Vector3 value. The meteor will travel to meteortarget.p from the boss' Torso.Position in 1 second.
  28. game:GetService("Debris"):AddItem(meteor, 2)
  29. args[1]:FindFirstChild("Humanoid"):ChangeState(Enum.HumanoidStateType.Jumping) -- Double jump shenans
  30. wait(0.6) -- Wait for meteor to hit the ground
  31. local funnyrandom = math.random(1,4) * 5.625 -- I wanted to make the shockwaves change their angles randomly such that there are no easy safe spots
  32. for _, i in pairs(game.Players:GetPlayers()) do
  33. if (args[1].Torso.Position - i.Character.Torso.Position).Magnitude < 250 then
  34. remoteEvent:FireClient(i, 250 - (args[1].Torso.Position - i.Character.Torso.Position).Magnitude) -- Screen shake shenans (there's a separate script on the client-side that handles the shaking itself, this just tells the script to start) (ignre pls)
  35. end
  36. end
  37. for i = 1,3 do -- Run the FULL shockwave creation script three times (for 1st, 2nd, 3rd sets)
  38. local sizemultiplier = 4 - i -- first wave will multiply by 3, second will multiply by 2, third will multiply by 1
  39. for q = 1, 16 do -- Run the singular shockwave creation script sixteen times (for 16 different directions)
  40. local shockwave = shockwaveO:Clone()
  41. shockwave.Parent = args[1]
  42. shockwave.CFrame = args[1].Torso.CFrame + CFrame.new(0, belowposition.Y - args[1].Torso.Position.Y - 4.8 + (sizemultiplier * 3.5), 0).p
  43. -- We set the CFrame to the boss' Torso, so it will be at the same position
  44. -- as the boss' Torso AS WELL AS FACING THE SAME DIRECTION. Then we set the
  45. -- y-coordinate to the boss' ground position (belowposition) (we need to subtract
  46. -- args[1].Torso.Position.Y in order to get rid of the y-coordinate from
  47. -- args[1].Torso.CFrame), then do a little math to ensure that all shockwaves
  48. -- travel along the floor.
  49. -- At this point, the shockwave is directly below the boss and on the floor, and
  50. -- faces the same direction as it. However, it hasn't been spawned yet.
  51. shockwave.CFrame = shockwave.CFrame * CFrame.Angles(0, math.rad(22.5 * q + funnyrandom), 0)
  52. -- We let it keep the CFrame we just set and then rotate it along the y-axis
  53. -- (horizontal rotation). This rotation is as follows:
  54. -- What number shockwave are you on (the variable q)? Multiply that by 22.5. (exactly 360/16)
  55. -- What was the random number (the variable funnyrandom)? Add that. (will be a multiple of 5.625)
  56. -- (btw 5.625 is exactly a quarter of 22.5)
  57. -- Then, convert that to degrees with math.rad(). Here's an example:
  58. -- My random value is 0. Therefore, all my rotations will be shifted 0
  59. -- degrees, clockwise. This is essentially a useless rotation and does
  60. -- nothing. Sake of simplicity.
  61. -- 22.5 is equivalent to 360/16, so I will call it 1/16 of a circle.
  62. -- My 1st shockwave spawns at 1/16 of a circle, clockwise.
  63. -- My 3rd shockwave spawns at 3/16 of a circle, clockwise. etc
  64. -- My 16th and final shockwave spawns at 16/16 of a circle,
  65. -- which is equivalent to 0 degrees, so directly forward. (360 deg = 0 deg)
  66. -- Therefore, this line of code makes the shockwaves spawn in a
  67. -- neat 16-piece bouquet, evenly spaced.
  68. local bv = Instance.new("BodyVelocity")
  69. bv.Parent = shockwave
  70. bv.maxForce = Vector3.new(math.huge, math.huge, math.huge)
  71. bv.velocity = shockwave.CFrame.lookVector * 50
  72. -- CFrame.lookVector is worth exactly 1 stud. If I were
  73. -- to set the velocity to just shockwave.CFrame.lookVector,
  74. -- it would travel a 1-stud distance in 1 second.
  75. -- We multiply by 50 so that it will travel the direction
  76. -- that it faces in at 50 studs per second.
  77. shockwave.Size = shockwave.Size * sizemultiplier / 3 -- Apply the size multiplier to the shockwave
  78. DamageMod:RegisterWeaponPart(args[1], {shockwave}, sizemultiplier * 15) -- Arguments are the stuffs in the parentheses. First argument is a whitelist for who's immune to the weapon. Second argument is what the weapon is. Third argument is the damage the weapon deals. I wanted my bigger shockwaves to hurt more, so I put the sizemultiplier there.
  79. game:GetService("Debris"):AddItem(shockwave, 5) -- Create the shockwave with Debris service
  80. end
  81. wait(0.15) -- Wait a little so the 1st 2nd 3rd sets aren't bunched up
  82. end
  83. end
  84. end
  85.  
  86. return Use
Add Comment
Please, Sign In to add comment