Overriding Events on other Skripts

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the community!

    Now, what are you waiting for? Join the community now!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Status
Not open for further replies.

Bjwpokemon

Member
Sep 11, 2020
2
0
0
Hello, this is my first post so sorry if I forget to include something.

Into my actual question. I have just started learning Skript to help a friend make custom items for a private Minecraft server. We are in the process of making an item ("Bad Time") that when held in inventory will change all damage taken by the holder and all damage dealt by the holder to 1. Currently we have the following code:

Code:
on damage:
    set {BadTime} to 0
    loop all items in the inventory of attacker:
        if "custom" tag of nbt of loop-item is 92:
            set {BadTime} to 1
    loop all items in the inventory of victim:
        if "custom" tag of nbt of loop-item is 92:
            set {BadTime} to 1
    if {BadTime} is 1:
        set damage to 1

The program works perfectly when it comes to vanilla items, however, gets weird when we tested on our own custom items. The event triggers and damage calculators of our other custom items seemed to override the effect of the "Bad Time" item. For reference, here is an item whose damage trigger overrode "Bad Time" and did full damage rather than 1:

Code:
on join:
    set {MarksmanBowAmplifier::%player%} to 0
    set {MarksmanBowReady::%player%} to 0

on right click:
    if "custom" tag of nbt of player's held item is 90:
        set {MarksmanBowActive::%player%} to 1
        set {MarksmanBowAmplifier::%player%} to 1
        set {MarksmanBowReady::%player%} to 1
        while {MarksmanBowActive::%player%} is 1:
            if {MarksmanBowAmplifier::%player%} is less than 4:
                add 1 to {MarksmanBowAmplifier::%player%}
                send "&4Charging..." to player
            else:
                send "&a&lCharged!" to player
                set {MarksmanBowActive::%player%} to 0
            wait 1 second

on shoot:
    if "custom" tag of nbt of shooter's held item is 90:
        if {MarksmanBowReady::%shooter%} is 1:
            cancel event
            set {MarksmanBowReady::%shooter%} to 0
            make shooter shoot arrow at speed {MarksmanBowAmplifier::%shooter%} * 2
        else:
            set {MarksmanBowActive::%shooter%} to 0
            set metadata value "tagName" of projectile to 90
            set metadata value "damage" of projectile to {MarksmanBowAmplifier::%shooter%}

on damage:
    if projectile exists:
        if projectile is arrow:
            if metadata value "tagName" of projectile is 90:
                set {MarksmanBowTemp::%attacker%} to metadata value "damage" of projectile * 2
                increase damage by {MarksmanBowTemp::%attacker%}

Ideally, we would like "Bad Time" item to override the other items instead and change their damage to 1 no matter what. I was wondering if there was a way to achieve this without the creation of a global variable (as we would have to modify the skripts of our other items). Thank you.
 
Status
Not open for further replies.