#Adding items to random slots

1 messages · Page 1 of 1 (latest)

dense pulsar
#

I have already implemented adding just items, but they are in order, how can I make them be there in say a scattering of the chest

modest wadi
#

set {_slot} to random integer between 0 and 26 (change "26" to how many slots there are)
set slot {_slot} of player's current inventory to item

gloomy pollen
#

No

#

That would make it possible for an item to replace another item

#

i.e. items will probably be deleted

#
set {_shuffled::*} to shuffled (integers between 0 and 26) # Shuffle all the values
loop {_items::*}: # Assuming whatever your items list is, is an increment list
    set slot {_shuffled::%loop-index%} to loop-value
modest wadi
gloomy pollen
#

You're not wrong haha

dense pulsar
gloomy pollen
#

of player

#

set slot {} of player