You must be logged in to post messages.
Please login or register

EE Scenario Design & Modding
Moderated by Soty

Hop to:    
loginhomeregisterhelprules
Bottom
Topic Subject: Unit TAI Modding - Basic Info
posted 12-12-08 11:43 PM EDT (US)   
I asked a while ago if anyone knew anything about modding with the Unit TAI (Unit AI) files. Nobody did, so I left it at that. However, lately JCGF's hex editing has got me back into the spirit of modding, so I started looking into these files more.

.TAI files are pretty easy to understand, fortunately. They can be opened in notepad and are basically just a script - they're mostly understandable to anyone who opens them.

The different .TAI files belong to different classes of units and buildings - helicopters, citizens, gates, everything.

So what can you do with TAI files?

Modding TAI files will change the way units react to their different states and other units around them. Some theoretical uses:

- Stop units from tracking enemies (make them stationary)
- Stop requiring units to reload before attacking (see below for some fun pictures of this!)
- Make units indestructable
- Stop transports from loading or unloading units
- Make units track enemies that wouldn't normally

Pictures of fun stuff!:

Fly Through the Air with the Greatest of Ease
http://i429.photobucket.com/albums/qq18/bmaczero/EE Mods/FunWithMissiles.jpg

Machine-Gun Towers
http://i429.photobucket.com/albums/qq18/bmaczero/EE Mods/FunWithTowers.jpg

The Sky is Falling
http://i429.photobucket.com/albums/qq18/bmaczero/EE Mods/Volcano.jpg

I've also learned some interesting things from reading the comments in the AI files. For example, did you know that Trojan Horses can go through enemy gates, even if they're locked?

The TAI files also give insight into some units that the developers may have intended to include, but didn't. There are several unused TAI files, such as one for a priest-prophet hybrid, a unit-producing building that also acts as a tower, and a building that gathers resources.

I have a theory that these unused files can be assigned to units via hex-editing the dbobjects file. By changing the unit's classification in the dbobjects file, I think EE might assign it a different AI file. It would be neat to have a barracks that could shoot at enemies .

But you don't need to hex to mod with TAIs!

The scripting language used by these files seems to work in a pretty straightforward fashion.

At the beginning, we have a block of text containing the name of the AI, what it's intended to do, and some other comments. These lines are all started with //. This prefix comments out the line - the program will completely ignore any line with // before it.

Then comes the code. The main part of the code consists of statements in this form:

State
{
Condition true(SetState) false(SetState)
}


The "State" part will be the name of a state the unit might be in. If the unit is in that state, the program will check any conditions inside the statement and execute the result.

The "Condition" will be a statement of something the unit might be doing or that might be happening around it. These are specific keywords that are established within EE's code, and unlike states, new conditions cannot be made up. The condition is followed by true() with a state in parenthesis and/or a false() with a state in parenthesis. If the condition is true, the unit will be set to the state after the true(). If it is false, the unit will become the state after the false(). If either result is not defined, the unit will remain in the same state until it meets a condition that is defined.

Multiple conditions can be accounted for by using anyof() or allof(). When using these commands, place any number of conditions in the parenthesis, seperated by commas. anyof() will be true if any of the conditions listed is true, allof() will be true only if all the conditions listed are true.

Examples:

State1
{
anyof(condition1,condition2,condition3) true(State2)
}

State2
{
allof(condition1,condition2) true(State1)
}


Only certain words and phrases are legitimate conditions. I will be making an index of these soon. However, any state can be made up and added by the modder.

There's one last command that is used often in the TAIs. This is #include("filename.txt"). In the parenthesis will be the name of another TAI file. The #include command will insert the contents of the entered file into the file containing the #include. This is used a lot for including often-used states such as dying and attacking without writing them out in each file.

An example

I bet you want to try out that missile example I put a picture of up above. For that, open up the "missile base.tai" file.

In there, you can see a state called "WaitForReload". Guess what this does? The condition in there is "Reloaded". Hehe. Replace this, and the other "Reloaded" condition below it with AlwaysTrue. Save the files as "missile base.tai" in Empire Earth/Data/Unit AI Scripts. Run and have fun!

[This message has been edited by BmacZero (edited 04-20-2009 @ 08:46 PM).]

Replies:
posted 12-13-08 05:43 PM EDT (US)     1 / 10  
ha!!! ive been thinking about modding those files when i pretty much cudnt find anythign else in the .dat files

