Hello. I've been trying to make custom armor with cool "special abilities", however, I've ran into an issue with the cooldown I'm trying to implement, below is my code:
Code:
on sneak toggle:
if player is sneaking:
if custom model data of player's boots is 5001:
if {cooldown.%player%} is not set or {cooldown.%player%} < now:
push player upwards at velocity 2
set {noFallDamage.%player%} to true
set {hasLaunched.%player%} to true
# Set cooldown
set {cooldown.%player%} to now + 10 seconds
else:
send "&cYou must wait before using this ability again!" to player
on damage of player:
if {noFallDamage.%victim%} is set:
if damage cause is fall:
cancel event
if {hasLaunched.%victim%} is set:
delete {hasLaunched.%victim%}
apply swiftness 2 to victim for 10 seconds
apply regeneration 2 to victim for 10 seconds
loop all entities in radius 10 around victim:
if loop-entity is a mob:
strike lightning effect at loop-entity
set {_dx} to x-coordinate of loop-entity - x-coordinate of victim
set {_dz} to z-coordinate of loop-entity - z-coordinate of victim
set {_vector} to vector {_dx}, 0.5, {_dz}
set {_vector} to {_vector} * 2
set velocity of loop-entity to {_vector}