Hasli4

Untitled

Oct 13th, 2026 (edited)
44
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.99 KB | None | 0 0
  1. local TweenService = game:GetService("TweenService")
  2. local Debris = game:GetService("Debris")
  3.  
  4. local boss = script.Parent
  5. local humanoid = boss:WaitForChild("Humanoid")
  6. local rootPart = boss:WaitForChild("HumanoidRootPart")
  7.  
  8. local dataFolder = workspace:WaitForChild("Data")
  9. local playerValue = dataFolder:WaitForChild("Player")
  10.  
  11. --------------------------------------------------
  12. -- НАСТРОЙКИ БОССА
  13. --------------------------------------------------
  14.  
  15. local ACTIVATION_DISTANCE = 45
  16.  
  17. -- Во сколько раз увеличивается капитан
  18. local BOSS_SCALE = 3
  19.  
  20. -- Радиус обычной атаки
  21. local ATTACK_DISTANCE = 14
  22.  
  23. -- Урон
  24. local DAMAGE = 35
  25.  
  26. -- Время между атаками
  27. local ATTACK_COOLDOWN = 1.7
  28.  
  29. -- Задержка до момента попадания
  30. local HIT_DELAY = 0.45
  31.  
  32. -- Радиус мощной ударной волны
  33. local SHOCKWAVE_RADIUS = 20
  34.  
  35. --------------------------------------------------
  36. -- СОСТОЯНИЕ
  37. --------------------------------------------------
  38.  
  39. local awakened = false
  40. local attacking = false
  41.  
  42. --------------------------------------------------
  43. -- СЕРВЕРНОЕ ВЛАДЕНИЕ ФИЗИКОЙ
  44. --------------------------------------------------
  45.  
  46. pcall(function()
  47. rootPart:SetNetworkOwner(nil)
  48. end)
  49.  
  50. --------------------------------------------------
  51. -- HUMANOID
  52. --------------------------------------------------
  53.  
  54. humanoid.AutoRotate = false
  55.  
  56. --------------------------------------------------
  57. -- ANIMATOR
  58. --------------------------------------------------
  59.  
  60. local animator = humanoid:FindFirstChildOfClass("Animator")
  61.  
  62. if not animator then
  63. animator = Instance.new("Animator")
  64. animator.Parent = humanoid
  65. end
  66.  
  67. --------------------------------------------------
  68. -- ПОИСК АНИМАЦИИ АТАКИ
  69. --------------------------------------------------
  70.  
  71. local animateScript = boss:FindFirstChild("Animate")
  72. local attackAnimation = nil
  73.  
  74. if animateScript then
  75.  
  76. local toolSlash = animateScript:FindFirstChild("toolslash")
  77.  
  78. if toolSlash then
  79.  
  80. for _, object in ipairs(toolSlash:GetDescendants()) do
  81.  
  82. if object:IsA("Animation") then
  83. attackAnimation = object
  84. break
  85. end
  86.  
  87. end
  88.  
  89. end
  90.  
  91. -- Запасной поиск
  92. if not attackAnimation then
  93.  
  94. for _, object in ipairs(animateScript:GetDescendants()) do
  95.  
  96. if object:IsA("Animation") then
  97.  
  98. local objectName = object.Name:lower()
  99.  
  100. if string.find(objectName, "slash")
  101. or string.find(objectName, "attack") then
  102.  
  103. attackAnimation = object
  104. break
  105.  
  106. end
  107.  
  108. end
  109.  
  110. end
  111.  
  112. end
  113. end
  114.  
  115. local attackTrack = nil
  116.  
  117. if attackAnimation then
  118.  
  119. attackTrack = animator:LoadAnimation(attackAnimation)
  120. attackTrack.Priority = Enum.AnimationPriority.Action
  121. attackTrack.Looped = false
  122.  
  123. print("Captain: анимация атаки найдена")
  124.  
  125. else
  126.  
  127. warn("Captain: анимация атаки не найдена")
  128.  
  129. end
  130.  
  131. --------------------------------------------------
  132. -- ФУНКЦИЯ ПОВОРОТА К ИГРОКУ
  133. --------------------------------------------------
  134.  
  135. local function lookAtPlayer()
  136.  
  137. local player = playerValue.Value
  138.  
  139. if not player then
  140. return nil
  141. end
  142.  
  143. local character = player.Character
  144.  
  145. if not character then
  146. return nil
  147. end
  148.  
  149. local targetRoot = character:FindFirstChild("HumanoidRootPart")
  150.  
  151. if not targetRoot then
  152. return nil
  153. end
  154.  
  155. local lookPosition = Vector3.new(
  156. targetRoot.Position.X,
  157. rootPart.Position.Y,
  158. targetRoot.Position.Z
  159. )
  160.  
  161. local targetCFrame = CFrame.lookAt(
  162. rootPart.Position,
  163. lookPosition
  164. )
  165.  
  166. -- Поворачиваем постепенно
  167. local tween = TweenService:Create(
  168. rootPart,
  169. TweenInfo.new(
  170. 0.25,
  171. Enum.EasingStyle.Quad,
  172. Enum.EasingDirection.Out
  173. ),
  174. {
  175. CFrame = targetCFrame
  176. }
  177. )
  178.  
  179. tween:Play()
  180.  
  181. return targetRoot
  182. end
  183.  
  184. --------------------------------------------------
  185. -- ЭФФЕКТ КОЛЬЦА
  186. --------------------------------------------------
  187.  
  188. local function createRing(position, startSize, endSize, duration)
  189.  
  190. local ring = Instance.new("Part")
  191.  
  192. ring.Name = "BossShockwave"
  193. ring.Shape = Enum.PartType.Cylinder
  194.  
  195. ring.Material = Enum.Material.Neon
  196.  
  197. ring.Size = Vector3.new(
  198. 0.3,
  199. startSize,
  200. startSize
  201. )
  202.  
  203. ring.Transparency = 0.15
  204.  
  205. ring.Anchored = true
  206. ring.CanCollide = false
  207. ring.CanTouch = false
  208. ring.CanQuery = false
  209.  
  210. ring.CFrame =
  211. CFrame.new(position)
  212. * CFrame.Angles(0, 0, math.rad(90))
  213.  
  214. ring.Parent = workspace
  215.  
  216. local tween = TweenService:Create(
  217. ring,
  218. TweenInfo.new(
  219. duration,
  220. Enum.EasingStyle.Quad,
  221. Enum.EasingDirection.Out
  222. ),
  223. {
  224. Size = Vector3.new(
  225. 0.3,
  226. endSize,
  227. endSize
  228. ),
  229.  
  230. Transparency = 1
  231. }
  232. )
  233.  
  234. tween:Play()
  235.  
  236. Debris:AddItem(ring, duration + 0.2)
  237.  
  238. end
  239.  
  240. --------------------------------------------------
  241. -- ЭФФЕКТ ВСПЫШКИ
  242. --------------------------------------------------
  243.  
  244. local function createExplosion(position, size)
  245.  
  246. local explosionPart = Instance.new("Part")
  247.  
  248. explosionPart.Name = "CaptainExplosion"
  249.  
  250. explosionPart.Shape = Enum.PartType.Ball
  251.  
  252. explosionPart.Material = Enum.Material.Neon
  253.  
  254. explosionPart.Size = Vector3.new(
  255. 1,
  256. 1,
  257. 1
  258. )
  259.  
  260. explosionPart.Transparency = 0.15
  261.  
  262. explosionPart.Anchored = true
  263.  
  264. explosionPart.CanCollide = false
  265. explosionPart.CanTouch = false
  266. explosionPart.CanQuery = false
  267.  
  268. explosionPart.CFrame = CFrame.new(position)
  269.  
  270. explosionPart.Parent = workspace
  271.  
  272. local tween = TweenService:Create(
  273. explosionPart,
  274. TweenInfo.new(
  275. 0.5,
  276. Enum.EasingStyle.Quad,
  277. Enum.EasingDirection.Out
  278. ),
  279. {
  280. Size = Vector3.new(
  281. size,
  282. size,
  283. size
  284. ),
  285.  
  286. Transparency = 1
  287. }
  288. )
  289.  
  290. tween:Play()
  291.  
  292. Debris:AddItem(explosionPart, 0.7)
  293.  
  294. end
  295.  
  296. --------------------------------------------------
  297. -- ЭФФЕКТ ПРОБУЖДЕНИЯ
  298. --------------------------------------------------
  299.  
  300. local function awakeningEffects()
  301.  
  302. -- Highlight
  303. local highlight = Instance.new("Highlight")
  304.  
  305. highlight.Name = "CaptainHighlight"
  306.  
  307. highlight.Adornee = boss
  308.  
  309. highlight.FillTransparency = 0.45
  310. highlight.OutlineTransparency = 0
  311.  
  312. highlight.Parent = boss
  313.  
  314. -- Начальное состояние
  315. highlight.FillColor = Color3.fromRGB(255, 0, 0)
  316. highlight.OutlineColor = Color3.fromRGB(255, 170, 0)
  317.  
  318. -- Свет
  319. local light = Instance.new("PointLight")
  320.  
  321. light.Name = "CaptainAura"
  322.  
  323. light.Color = Color3.fromRGB(255, 50, 0)
  324.  
  325. light.Brightness = 0
  326. light.Range = 8
  327.  
  328. light.Parent = rootPart
  329.  
  330. -- Постепенно включаем свет
  331. local lightTween = TweenService:Create(
  332. light,
  333. TweenInfo.new(
  334. 0.7,
  335. Enum.EasingStyle.Quad,
  336. Enum.EasingDirection.Out
  337. ),
  338. {
  339. Brightness = 12,
  340. Range = 25
  341. }
  342. )
  343.  
  344. lightTween:Play()
  345.  
  346. --------------------------------------------------
  347. -- КОЛЬЦА
  348. --------------------------------------------------
  349.  
  350. createRing(
  351. rootPart.Position - Vector3.new(0, 3, 0),
  352. 2,
  353. 18,
  354. 0.7
  355. )
  356.  
  357. task.wait(0.15)
  358.  
  359. createRing(
  360. rootPart.Position - Vector3.new(0, 3, 0),
  361. 3,
  362. 28,
  363. 0.8
  364. )
  365.  
  366. task.wait(0.15)
  367.  
  368. createRing(
  369. rootPart.Position - Vector3.new(0, 3, 0),
  370. 4,
  371. 40,
  372. 1
  373. )
  374.  
  375. --------------------------------------------------
  376. -- ВСПЫШКА
  377. --------------------------------------------------
  378.  
  379. createExplosion(
  380. rootPart.Position,
  381. 18
  382. )
  383.  
  384. --------------------------------------------------
  385. -- МАЛЕНЬКАЯ ПАУЗА
  386. --------------------------------------------------
  387.  
  388. task.wait(0.3)
  389.  
  390. --------------------------------------------------
  391. -- УВЕЛИЧЕНИЕ
  392. --------------------------------------------------
  393.  
  394. boss:ScaleTo(BOSS_SCALE)
  395.  
  396. --------------------------------------------------
  397. -- ЕЩЁ ОДНА ВСПЫШКА
  398. --------------------------------------------------
  399.  
  400. createExplosion(
  401. rootPart.Position,
  402. 28
  403. )
  404.  
  405. createRing(
  406. rootPart.Position - Vector3.new(0, 5, 0),
  407. 5,
  408. 50,
  409. 1
  410. )
  411.  
  412. --------------------------------------------------
  413. -- УСИЛИВАЕМ СВЕЧЕНИЕ
  414. --------------------------------------------------
  415.  
  416. light.Brightness = 20
  417. light.Range = 35
  418.  
  419. end
  420.  
  421. --------------------------------------------------
  422. -- ПРОБУЖДЕНИЕ БОССА
  423. --------------------------------------------------
  424.  
  425. local function awaken()
  426.  
  427. if awakened then
  428. return
  429. end
  430.  
  431. awakened = true
  432.  
  433. print("КАПИТАН ПИРАТОВ ПРОСНУЛСЯ!")
  434.  
  435. -- Поворачиваемся перед трансформацией
  436. lookAtPlayer()
  437.  
  438. task.wait(0.4)
  439.  
  440. awakeningEffects()
  441.  
  442. task.wait(1)
  443.  
  444. end
  445.  
  446. --------------------------------------------------
  447. -- УДАРНАЯ ВОЛНА
  448. --------------------------------------------------
  449.  
  450. local function createAttackWave()
  451.  
  452. local position =
  453. rootPart.Position
  454. + rootPart.CFrame.LookVector * 5
  455.  
  456. -- Центральная вспышка
  457. createExplosion(
  458. position,
  459. 12
  460. )
  461.  
  462. -- Большое кольцо
  463. createRing(
  464. rootPart.Position - Vector3.new(0, 5, 0),
  465. 3,
  466. SHOCKWAVE_RADIUS * 2,
  467. 0.45
  468. )
  469.  
  470. end
  471.  
  472. --------------------------------------------------
  473. -- НАНЕСЕНИЕ УРОНА
  474. --------------------------------------------------
  475.  
  476. local function dealDamage()
  477.  
  478. local player = playerValue.Value
  479.  
  480. if not player then
  481. return
  482. end
  483.  
  484. local character = player.Character
  485.  
  486. if not character then
  487. return
  488. end
  489.  
  490. local targetHumanoid =
  491. character:FindFirstChildOfClass("Humanoid")
  492.  
  493. local targetRoot =
  494. character:FindFirstChild("HumanoidRootPart")
  495.  
  496. if not targetHumanoid or not targetRoot then
  497. return
  498. end
  499.  
  500. if targetHumanoid.Health <= 0 then
  501. return
  502. end
  503.  
  504. local distance =
  505. (targetRoot.Position - rootPart.Position).Magnitude
  506.  
  507. if distance <= SHOCKWAVE_RADIUS then
  508.  
  509. targetHumanoid:TakeDamage(DAMAGE)
  510.  
  511. print(
  512. "Капитан нанёс",
  513. DAMAGE,
  514. "урона"
  515. )
  516.  
  517. end
  518.  
  519. end
  520.  
  521. --------------------------------------------------
  522. -- АТАКА
  523. --------------------------------------------------
  524.  
  525. local function attack()
  526.  
  527. if attacking then
  528. return
  529. end
  530.  
  531. attacking = true
  532.  
  533. --------------------------------------------------
  534. -- ПОВОРОТ
  535. --------------------------------------------------
  536.  
  537. lookAtPlayer()
  538.  
  539. task.wait(0.25)
  540.  
  541. --------------------------------------------------
  542. -- АНИМАЦИЯ
  543. --------------------------------------------------
  544.  
  545. if attackTrack then
  546. attackTrack:Play(
  547. 0.05,
  548. 1,
  549. 1.15
  550. )
  551. end
  552.  
  553. --------------------------------------------------
  554. -- ЭФФЕКТ ЗАРЯДА
  555. --------------------------------------------------
  556.  
  557. createExplosion(
  558. rootPart.Position,
  559. 10
  560. )
  561.  
  562. --------------------------------------------------
  563. -- ЖДЁМ МОМЕНТ УДАРА
  564. --------------------------------------------------
  565.  
  566. task.wait(HIT_DELAY)
  567.  
  568. --------------------------------------------------
  569. -- УДАР
  570. --------------------------------------------------
  571.  
  572. createAttackWave()
  573.  
  574. dealDamage()
  575.  
  576. --------------------------------------------------
  577. -- ЖДЁМ ОКОНЧАНИЕ
  578. --------------------------------------------------
  579.  
  580. if attackTrack then
  581.  
  582. local length = attackTrack.Length
  583.  
  584. if length > 0 then
  585. task.wait(
  586. math.max(
  587. length - HIT_DELAY,
  588. 0
  589. )
  590. )
  591. else
  592. task.wait(0.5)
  593. end
  594.  
  595. else
  596.  
  597. task.wait(0.5)
  598.  
  599. end
  600.  
  601. attacking = false
  602.  
  603. end
  604.  
  605. --------------------------------------------------
  606. -- ОСНОВНОЙ ЦИКЛ
  607. --------------------------------------------------
  608.  
  609. while boss.Parent do
  610.  
  611. if humanoid.Health <= 0 then
  612. break
  613. end
  614.  
  615. local player = playerValue.Value
  616.  
  617. if not player then
  618. task.wait(0.3)
  619. continue
  620. end
  621.  
  622. local character = player.Character
  623.  
  624. if not character then
  625. task.wait(0.3)
  626. continue
  627. end
  628.  
  629. local targetHumanoid =
  630. character:FindFirstChildOfClass("Humanoid")
  631.  
  632. local targetRoot =
  633. character:FindFirstChild("HumanoidRootPart")
  634.  
  635. if not targetHumanoid or not targetRoot then
  636. task.wait(0.3)
  637. continue
  638. end
  639.  
  640. if targetHumanoid.Health <= 0 then
  641. task.wait(0.3)
  642. continue
  643. end
  644.  
  645. local distance =
  646. (targetRoot.Position - rootPart.Position).Magnitude
  647.  
  648. --------------------------------------------------
  649. -- ИГРОК ПОДОШЁЛ
  650. --------------------------------------------------
  651.  
  652. if not awakened then
  653.  
  654. if distance <= ACTIVATION_DISTANCE then
  655. awaken()
  656. end
  657.  
  658. task.wait(0.15)
  659. continue
  660.  
  661. end
  662.  
  663. --------------------------------------------------
  664. -- БОСС ПРОБУЖДЁН
  665. --------------------------------------------------
  666.  
  667. lookAtPlayer()
  668.  
  669. --------------------------------------------------
  670. -- АТАКА
  671. --------------------------------------------------
  672.  
  673. if distance <= ATTACK_DISTANCE then
  674.  
  675. attack()
  676.  
  677. task.wait(ATTACK_COOLDOWN)
  678.  
  679. else
  680.  
  681. -- Игрок отошёл.
  682. -- Капитан продолжает смотреть на него,
  683. -- но не преследует.
  684.  
  685. task.wait(0.2)
  686.  
  687. end
  688.  
  689. end
  690.  
Advertisement
Comments
  • User was banned
Add Comment
Please, Sign In to add comment