you are awesome hehe, you have no clue how much time i lost trying to find the reload time......

AWESOME!!!

now, i think theres probably a link in dbobjects to the tai file, because if ive been completly swaping units (just keep original ID, Tech ID, But Id, model ID, language.ddl link, and i guess there must be a sound ID i missed cause im getting some weird sounds mixs... the weapon sound is linked in the dbgraphics im sure of that, now the unit sounds i think not) the unit acts like the swapped one...

so yes, this is an awesome help BmacZero :O

ill make a lase beam unit with it hehehehehe

off topic: for empire creations team, id like us to be the best modders out there and to release teh best EE modding guide on the web.... regarding all subjects really, im taking care of HEX tutorial, then i guess anyone can pretty much take care of teh TAI files, someone could give a good tutorial about language.ddl editing, someone about the texture modding... that woudl be perfect, a big PDF book

[This message has been edited by JCGF (edited 12-13-2008 @ 07:43 PM).]

posted 12-14-08 05:18 PM EDT (US)     2 / 10  
Thanks, JCGF!
you are awesome hehe, you have no clue how much time i lost trying to find the reload time......
This is one way to adjust the reload, however I think you can only remove the requirement to reload, not raise or lower the time :'(
ill make a lase beam unit with it hehehehehe
Muhahaha. You should see the laser towers with it, scything beams of energy everywhere .
give a good tutorial about language.ddl editing
I might do that next, language.dll editing is easy, the only hard part would come if we wanted to catalogue where each of the unit names are stored...
that woudl be perfect, a big PDF book
That's a good idea!
posted 12-14-08 08:04 PM EDT (US)     3 / 10  
in language,dll you may just search the word you want xD

usually ctrl+F activates search function
posted 12-14-08 10:10 PM EDT (US)     4 / 10  
Oh, hey, it does xD.

[This message has been edited by BmacZero (edited 12-12-2009 @ 10:45 PM).]

posted 12-17-08 03:18 PM EDT (US)     5 / 10  
ha, its funny to have reload time 0 with triggers too :P


some units get all buggy tough, barbarian, rock thrower, cyborg molotov..... but artilleries and all kinds of siege look realy great firing rapidly XD

[This message has been edited by JCGF (edited 12-17-2008 @ 03:18 PM).]

posted 02-09-10 05:28 PM EDT (US)     6 / 10  
Hi! I want to have citizens to repair all bulding in range. Is it possible?
posted 02-21-10 05:33 PM EDT (US)     7 / 10  
You mean you want them to automatically repair buildings. That's an interesting idea. If it is possible this would be the way to do it. I'll look into it and try to get back to you.
posted 02-21-10 06:12 PM EDT (US)     8 / 10  
would it be possible to create the following:

- as you mentionned above- a building that is capable of doing three things:
1-create units
2-attack enemies (ranged attack)
3-hold units (like the original EE fortress building)

and units that are able to:
1- move (obviously :S )
2- attack
3- produce units
(4) and have those units kept inside (like aircraft in the carrier)

more questions will follow
posted 03-08-10 08:40 PM EDT (US)     9 / 10  
Soty, sorry it took so long to get back to this. Unfortunately I'm increasingly convinced that it isn't possible to add much to units with these files (or at least, with these files alone), mostly just remove things. One reason is that the conditions seem pretty arcane and there is no easy way to find out what they are called.

In addition, it looks like all roads lead back to the dark art of HEX. Files such as "hybrid building.tai", which promises unit-creating buildings that also attack, simply contain #include statements to "stationary target tracking.tai" and "simple building.tai". The actual attack functionality must be added somewhere else, the TAIs just tell units that have it how to use it.
posted 12-21-13 03:39 AM EDT (US)     10 / 10  
BmacZero, I know it's been kinda over, err, well, three years, but IF you are still here (which would require a miracle hehe), could you maybe help me out, I can't seem to get the Volcano to fire like you did. I am trying to do this as a real Volcano, well we all know it works, and this is just more realistic than EE's standard one, that's why I require it for my Realism Mod. I would have another question as well, but I don't know if you're still around or not so...
Empire Earth Heaven » Forums » EE Scenario Design & Modding » Unit TAI Modding - Basic Info
Top
You must be logged in to post messages.
Please login or register
Hop to:    
Empire Earth Heaven | HeavenGames