#how do I make a player spawn with a item?

1 messages · Page 2 of 1

modest plume
#

ok

#

one last question will it still be global if its in a event?

vital saffron
#

hm?

#

the structure is irrelevant to the variable

#

a variable is a variable, no matter where its defined or used

vital saffron
cobalt matrix
#

local only exists under that trigger, like on something: or command something: or function something():

worn rapids
#

Damn... is this the longest thread in this discord

vital saffron
#

unfortuantely i dont think so lol

#

we go in circles and get carried away

worn rapids
#

This should have ended at 10 messages tops or never be created tho

vital saffron
#

i don;t disagree

arctic mulch
#

idk man if you total all the other threads with this one, you might make it

jolly owl
#

@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

uncut perch
#

Over 1000 Messages we made it!feelsbadman

strong zinc
#

Oh my god

modest plume
#
    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

vital saffron
#

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

modest plume
#

I did read the docs tho

#

I can't find anything tho

vital saffron
#

did you use the search bar?

#

because it's the first thing that shows up when I do

modest plume
#

yes i did

vital saffron
modest plume
#

but I can't find it

vital saffron
#

literally the first result

modest plume
#

bruh

vital saffron
#

you need to learn how to use the docs self-sufficently otherwise youll get nowhere on your own

modest plume
#

well I was searching up inventory

vital saffron
#

that wasnt the only keyword i suggested

modest plume
#

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

vital saffron
#

because thats not the correct syntax

vital saffron
modest plume
#

ok'

vital saffron
#

always tje first step

#

always

modest plume
#

ok

#
    if event-player has {red} in their inventory:
        clear drops of {red}```
vital saffron
#

theres examples underneath it

#

for clearing all the drops, or just removing some

modest plume
#

oh

vital saffron
#

i would remove the list you had

#

idk where you put it

modest plume
#
    if event-player has {red} in their inventory:
        remove {red} from the drops```
#

I did it

#

no errors

vital saffron
#

great

vital saffron
modest plume
#

?

#

wdym I can "stop all from being dropped at once"

vital saffron
#

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

vital saffron
modest plume
#

ok

#

what about when I need to do all the other else ifs for the others wool

vital saffron
#

what?

vital saffron
modest plume
#

is there way to simplify that

#

oh

vital saffron
modest plume
#
    if event-player has {list::*} in their inventory:
        remove {list::*} from the drops```
#

like this?

vital saffron
#

not exactly.

modest plume
#

oh

vital saffron
#

i always use an alternate syntax, player's inventory contains x as its shorter and more concise

modest plume
#

oh ok

modest plume
vital saffron
#

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

modest plume
#

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

vital saffron
#

what about it

modest plume
#

how do I give the player there wool back on respawn

vital saffron
#

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

modest plume
#

how do I keep track of it on death

vital saffron
#

well, lets loop through the list. loops are a good tool to know how to use

modest plume
#

how do I loop through the list

vital saffron
#

when you loop, loop-index will be that instance's index, and loop-value will be that value, the wool

vital saffron
modest plume
#

oh

#

how do I determine how many times it is looped?

vital saffron
#

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

modest plume
#

oh ok

modest plume
vital saffron
#

well, when you loop through, you can check if they posses each item individually

#

and can then keep track of it if they do

modest plume
#

oh ok

#
    remove {list::*} from the drops
on respawn:
    loop {list::*}
    if player```
vital saffron
#

you can either stop at only one, or return multiple if you wanted

modest plume
#

ok

vital saffron
modest plume
#

but its already looping the list

#

am confused

vital saffron
#
  give loop-player 1 of diamond```
modest plume
#

but what are we gonna do inside the loop?

vital saffron
modest plume
#

how do we do that inside the loop

vital saffron
#

do you remeber how to check if an inventory contains something?

modest plume
#

yes

#

I remember

#

what about it?

vital saffron
#

well, thats what we're tying to do, no?

modest plume
#

but we can only check one of the wools

#

which mean we would have to do a bunch more else ifs

vital saffron
#

no, we can loop it

modest plume
#

for the other wools

modest plume
#
    loop {list::*}
    if event-player has {list::*} in their inventory:```
vital saffron
modest plume
#

what do I put inside the loop tho

vital saffron
modest plume
#

am so confused

uncut perch
#

Bro do you guys want to reach 2000 Messages

modest plume
#

am confused about this loop thing

vital saffron
#

it might just happen :/

vital saffron
uncut perch
#

1136 Messages

modest plume
#

ok after we loop the list what do we do inside the list

vital saffron
modest plume
#

how the hell do i do that

vital saffron
#

ive given you all the peices, please try to see how they fit together

modest plume
#

I can't solve the puzzle

