I feel bad since no one helped you, so even though I'm not really that pro yet I will give it a shot.

For starters, most people here probably won't simply write a code for you, as the point of the forums is to learn.

I would try to write something on my own first and then when you get errors, ask for more specific help. Anyway I will try to give you a basic outline of what I would do and hope that you will go from there, I hope no one thinks I am harsh, not too mention I don't really know the hard code for it, just ideas.

For starters make sure that you have a model of a treasure chest, and that it has an animation to play when it is opened. Secondly I would assign an action to the treasure chest that constantly uses a trace or scan function to see if the player entity is within a certain range. Then if the player is within your desired range, wait for a specific keystroke, then play the open animation. After that you could also have an ent_create to load a sprite of bubbles or a coin or whatever.

Hope that gets you in the right direction.