Well, I think you can't make this to be compatibile in all cases. But it could be done nicely in a single/multiplayer mission or campaign.
If you want to make a unit to say something via GlobalChat command, you just write
this GlobalChat "Blah blah blah"
or similar cases such as GlobalRadio, chat through stringatble etc. I think that's clear for you
But if you want to operate with the chatting units or texts, you'll have to use a special line for each chat, which will run a special function. Example:
[MySoldier,(localize "STR_GlobalChat1")] exec "GlobalChat.sqs"
You can pass the arguments (the chatting unit and text of the message) into script, where you can play with it as you want. Example code of the script "GlobalChat.sqs":
_man = (_this select 0)
_text = (_this select 1)
ChatterPos = (GetPos _man)
MessageText = (_this select 0)
_man GlobalChat _text
exit
This simple script makes the unit radio the chosen text and sets it's position and text of the message to variables. This is the way how to solve this problem. Try to play with it a little bit and you'll see it's not so hard. Anyway, you can always write here