Hey guys,
Has anyone else encountered the following issue, and more importantly, is there a way round it?
I'm trying to check once a container is closed (or opened, the same still happens OnOpen) if I have a certain key in my inventory and if it passes, then the container locks.
This is my script so far:
When I add that script to a door, the script runs as expected....when I have the key, the local int says 1 and the messagebox pops up.
However, when I close the safe, even though I have the key and the local int should be 1, it notifies me on the screen that it's 0 so the IF statement fails with 'No Key'.
My conclusion therefore is that for some reason, when my inventory is called (a container is open on screen), a script fails to see whats in my inventory.
If that is true, is there a non-hacky way to achieve this.
The only thing right now I can think to do (very hacky) is to partner the safe to a door placed off screen, with the script on the door, not on the safe.
That way, when I close the safe, the offscreen door shuts too, and that door has an OnClosed script that does the above, but instead locks the safe not itself.
Hacky...there must be a more elegant script solution.
Any ideas?