Solved Loop Variable

  • 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.

Yaşarhan

Active Member
May 16, 2020
87
6
8
23
Turkey Istanbul
Welcome, I hope you are fine.
After a while, I started writing skript again.

Here is what I am having trouble with:
I can't give drops to loop variable.
No error and part attacker is working.

Where I sample for this code, works smoothly:

Code:
loop {party.%{Ownerofparty.%player%}%.list::*}:
            send "&4&l[SYSTEM] Ok message." to loop-variable

The code I'm having trouble:

Code:
if victim is slime:
                if display name of slime is "&4&lDEV PATOJEN":
               
                    chance of 100%:
                        add 50 of cooked fish named "&6&lAkçe" to {_drops::*}
                    chance of 10%:
                        add 1 fire charge named "&a&lKadife Çiçeği" with lore "&6Üretim materyali." to {_drops::*}
                   
                    if {Ownerofparty.%attacker%} is set:
                        loop {party.%{Ownerofparty.%attacker%}%.list::*}:
                            add {_drops::*} to loop-variable inventory
                        loop {_drops::*}:
                            if loop-value is "<none>":
                                stop
                            else:
                                play sound "ENTITY_ITEMFRAME_BREAK" with volume 100 and pitch 1 at loop-variable for loop-variable
                                if loop-value is cooked fish named "&6&lAkçe":
                                    play sound "BLOCK_PISTON_CONTRACT" with volume 100 and pitch 1.5 at loop-variable for loop-variable
                        loop {party.%{Ownerofparty.%attacker%}%.list::*}:
                            if loop-variable group is "RedPlusOyuncu" or "BluePlusOyuncu" or "redplusdayi" or "blueplusdayi":
                                make console execute command "/xp 60 %loop-variable%"
                            else:
                                make console execute command "/xp 30 %loop-variable%"
                    else:
                        add {_drops::*} to attacker's inventory
                        loop {_drops::*}:
                            if loop-value is "<none>":
                                stop
                            else:
                                play sound "ENTITY_ITEMFRAME_BREAK" with volume 100 and pitch 1 at attacker for attacker
                                if loop-value is cooked fish named "&6&lAkçe":
                                    play sound "BLOCK_PISTON_CONTRACT" with volume 100 and pitch 1.5 at attacker for attacker
                        if attacker's group is "RedPlusOyuncu" or "BluePlusOyuncu" or "redplusdayi" or "blueplusdayi":
                            make console execute command "/xp 60 %attacker%"
                        else:
                            make console execute command "/xp 30 %attacker%"
 
What about this?
Code:
send "&4&l[SYSTEM] Ok message." to {party.%{Ownerofparty.%player%}%.list::%loop-index%}
[doublepost=1602691952,1602691812][/doublepost]So it would be:
Code:
add {_drops::*} to inventory of {party.%{Ownerofparty.%attacker%}%.list::%loop-index%}
 
What about this?
Code:
send "&4&l[SYSTEM] Ok message." to {party.%{Ownerofparty.%player%}%.list::%loop-index%}
[doublepost=1602691952,1602691812][/doublepost]So it would be:
Code:
add {_drops::*} to inventory of {party.%{Ownerofparty.%attacker%}%.list::%loop-index%}

The code was shortened but unfortunately it didn't work. :emoji_neutral_face:
[doublepost=1603200415][/doublepost]Anyone else interested, thanks.
 
Status
Not open for further replies.