Can I find out which Object is based on its EncodedObjectAsID?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By lucasfazzi

So, I don’t know if I understood it very well; I can receive an EncodedObjectAsID from an action that my player does, but can I convert that into information about which Object it is?

I tried to look in the documentation and I confess I was a little confused.

Thanks people.

:bust_in_silhouette: Reply From: jgodfrey

I’ve never used this before (and I can’t test it ATM), but from the docs, I’d expect it to work like this:

Assuming you have a valid EncodedObjectAsID

  • It should have an id property. That’s the same value returned by calling get_instance_id() on the original object
  • You can pass that id value to instance_from_id(id)
  • That will return the object instance represented by the passed id

Untested, but if your original EncodedObjectAsID is stored in myObject, I’d think this would return the original object:

var org_object = instance_from_id(myObject.id)