This should more or less cover what you want to do:
http://www.twcenter.net/forums/showthread.php?t=91758

Moved to modding questions.