Files
magma-gem.sk
Code
1 57
magma-gem.sk
# Magma Gem Projectile
# Requires Skript 2.15.4
# Compatible with SkBee 3.25.2 and Skript-Reflect 2.6.3
#
# Place this file in plugins/Skript/scripts/
# Reload with: /sk reload magma-gem
options:
projectile-speed: 1.35
projectile-lifetime: 40
hit-radius: 1.25
slowness-duration: 3 seconds
on right click:
if event-item is magma block:
if name of event-item is "&#CF0000ᴍ&#C50000ᴀ&#BA0000ɢ&#B00000ᴍ&#A60000ᴀ 󞊰ɢ󑽠ᴇC0000ᴍ":
cancel event
set {_start} to eye location of player
set {_direction} to vector from yaw (yaw of player) and pitch (pitch of player)
set standard length of {_direction} to {@projectile-speed}
spawn an armor stand at {_start}
set {_projectile} to last spawned entity
set helmet of {_projectile} to magma block
set invisible of {_projectile} to true
set gravity of {_projectile} to false
set velocity of {_projectile} to {_direction}
loop {@projectile-lifetime} times:
wait 1 tick
if {_projectile} is not alive:
stop
set {_location} to location of {_projectile}
set velocity of {_projectile} to {_direction}
set yaw of {_projectile} to (yaw of {_projectile} + 35)
set pitch of {_projectile} to (pitch of {_projectile} + 20)
set {_hit} to false
loop all players in radius {@hit-radius} around {_location}:
if loop-player is not player:
apply slowness 2 to loop-player for {@slowness-duration}
set {_hit} to true
stop loop
if {_hit} is true:
kill {_projectile}
stop
if block at {_location} is solid:
kill {_projectile}
stop
if {_projectile} is alive:
kill {_projectile}