This is for a mod, right? If the mod uses Userpatch there some ways you can do it, although it can be complicated. This code will find one of the special villager units and directly task them to the resource, like how a human selects a villager and right clicks on a resource to tell them to gather it.
Assume the unit ID is 1001. First, find one of the special villagers.
(defrule
(unit-type-count 1001 >
0) ;we have at least one of the special villagers
=>
(up-full-reset-search) ;search for the unit from scratch
(up-find-local c: 1001 c: 1) ;find 1 unit owned by the AI player that has the unit ID 1001
)
Then, find a gold mine.
(defrule
(up-set-target-object search-local c: 0) ;we can set the unit we found as the target object, meaning the search was successful
(up-gaia-type-count c: gold > 0) ;we have found a gold mine
=>
(up-reset-search 0 0 1 1) ;start our search for resources over again
(up-filter-status c: status-resource c: list-active) ;tell our next search to search for resources
(up-find-resource c: gold c: 1) ;find a gold mine
)
(defrule
(up-set-target-object search-local c: 0) ;we found a special villager
(up-set-target-object search-remote c: 0) ;we found a gold mine
=>
(up-target-objects 1 action-default -1 -1) ;tell the special villager we found to target the gold mine
(disable-self)
)
This code would have to be modified further to really work as intended. But it's a starting point. Telling specific units to do specific things unfortunately requires more advanced scripting. It's much easier to tell the AI to do general things.
~`o´~ |\ Join the fresh and exciting AI Ladder for its fourth season! ´ ` |_\ | Learn the joy of AI scripting in my guide: The World of AI Scripting ______|______
\ / .....Hinga Dinga Durgen! - SpongeBob
`-=<.__.>=-´