Can someone help me with this?

  • 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 comminuty!

    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.
Mar 29, 2020
28
0
1
29
I'm trying to lift an item from the ground to change its lore.
The same thing I tried with the item in hand using "player's tool" and it works perfect, but the other change the lone in "{_item1}" does not work. It is the same code, I do not understand it.

it does not work:
Code:
on pickup:
    if player is online:
        set {_item1} to item   
        set {_pick::*} to lore of {_item1}       
        loop {_pick::*}:                       
            if loop-value contains "&fCrit chance: &9-":           
                chance of 100%:           
                    replace every "&fCrit chance: &9-" in lore of {_item1} with "&fCrit chance: &93"
                    stop                                       
                chance of 15%:           
                    replace every "&fCrit chance: &9-" in lore of item with "&fCrit chance: &99"
                    stop

Works:

Code:
on rightclick:
    if player is holding a sword or axe,shovel,wooden pickaxe,hoe,bow,trident:   
        set {_l2::*} to lore of player's tool
        loop {_l2::*}:                       
            if loop-value contains "&fCrit chance: &9-":           
                chance of 80%:           
                    replace every "&fCrit chance: &9-" in lore of tool of player with "&fCrit chance: &93"
                    stop                                       
                chance of 15%:           
                    replace every "&fCrit chance: &9-" in lore of tool of player with "&fCrit chance: &9-"
                    stop
 
Eu inverti as chances, caso contrário, seria sempre 100%
Mas parece funcionar corretamente
 

Attachments

  • pickup.sk
    365 bytes · Views: 160
Eu inverti as chances, caso contrário, seria sempre 100%
Mas parece funcionar corretamente
I don't understand a thing and therefor used DeepL for translation, and it might not be right: "I inverted the odds, otherwise it would always be 100% But it seems to work correctly"

try this:
Code:
on pickup:                   
  if lore of event-item contains "&fCrit chance: &9-":         
    chance of 85%:
      replace every "&fCrit chance: &9-" in lore of event-item with "&fCrit chance: &93"                               
    chance of 15%:   
      replace every "&fCrit chance: &9-" in lore of event-item with "&fCrit chance: &99"
 
Status
Not open for further replies.