#not able to remove the item

1 messages · Page 1 of 1 (latest)

worthy marsh
#

why does the item not remove?

    if attacker is not a player:
        stop
    if victim is not a player:
        stop
    
    set {_n} to name of held item of attacker
    if {_n} is name of {replace}:
        if victim has {Hyperion}:
            if {cooldown::staticGeme::ability::%uuid of attacker%} is set:
                stop
            
            remove 1 of {Hyperion} from victim
            set {cooldown::staticGeme::ability::%uuid of attacker%} to 120
            send "%nl%&aUsed Hyperion Remover!%nl%" to attacker
            send "%nl%&7%attacker% has removed your hyperion for 2 minutes!%nl%" to victim
            wait 120 seconds
            give 1 of {Hyperion} to victim
        
        
            loop 120 times:
                wait 1 seconds
                remove 1 from {cooldown::staticGeme::ability::%uuid of attacker%}
                if {cooldown::staticGeme::ability::%uuid of attacker%} <= 0:
                    delete {cooldown::staticGeme::ability::%uuid of attacker%}```
hollow sluice
#
  1. you cant stop a event, you can do stop a command
  2. just do on damage of player: if attacker is a player: instead of checking both like that
#

Have you tried debugging to see which line doesnt go through?

#

@worthy marsh

worthy marsh
#

every line happens except that one

hollow sluice
#

maybe its remove 1 of {Hyperion} from victim's inventory

hollow sluice
#

no problem

teal geyser
#

you can indeed use stop in an event, it prevents the rest of the code from running

#

also, use on death of player:

hollow sluice
frozen nimbus
#

think about it:
stop just stops the currently running event/structure/executable from continuing its code
because both a command and event are structures, you can use stop in them (you can use stop anywhere)
cancel event cancels an event from occurring (its in the name)
because a command is not an event, cancel event will not work in a command since there is nothing to cancel

teal geyser
#
  cancel event
  send “chat is disabled” to player```the cancel event stops the message, but still allows the code to run
#

The stop will terminate code

hollow sluice
#

Makes sense