Collectables that remember if they've been picked up?

for unique objects, this is really easy, but I’m not sure of the best way of saving this information for non-unique items in large quantities. I’m guessing i can do something with object name or position but nothing I’ve tried works. Wondering if someone has done this before and if they have any ideas.

2 Likes

You can do this

Pick Up → Extractor (Object ID) → List (Push) → Save

Then, to see if the item was already picked up previously just do

Once → Extractor (Object ID) → List (Find) → Filter (Equal to 0 means it hasn’t been picked up, greater than 0 means it has been picked up). Also, that list is set with the Save

3 Likes

sick thanks I’ll try that

2 Likes

Np, if you need any other help feel free to @me

2 Likes

which output goes to the save btw? not very familiar with the list behaviours

2 Likes

It should look something like this

3 Likes

@CodeAlpaca a there’s a group of torches that can be lit and extinguised that I’d like to keep in their current state between loads for the convenience of the player. Not sure how to save it so that when you extinguish the torch after lighting it and reload the level, it’s unlit like it would be before the id was added to the list. is there a way to remove an id from the list?

my code looks like this right now.

1 Like

Oops sorry for the late reply, just saw this.

So you’re asking for a way to remove the unlit torches from the list?
I’m assuming that when a torch is lit, it is added to the list, now you want to remove it when it is unlit.


What this does is it

  1. Sets the List to the current IDs you have.
  2. When a torch is unlit will give some sort of activation (doesn’t need to be with a message)
  3. The Extractor will get the object ID and then search for it in the list, if the outputted value is greater than 0 it is inside the List.
  4. That item will be removed from the list because of the List Modify (Set to ‘Remove’). Because the “Find” input outputs the Index the item is at, you know exactly which item to delete.

(Note: Whatever is sent to the “Value” input on the List Modify does not matter when it is set to ‘Remove’)

{"data":{"behavior":{"v":"2","nodes":[{"inputCount":7,"outputCount":5,"name":"Number List","behaviorType":"logic.data.NumberList","x":-1170,"y":288,"group":"","id":"9a8cd87d87b2894f","startVal":[]},{"inputCount":3,"outputCount":1,"name":"Number List Modify","behaviorType":"logic.data.ListModify","x":-810,"y":320,"group":"","id":"9a8cf163a2984143","mode":2,"copy":false},{"inputCount":1,"outputCount":1,"name":"Extractor","behaviorType":"logic.properties.Extractor","x":-1350,"y":352,"group":"","id":"9a8d3e5450025d4c","targetId":0,"prop":"id","version":2},{"inputCount":0,"outputCount":1,"name":"Mailbox","behaviorType":"logic.components.Mailbox","x":-1530,"y":384,"group":"","id":"9a8d83f7864eff4e","notes":"Can be any sort of activation","n_o":1,"msg":"Unlit"},{"gateVal":0,"mode":"greater than","inputCount":2,"outputCount":2,"name":"Filter","behaviorType":"logic.logic.Filter","x":-990,"y":384,"group":"","id":"9a8ddd91fef1ba4f"},{"inputCount":2,"outputCount":1,"name":"Save Number List","behaviorType":"logic.logic.Storage","x":-630,"y":288,"group":"","id":"9a8e19b7b264f643","storageKey":"Torches","dataType":3},{"inputCount":2,"outputCount":1,"name":"Save Number List","behaviorType":"logic.logic.Storage","x":-1350,"y":256,"group":"","id":"9a8e1a12d4e3b341","storageKey":"Torches","dataType":3},{"inputCount":0,"outputCount":1,"name":"Always","behaviorType":"logic.triggers.Always","x":-1530,"y":256,"group":"","id":"9a8e88ca795dc243"}],"links":[{"input_id":"9a8cd87d87b2894fi0","output_id":"9a8e1a12d4e3b341o0"},{"input_id":"9a8cd87d87b2894fi2","output_id":"9a8d3e5450025d4co0"},{"input_id":"9a8cd87d87b2894fi6","output_id":"9a8d3e5450025d4co0"},{"input_id":"9a8cf163a2984143i0","output_id":"9a8cd87d87b2894fo0"},{"input_id":"9a8ddd91fef1ba4fi0","output_id":"9a8cd87d87b2894fo4"},{"input_id":"9a8cf163a2984143i1","output_id":"9a8ddd91fef1ba4fo0"},{"input_id":"9a8cf163a2984143i2","output_id":"9a8ddd91fef1ba4fo0"},{"input_id":"9a8e19b7b264f643i0","output_id":"9a8cf163a2984143o0"},{"input_id":"9a8d3e5450025d4ci0","output_id":"9a8d83f7864eff4eo0"},{"input_id":"9a8d3e5450025d4ci0","output_id":"9a8d83f7864eff4eo0"},{"input_id":"9a8cf163a2984143i1","output_id":"9a8ddd91fef1ba4fo0"},{"input_id":"9a8cf163a2984143i2","output_id":"9a8ddd91fef1ba4fo0"},{"input_id":"9a8e19b7b264f643i0","output_id":"9a8cf163a2984143o0"},{"input_id":"9a8e1a12d4e3b341i1","output_id":"9a8e88ca795dc243o0"},{"input_id":"9a8e1a12d4e3b341i1","output_id":"9a8e88ca795dc243o0"}]}}}
1 Like