Files
src
build.gradle
tidebreaker_cutlass.sk
Code
4 277
tidebreaker_cutlass.sk
# Tidebreaker Cutlass - Grappling Hook Ability
# Place this file in plugins/Skript/scripts/
# Configuration
variables:
{tidebreaker.cooldown} = 20 # Cooldown in seconds
# Check if player is holding the Tidebreaker Cutlass
function isTidebreakerCutlass(item: item) :: boolean:
if name of {_item} is "&b&lTidebreaker Cutlass":
return true
return false
# Give command for the Tidebreaker Cutlass
command /givetidebreaker [<player>]:
permission: tidebreaker.give
trigger:
if arg-1 is set:
set {_target} to arg-1
else:
set {_target} to player
set {_cutlass} to diamond sword named "&b&lTidebreaker Cutlass"
set line 1 of lore of {_cutlass} to "&7Right-click to fire a grappling hook!"
set line 2 of lore of {_cutlass} to "&7Pull yourself to enemies or blocks."
set line 3 of lore of {_cutlass} to ""
set line 4 of lore of {_cutlass} to "&9&lLEGENDARY WEAPON"
give {_cutlass} to {_target}
send "&b&lTidebreaker Cutlass &7has been given to &f%{_target}%!" to player
# Right-click detection
on right click:
if player's tool is a sword:
if isTidebreakerCutlass(player's tool) is true:
# Check cooldown
if {tidebreaker.cooldown.%player%} is set:
set {_timeLeft} to difference between {tidebreaker.cooldown.%player%} and now
if {_timeLeft} is less than {tidebreaker.cooldown} seconds:
set {_remaining} to {tidebreaker.cooldown} - ({_timeLeft} / 1 second)
send action bar "&c&lCOOLDOWN: &f%.2f {_remaining}%s" to player
play sound "block.note_block.bass" with volume 0.5 and pitch 0.5 to player
stop
cancel event
# Launch trident projectile
shoot a trident from player at speed 2
set {tidebreaker.projectile.%last shot projectile%} to player
# Sound effects - Trident throw
play sound "item.trident.throw" with volume 1 and pitch 1.2 at player
play sound "entity.player.splash" with volume 0.8 and pitch 0.8 at player
# Visual effect at launch
show 15 of splash at location 1 meter above player
show 10 of water_drop at location 1 meter above player
send action bar "&b&l⚓ Grappling Hook Fired!" to player
# Set cooldown
set {tidebreaker.cooldown.%player%} to now
# Projectile hit detection - Entity
on projectile hit:
event-entity is a trident
if {tidebreaker.projectile.%event-projectile%} is set:
set {_shooter} to {tidebreaker.projectile.%event-projectile%}
set {_victim} to victim
# Check if hit an entity and shooter is still online
if {_victim} is set:
if {_shooter} is online:
# Sound effects
play sound "item.trident.hit" with volume 1 and pitch 1 at {_victim}
play sound "entity.fishing_bobber.retrieve" with volume 1 and pitch 0.8 at {_shooter}
# Particle effects at hit location
show 20 of crit at {_victim}
show 30 of water_splash at {_victim}
show 10 of bubble_pop at {_victim}
# Calculate pull direction
set {_target} to location of {_victim}
set {_source} to location of {_shooter}
set {_distance} to distance between {_source} and {_target}
# Pull player towards the entity
if {_distance} > 1:
# Calculate velocity vector
set {_x} to x-coordinate of {_target} - x-coordinate of {_source}
set {_y} to (y-coordinate of {_target} + 1) - y-coordinate of {_source}
set {_z} to z-coordinate of {_target} - z-coordinate of {_source}
# Normalize and scale
set {_magnitude} to sqrt(({_x} * {_x}) + ({_y} * {_y}) + ({_z} * {_z}))
set {_scale} to 1.5 # Pull strength
set {_vx} to ({_x} / {_magnitude}) * {_scale}
set {_vy} to ({_y} / {_magnitude}) * {_scale}
set {_vz} to ({_z} / {_magnitude}) * {_scale}
push {_shooter} with velocity vector {_vx}, {_vy}, {_vz}
# Trail effect during pull
loop 10 times:
wait 1 tick
show 3 of dolphin at {_shooter}
show 2 of drip_water at {_shooter}
# Success sound and particles
wait 10 ticks
play sound "entity.player.splash.high_speed" with volume 1 and pitch 1.2 at {_shooter}
show 25 of splash at {_shooter}
send action bar "&b&l⚓ HOOKED! &fPulled to enemy!" to {_shooter}
# Clean up
delete {tidebreaker.projectile.%event-projectile%}
# Projectile hit detection - Block
on projectile hit:
event-entity is a trident
if {tidebreaker.projectile.%event-projectile%} is set:
set {_shooter} to {tidebreaker.projectile.%event-projectile%}
set {_block} to event-block
# Check if hit a block and shooter is still online
if {_block} is set:
if {_shooter} is online:
# Sound effects
play sound "item.trident.hit_ground" with volume 1 and pitch 1 at event-location
play sound "entity.fishing_bobber.retrieve" with volume 1 and pitch 0.5 at {_shooter}
# Particle effects at hit location
show 25 of block_crack using {_block} at event-location
show 15 of water_splash at event-location
# Calculate propel direction
set {_target} to event-location
set {_source} to location of {_shooter}
set {_distance} to distance between {_source} and {_target}
# Propel player towards the block
if {_distance} > 2:
# Calculate velocity vector
set {_x} to x-coordinate of {_target} - x-coordinate of {_source}
set {_y} to (y-coordinate of {_target} + 0.5) - y-coordinate of {_source}
set {_z} to z-coordinate of {_target} - z-coordinate of {_source}
# Normalize and scale
set {_magnitude} to sqrt(({_x} * {_x}) + ({_y} * {_y}) + ({_z} * {_z}))
set {_scale} to 1.8 # Propel strength
set {_vx} to ({_x} / {_magnitude}) * {_scale}
set {_vy} to ({_y} / {_magnitude}) * {_scale}
set {_vz} to ({_z} / {_magnitude}) * {_scale}
push {_shooter} with velocity vector {_vx}, {_vy}, {_vz}
# Trail effect during propel
loop 15 times:
wait 1 tick
show 3 of cloud at {_shooter}
show 2 of drip_water at {_shooter}
# Success sound
wait 12 ticks
play sound "entity.player.attack.sweep" with volume 0.8 and pitch 1.5 at {_shooter}
show 20 of sweep_attack at {_shooter}
send action bar "&b&l⚓ GRAPPLED! &fPropelled forward!" to {_shooter}
# Clean up
delete {tidebreaker.projectile.%event-projectile%}
# Clean up projectiles that despawn or miss
every 1 second:
loop {tidebreaker.projectile::*}:
if loop-value is offline:
delete {tidebreaker.projectile::%loop-index%}