#skript not working

1 messages · Page 1 of 1 (latest)

hushed current
#
    set the helmet of entity to diamond helmet
    set the chestplate of entity to iron chestplate
    set the leggings of entity to iron leggings
    set the boots of entity to diamond boots
    set tool of entity to iron sword
    apply speed 2 to the entity for 9999 minutes

    # Initialize variables to track the nearest player
    set {_nearestPlayer} to null
    set {_shortestDistance} to 9999

    # Loop through all players on the server
    loop all players:
        if distance between loop-player and entity is less than 20:
            set {_distance} to distance between loop-player and entity
            if {_distance} < {_shortestDistance}:
                set {_shortestDistance} to {_distance}
                set {_nearestPlayer} to loop-player

    # If a nearest player was found, make the pigman target that player
    if {_nearestPlayer} is set:
        set target of zombie pigman to {_nearestPlayer}
    
    wait 60 seconds
    kill entity```

this was working in 1.8.8 but now it's not in 1.11.2
When a zombie pigman spawns, the skript isn't activating
The skript is enabled and doesn't give any errors

It says current item: null on line relating to diamond helmet
#

disabled all the addons and now it says Line 11:
Can't understand this expression: 'null'
Line: set {_nearestPlayer} to null

frigid owl
#

Why are you setting it to null? Why not leave it not set

#

You can also use an undefined local var like {_null}

hushed current
#

That worked

hushed current
#
    line 1 of the clicked block is "[Rob]" 
    line 4 of the clicked block is "Store 1":
        if now >= {cooldown::%player's uuid%} ? now:
            set {cooldown::%player's uuid%} to 15 minutes later
            # Give the player a random amount of money between 100 and 500 using Vault
            set {_money} to a random integer between 100 and 500
            execute console command "eco give %player% %{_money}%"
    
            # Send a message to the player confirming the amount of money received
            send "&aYou robbed the store and got %{_money}% money!" to player
    
            # Spawn 3 Zombie Pigmen at the player's location
            loop 3 times:
                spawn a zombie pigman at location of player
    
            # Optional: Broadcast a message to the server that the player robbed the store
            broadcast "&c%player% just robbed Store 1!"
        else: 
            send "&cThis sign is on a 15m cooldown!"```

So now I need help adding the remaining time left on the cooldown in the final portion at the Send part
frigid owl
#

you can use the difference between time1 and time2 expression to get how long they need to wait

#

also, try just add x to player's balance, no need for a console command

honest cradle
hushed current
#

Woot it's working and I was able to copy-paste it to add another version and separate their cooldowns

honest cradle
#

The only thing I’ve seen that is “set variable to null” is from ai I’m not assuming i was just letting x8 know that it could be

hearty veldt
#

ntm that many code comments

#

mf # Optional: Broadcast a message to the server that the player robbed the store