To Have and Have Not [Solved]

DavyB
06 Jul 2020, 12:19

I've just discovered that Got (object) only returns 'true' if the object held is visible, i.e. not in a closed container held by the player. Is there an easy way to test if an object is in the possession of the player even if not immediately visible?


mrangel
06 Jul 2020, 14:11

Different types of inventory…

  • Contains (game.pov, object) - does the player contain the object
  • Contains (game.pov, object) and object.visible - might be advisable because some libraries seem to make objects invisible instead of destroying them
  • ContainsReachable (game.pov, object) - is the object inside the player and not blocked by an invisible or closed container
  • ContainsVisible (game.pov, object) - As above, but allows objects that are inside transparent containers
  • Got (object) - Exactly the same result as ContainsVisible, but a lot slower (because it calls ContainsVisible on every object, makes a list of those that return true, and then checks if the object you want is in the list)

DavyB
06 Jul 2020, 20:10

Thanks mrangel, ...for the solution, explanation and rapid response!