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 scripts for random items are not working
1 messages · Page 1 of 1 (latest)
my scripts for random items are not working
Can you show the error?
im pretty sure you're checking if it is null instead of checking if its not null
try removing the !
still the same error
probably because inventorySlot is null then
if so, that means new resource isnt added to the inventoryslot
ima check the script
i will go remove the code first
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
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
idk then