Can someone help me with this! I want to make my netherite sword charge by swap the sword to offhand, when it is done charging, it switch back to mainhand, which is charge false. And with some particle and effect. Idk why, it's not working.
on swap hand item:
if event-player's offhand tool is a netherite sword:
set {netherite_sword::charging} to true
if {netherite_sword::charging} is true:
wait 1 second
add 1 to {netherite_sword::charge-level}
wait 1 second
add 1 to {netherite_sword::charge-level}
wait 1 second
add 1 to {netherite_sword::charge-level}
wait 1 second
add 1 to {netherite_sword::charge-level}
set {netherite_sword::charge-level} to 0
if {netherite_sword::charge-level} is 1:
make console execute "/execute at %player% run particle flame ~ ~ ~ 1 0 1 0 50"
apply slowness potion of tier 255 without particles to player for 4 seconds
else if {netherite_sword::charge-level} is 2:
make console execute "/execute at %player% run particle landing_lava ~ ~ ~ 1.5 0 1.5 0 100"
else if {netherite_sword::charge-level} is 3:
make console execute "/execute at %player% run particle falling_obsidian_tear ~ ~ ~ 2 0 2 0 150"
else if {netherite_sword::charge-level} is 4:
make console execute "/execute at %player% run particle lava ~ ~ ~ 3 0 3 0 200"
set {netherite_sword::charging} to false
if {netherite_sword::charging} is false:
set {netherite_sword::charge-level} to 0
set event-player's tool to player's slot 1
# Full charge attack
play sound "entity.blaze.shoot" at player
if entities are within 8 blocks around event-player:
apply slowness potion of tier 255 without particles to the entities for 2 seconds
apply weakness potion of tier 2 without particles to the entities for 5 seconds
on damage of player:
set {netherite_sword::charging} to false
cancel event
on sneak toggle:
if player is sneaking:
set {netherite_sword::charging} to false
on damage:
if attacker is holding netherite sword:
set {_p} to attacker
set {_OD} to {_p}'s damage
if {netherite_sword::charge-level} is 1:
increase {_p}'s damage by 4
if {netherite_sword::charge-level} is 2:
increase {_p}'s damage by 8
if {netherite_sword::charge-level} is 3:
increase {_p}'s damage by 12
if {netherite_sword::charge-level} is 4:
increase {_p}'s damage by 16
apply strength potion of tier 3 without particles to attacker for 10 seconds
wait 5 seconds
set {_p}'s damage to {_OD}
on swap hand item:
if event-player's offhand tool is a netherite sword:
set {netherite_sword::charging} to true
if {netherite_sword::charging} is true:
wait 1 second
add 1 to {netherite_sword::charge-level}
wait 1 second
add 1 to {netherite_sword::charge-level}
wait 1 second
add 1 to {netherite_sword::charge-level}
wait 1 second
add 1 to {netherite_sword::charge-level}
set {netherite_sword::charge-level} to 0
if {netherite_sword::charge-level} is 1:
make console execute "/execute at %player% run particle flame ~ ~ ~ 1 0 1 0 50"
apply slowness potion of tier 255 without particles to player for 4 seconds
else if {netherite_sword::charge-level} is 2:
make console execute "/execute at %player% run particle landing_lava ~ ~ ~ 1.5 0 1.5 0 100"
else if {netherite_sword::charge-level} is 3:
make console execute "/execute at %player% run particle falling_obsidian_tear ~ ~ ~ 2 0 2 0 150"
else if {netherite_sword::charge-level} is 4:
make console execute "/execute at %player% run particle lava ~ ~ ~ 3 0 3 0 200"
set {netherite_sword::charging} to false
if {netherite_sword::charging} is false:
set {netherite_sword::charge-level} to 0
set event-player's tool to player's slot 1
# Full charge attack
play sound "entity.blaze.shoot" at player
if entities are within 8 blocks around event-player:
apply slowness potion of tier 255 without particles to the entities for 2 seconds
apply weakness potion of tier 2 without particles to the entities for 5 seconds
on damage of player:
set {netherite_sword::charging} to false
cancel event
on sneak toggle:
if player is sneaking:
set {netherite_sword::charging} to false
on damage:
if attacker is holding netherite sword:
set {_p} to attacker
set {_OD} to {_p}'s damage
if {netherite_sword::charge-level} is 1:
increase {_p}'s damage by 4
if {netherite_sword::charge-level} is 2:
increase {_p}'s damage by 8
if {netherite_sword::charge-level} is 3:
increase {_p}'s damage by 12
if {netherite_sword::charge-level} is 4:
increase {_p}'s damage by 16
apply strength potion of tier 3 without particles to attacker for 10 seconds
wait 5 seconds
set {_p}'s damage to {_OD}