vital saffron
modest plume
# vital saffron

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:```
uncut perch
#

else if

vital saffron
#

no

vital saffron
#

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

modest plume
#

can you give me a example?

vital saffron
#
  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

modest plume
#

what is loop value

vital saffron
modest plume
vital saffron
#

remeber here, we defined indexes to make life easier.

#

index is the ting after ::

#

{list::INDEX} = VALUE

vital saffron
modest plume
#

the index is just *

vital saffron
#

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

modest plume
#

ok...

#

I don't see how color coding will help me

vital saffron
modest plume
#

yeah that does not help

vital saffron
#

i can only explain, i cant make you understand

modest plume
#

ik

#
    loop {list::*}:
        if player's inventory contains loop-value:
            give player 1 of loop-value``` like this?
vital saffron
#

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

modest plume
#

they don't have the item on respawn tho

vital saffron
#

thats my point

#

.

modest plume
#

is it because is it in loop?

#

do I take it out of loop?

vital saffron
#

you should be doing this when a player dies, not when they respawn

modest plume
#

oh

#

why does it need to be done when the player dies

vital saffron
dense marlin
#

Hello. . What is the issue, there's too much text to look through ;-;

modest plume
#

oh ok

#

hi

dense marlin
#

hey

modest plume
#

oh were trying to make it so the player keeps the items on death

modest plume
#
    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}```
dense marlin
#

what is the issue rn?

modest plume
#

this is the list were using

#

um

#

giving the item back on respawn

dense marlin
#

do the items get removed from the drops?

modest plume
#

yes

#
    remove {list::*} from the drops```
dense marlin
#
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

modest plume
#

ok

#

ty

dense marlin
#

ping me if it doesn't work

modest plume
#

@dense marlin it says you should use victim or attacker instead of player

dense marlin
#

oh yeah, replace players with victims

modest plume
#

ok

dense marlin
#

yeah make the players victims

modest plume
#

{_test::*}

#

what is this list?

#

it works

vital saffron
#

its nothing unless you define it

vital saffron
vital saffron
#

specify indicies, youll thank me down the road

modest plume
#

but it works

vital saffron
#

just because something is minimally functional doesnt mean cannot or should not be improved

vital saffron
# vital saffron

this is much more organised and straightforward, itll make things much easier

dense marlin
vital saffron
#

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)

modest plume
#

its gonna be on a server

#

I can turn on auto respawn or not

vital saffron
vital saffron
modest plume
#

?

vital saffron
#

because they wont have the death screen

modest plume
#

I tested it they do have a death screen

vital saffron
modest plume
#

am not enableing that

vital saffron
#

well then you dont need the title, but then you definitely need to give on respawn

modest plume
#

why it works fine

modest plume
#

oh

vital saffron
#

0.05 seconds

modest plume
#

afk

modest plume
#

because it worked fine and I didn't have to press the respawn button in 1/20 of a second

vital saffron
vital saffron
vital saffron
modest plume
#

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

vital saffron
#

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

vital saffron
#

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

modest plume
#

oh

#

ill keep the name

vital saffron
#

the list you have....

#

except i made it global because local is useless in this scenario

vital saffron
#

for everyone involved

modest plume
#

but we never made another list

vital saffron
modest plume
#

when did we made the other list

vital saffron
#

you didnt. you copy and pasted code

#

make*

modest plume
#
    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}

vital saffron
#

again, you can make it more organised and remove that line

modest plume
#

but we never set a second list

#

what why

vital saffron
#

but you didnt

vital saffron
vital saffron
modest plume
#

but its not in my skript

vital saffron
vital saffron
#

you just sent it

modest plume
#

I thought you had to set a list to something before using the list

vital saffron
#

if you add something to an empty list skript creates it

#

thats kinda what youre doing on line 7 anyways

modest plume
#

oh ok\

vital saffron
vital saffron
modest plume
#

but I need that line

#

it creates the list

vital saffron
#

not if you specify the indicies

#
set {list::b} to b```
#

then {list::*} = a and b

modest plume
#

what is a indicies again

vital saffron
#

read these again
#1188994685411262565 message
#1188994685411262565 message
#1188994685411262565 message

modest plume
#

ok

vital saffron
#

{listName::listIndex} = listValue

modest plume
#

.

#

I think ill just leave it as is

vital saffron
#

if you cant be bothered to write good, or even readable, code, you shouldnt be coding

modest plume
#

ok

#

well am really confused

vital saffron
#

then go get a drink of water or take a nap

#

clear your brain

modest plume
#

no I hate naps

vital saffron
#

well, do something to clear your mind

#

go for a jog, idk

modest plume
#

or I can close this post and mark it solved

vital saffron
#

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

modest plume
#

your right I probably am gonna make a new one in a hour

vital saffron
#

noo fusezion left

vital saffron
modest plume
#

no

vital saffron
#

do you have short-term memory loss?

modest plume
#

no

vital saffron
#

genuine question, not an insult

modest plume
#

no I don't

vital saffron
#

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

modest plume
#

bruh