Ok the AI for this is rather simple...
Start by breaking it down into different parts as there will logically not be such complex natives to let you program this that easily.
Ok firstly our unit has to wander... I wonder how we will do that, hehe...
Ok so logically it must be in motion to wander around and it must be repetitive as all motions will come to an end (hopefully) and so new motions will have to be made.
The first problem to be solved is how the damn AI code will run, as all code has to have some activator otherwise it is a usless block of data in memory. You need something that is perodic (so it can be issued new movements when it stops) and infinite (so that it never stops).
I would say a good old infinite loop would solve this using TriggerSleepAction as a delay but as the AI may be dynamically created and destroyed (more than one unit or the unit may not be needed all the time or the AI may have to be paused) just use a timer with the AI code function as the function to run and run it in pereodic mode (never ending).
This leaves one last question, what update interval? Well for best results small numbers would be best but as AI can be demanding and is meant to be a background process, 1 second would do.
Next, what units does the AI affect, if it is only 1, use a variable, otherwise if many a group which you enum through.
Ok now for the first AI task, moving them randomly around the map.
First problem is when should a new move order be issued, as random movement every 1 second will result in a unit being stuck only in the middle are of a map due to chances. I would advise only to order it if its current order is equal to stop as then it is logically not moving and so needs a new order.
As for the actual movement, this can be incrediably easy if your map is like the ancient continent of pangea where every point can be walked to from every other point. However, if your map is like the world we live in, islands and unwalkable areas can pose a major problem, as issuing a move order to them is a waste of time as the unit will never be able to walk there. If that is the case then you will have to break the world up into movable areas and eithor provide an ability to bridge between them where the AI goes to if it has to change or keep them isolated on each island.
Ok so where can the unit go? Well that is a question which plagues AI writers of even the lattest games as you do not want it trying to walk into walls. The solution is to eithor try and pick a new random point a few times until one that is pathable is found (even if it is surrounded by unpathable terrain) and if that fails use one of a few preset pathable areas or use a preset pathable point map.
Depending on the ammount of unpathable area in your map, I would generally go with the second idea for more complex maps as it allows a garunteed pathable location always and also will mimic human behaviour more. Ofcourse you add some random offsets to these points every time it is moved to them so it seems more human like and less preset. This however can take a lot of time to set as each point relies on your AI (the intelligence driving you) to choose where it should be and in big maps you could end up with hundreds of points.
Now movement is done, what about your gold coins? Well, run a separate process next to the movement on in the same AI function for the same unit that checks all items in an area and if one is found to be a gold coin, it sets a global variable to this item and then issues the unit the order to pick up the item (ignoring any current move orders).
For efficency, you can irradicate overlap between the two areas as you logically will not have the current order as stop if you have found an item to pick up and equally if there is an item to pick up nearby, it is pointless to issue a movement order around the map as it should instantly go and pick it up.
I hope this helps you.