leap wand
this command gives out a stick that launches you forward when you right click with it
@Katton.command(name = "leapwand", permission = "admin")
function giveLeapWand(sender, args) {
val wand = Katton.item("stick")
wand.setName("&aLeap Wand")
wand.setTag("ability", "leap_wand")
sender.give(wand)
}
@Katton.listen("player_rightclick")
function onLeap(event) {
val item = event.item
if (item != null && item.getTag("ability") == "leap_wand") {
event.player.launchForward(horizontal = 1.8, vertical = 0.65)
event.player.sendMessage("whoosh")
event.cancel()
}
}
try it yourself
make a script called leapwand.sk and then export the token, then do:
/katton import
/katton run leapwand
now when you right click while holding that wand it should launch you forward
things to try changing
- change
permission = "admin"to"all"so anyone can get a wand - add a cooldown using Katton.vars so it can't be spammed:
var onCooldown = {} // a map of player uuid -> true while on cooldown
@Katton.listen("player_rightclick")
function onLeap(event) {
val item = event.item
if (item == null || item.getTag("ability") != "leap_wand") {
return
}
val uuid = event.player.uuid
if (onCooldown.containsKey(uuid)) {
event.player.sendMessage("&cstill on cooldown!")
event.cancel()
return
}
event.player.launchForward(horizontal = 1.8, vertical = 0.65)
event.cancel()
onCooldown.set(uuid, true)
Katton.after(3.seconds) {
onCooldown.remove(uuid)
}
}