This troll will speak one of four random riddles. The PC uses the text/chat bar to speak the answer. If the answer is correct, the PC is not attacked. Otherwise the troll becomes hostile.
I needed this for an encounter and figured I would share this simple version with others.
For those wanting to expand on this:
an integer is set of the PC (TROLL_BRIDGE) to 1 when a correct answer is spoken. you can use that in generic triggers to cause the troll to become hostile if PCs attempt to bypass the riddle and cross his path/bridge.