#how do I make a player spawn with a item?
1 messages · Page 2 of 1
hm?
the structure is irrelevant to the variable
a variable is a variable, no matter where its defined or used
unless its local and used somewhere else, then its nothing
local only exists under that trigger, like on something: or command something: or function something():
Damn... is this the longest thread in this discord
This should have ended at 10 messages tops or never be created tho
i don;t disagree
idk man if you total all the other threads with this one, you might make it
@modest plume please you are just not meant for skript, please leave this server and come back when u are actually older and can understand difficult stuff
otherwise quit your dream you wont make it anywhere
Over 1000 Messages we made it!
if player's had {red} in inventory:
cancel drop
give player 1 of {red}```
this doesn't work
idk how to check if {red} is in the player's inventory
nor do I know how to cancel the drop of {red} on death
hmm
didnt listen again
you really need to realise the potential of the docs
its like bringing a gun to a knife fight, its almost guaranteed to help you
and apparently youre not using a list for the wool now, and i said you had to "give it back on respawn", its impossible to give a dead player items
yes i did
well then you have everything you need
but I can't find it
literally the first result
bruh
you need to learn how to use the docs self-sufficently otherwise youll get nowhere on your own
well I was searching up inventory
that wasnt the only keyword i suggested
oh
if event-player has {red} in their inventory:
cancel drop```
Error on
Line 136
Goto Line
Can't understand this condition/effect: cancel drop
cancel drop
how do I cancel the drop of the item
because thats not the correct syntax
for "drops"
ok'
oh
if event-player has {red} in their inventory:
remove {red} from the drops```
I did it
no errors
great
this way you can stop all from being dropped at once
using a list (group of stuff), you can check for all the wool at once, or remove them all from loot
instead of doing each one individually
also recommend on death of player
what?
you can stop them all at once
yes, by using a list
if event-player has {list::*} in their inventory:
remove {list::*} from the drops```
like this?
not exactly.
oh
i always use an alternate syntax, player's inventory contains x as its shorter and more concise
oh ok
but would this work the way I want it to
no, because when you check for the whole list the condition wont pass unless the player's inv contains all the stuff in the list
you could loop through the list, or just remove the condition and clear the list from the drops
if they arent there it wont do anything
oh ok
I think ill clear the list from the drops and remove the condition
remove {list::*} from the drops```
what about the on respawn
what about it
how do I give the player there wool back on respawn
with the give effect. if you want to give them the same type that they had before, you should keep track of that on death
their
how do I keep track of it on death
well, lets loop through the list. loops are a good tool to know how to use
how do I loop through the list
when you loop, loop-index will be that instance's index, and loop-value will be that value, the wool
loop {x::*}:
loop-number is an expression for that in loop n times, but we arent using that. you could increase a local variable each instance, but that's not needed
we can use these instead
oh ok
so how does looping through the list keep track of it on death?
well, when you loop through, you can check if they posses each item individually
and can then keep track of it if they do
you can either stop at only one, or return multiple if you wanted
ok
you forgot a colon and indent for the loop line. looping opens up a new section
the stuff you do inside the loop is another section
give loop-player 1 of diamond```
but what are we gonna do inside the loop?
.
.
how do we do that inside the loop
do you remeber how to check if an inventory contains something?
well, thats what we're tying to do, no?
but we can only check one of the wools
which mean we would have to do a bunch more else ifs
no, we can loop it
for the other wools
how do we loop it
loop {list::*}
if event-player has {list::*} in their inventory:```
.
^^^
what do I put inside the loop tho
you want to check for loop-value, not the list
am so confused
.
Bro do you guys want to reach 2000 Messages
am confused about this loop thing
it might just happen :/
this is why i said you werent ready yet
1136 Messages
ok after we loop the list what do we do inside the list
how the hell do i do that
ive given you all the peices, please try to see how they fit together
I can't solve the puzzle
.
like this?
loop {list::*}:
if event-player has {blue} in their inventory:
if event-player has {red} in their inventory:
if event-player has {lime} in their inventory:
if event-player has {purple} in their inventory:
if event-player has {white} in their inventory:```
else if
no
this way you dont need more than 1 condition, the loop already goes through multiple times
and you're not even checking for the variables in the list, just variables each loop
can you give me a example?
if player's inventory contains loop-value:
broadcast "%player% has a(n) %loop-index% sword!"```
hint: you should not have dismissed the cache of info here
what is loop value
ive referenced this many times
i know you already said this but am still confused
remeber here, we defined indexes to make life easier.
index is the ting after ::
{list::INDEX} = VALUE
#loop all custom swords
if player's inventory contains loop-value:
#if the player's inv has the custom sword for this iteration
broadcast "%player% has a(n) %loop-index% sword!"
#we kept track of the name in the index so we can say "emerald sword" and such```
the index is just *
the asterisk is a thing that just means "everything"
yknow what
imma copy paste this into the parser for colour coding
maybe that will help
yeah that does not help
i can only explain, i cant make you understand
ik
loop {list::*}:
if player's inventory contains loop-value:
give player 1 of loop-value``` like this?
you've improved the loop, but went backwards everywhere else.
if they already have the item on respawn, why do we need to give them another?
and i would give the list a name other than list
they don't have the item on respawn tho
you should be doing this when a player dies, not when they respawn
.
you need to keep track of the item, then, when you can give it to them, give it
Hello. . What is the issue, there's too much text to look through ;-;
hey
oh were trying to make it so the player keeps the items on death
remove {list::*} from the drops
loop {list::*}:
if player's inventory contains loop-value:
give player 1 of loop-value
on respawn:```
set {blue} to light blue wool named "Water Wool" with lore "this is water wool" and "idk"
set {white} to white wool named "Feather Wool" with lore "light as a feather" and "like a chicken"
set {purple} to purple wool named "Space Wool" with lore "came from space?" and "maybe?"
set {lime} to lime wool named "Earth Wool" with lore "its made out of rock" and "wait but its wool"
set {list::*} to {red}, {blue}, {white}, {purple} and {lime}```
what is the issue rn?
do the items get removed from the drops?
on death of player:
remove {list::*} from the drops
loop {list::*}:
if player's inventory contains loop-value:
add 1 of loop-value to {_test::*}
wait 1 tick
give {_test::*} to player
Can you try this :p
ping me if it doesn't work
@dense marlin it says you should use victim or attacker instead of player
oh yeah, replace players with victims
yeah make the players victims
and giving on respawn is superior
please listen this time
specify indicies, youll thank me down the road
but it works
just because something is minimally functional doesnt mean cannot or should not be improved
this is much more organised and straightforward, itll make things much easier
it is. but this is faster for this problem
unless they have auto respawn 1/20 of a second is way too fast
and it literally 1 more line (two to delete the list)
mhmm, people wont be able to click respawn that fast
then i would recommend sending a "you died" title
?
because they wont have the death screen
unless they have a autoclicker
I tested it they do have a death screen
if you enable this, they wont
am not enableing that
well then you dont need the title, but then you definitely need to give on respawn
why it works fine
.
oh
you're telling me that you can consitently respawn in 1/20 of a second?
0.05 seconds
afk
no
because it worked fine and I didn't have to press the respawn button in 1/20 of a second
the guy that told you to do that agrees that on respawn is better
youre intentionally limiting yourself and making things messy and confusing
.
ok
fine ill use respawn
I don't see how it will change anything but
remove {list::*} from the drops
loop {list::*}:
if victim's inventory contains loop-value:
add 1 of loop-value to {_test::*}
on respawn:
give {_test::*} to victim```
I think this is how you do it
well no
thats local
but other than that, yeah.
and you should also make the list player-specific now as otherwise someone else could die and modify the list
wdym
if player A dies, {test::*} will be set to the items they have. Then, if player b dies, {test::*} will be set to the items they have. If player B dies before player A respawns player A will get player B's items
.
also idk what {test: :*} is
the list you have....
except i made it global because local is useless in this scenario
idk why youre so dead-set on making this so painful
for everyone involved
but we never made another list
{list::*} is one list, {_test::*} is the other
when did we made the other list
set {red} to red wool named "Flame Wool" with lore "this is flame wool" and "idk"
set {blue} to light blue wool named "Water Wool" with lore "this is water wool" and "idk"
set {white} to white wool named "Feather Wool" with lore "light as a feather" and "like a chicken"
set {purple} to purple wool named "Space Wool" with lore "came from space?" and "maybe?"
set {lime} to lime wool named "Earth Wool" with lore "its made out of rock" and "wait but its wool"
set {list::*} to {red}, {blue}, {white}, {purple} and {lime}
give player random element of {list::*}
on place:
if event-item is {red}:
cancel event
on drop:
if event-item is {red}:
cancel event
on death of player:
remove {list::*} from the drops
loop {list::*}:
if victim's inventory contains loop-value:
add 1 of loop-value to {_test::*}
on respawn:
give {_test::*} to player```
you see we made the first list here
set {list::*} to {red}, {blue}, {white}, {purple} and {lime}
again, you can make it more organised and remove that line
someone else made it for you
this
but its not in my skript
^
I thought you had to set a list to something before using the list
if you add something to an empty list skript creates it
thats kinda what youre doing on line 7 anyways
oh ok\
please. just please. #1188994685411262565 message
so how would I do this
one step at a time or youll get overwhelmed again
what is a indicies again
read these again
#1188994685411262565 message
#1188994685411262565 message
#1188994685411262565 message
ok
{listName::listIndex} = listValue
just because its more effort doesnt mean its not worth it
if you cant be bothered to write good, or even readable, code, you shouldnt be coding
no I hate naps
or I can close this post and mark it solved
until you make a new one in a hour
and then complain about how hard this is even though you never listen to suggestions to make things organised and easier
your right I probably am gonna make a new one in a hour
I don't do this tho
noo fusezion left
you have given so many examples in this post alone
no
do you have short-term memory loss?
no
genuine question, not an insult
no I don't
then please dont act like it
make an effort to remember what people say. if you're not bothering to even read or think about others' suggestions, you shouldnt be here
bruh
