#my scripts for random items are not working

1 messages · Page 1 of 1 (latest)

prisma gazelle
#

so ive created a script that randomizes the item from the node and when its collected it creates new item resource. BUT I EVERYTHING GO SO WRONG! my items that ive collected are not visible in the inventory (im not sure if they are even inside players inventory) and i get 2 error for "invalid access to property or key "item" on a base object of type "Nil". in update_slot() function (if !inventorySlot.item: continue) and has_item() function (for slot in slots:
if slot.item != null and slot.item.name == target_item.name:
return true)
ive tried everything but idk what to do, im so desperade

#

my codes for random items are not working

prisma gazelle
#

my scripts for random items are not working

digital scaffold
#

Can you show the error?

prisma gazelle
finite mural
#

im pretty sure you're checking if it is null instead of checking if its not null

#

try removing the !

prisma gazelle
#

still the same error

prisma gazelle
#

@finite mural

#

lmao i havent read ur nick

#

mb

finite mural
#

probably because inventorySlot is null then

prisma gazelle
#

ima check the script

#

i will go remove the code first

finite mural
#

oh yeah its def cause inventorySlot is null, I just had a close look and it says "on a base object of type Nil" so thats def it

prisma gazelle
#

alr so i've removed the code that checks if inventory.has_item(new_item)

#

nothing crashes for now

#

but still it doesnt show it or adds the new item to the inventory

#

but function insert works

#

top left

#

when i collect multiple it doesnt change other slots

#

so my wild guess is still not adding new item to inventoryslot or inventory

#

ive checked the code and it seems fine

#

@finite mural

finite mural
#

idk then