The Beginners' Guide to AI scripting - Comprehensive Tutorial, Part 2
If you have not read part one, I would highly advise that you do, even if you count yourself experienced in coding:
http://aoe3.heavengames.com/cgi-bin/forums/display.cgi?action=st&fn=14&tn=38878&st=recent&f=14,38878,0,10
-----
Dear readers, I do now embark upon my second part of this AI guide. It is in my interests and the best interests of the community that I do so, and hopefully you can learn something from it. Never do I intend to offend; never to confuse; our aim is simple English and English is shall be.
Where shall we begin, you ask? We shall begin where we left off.
Never in the history of modding have we come this far. Yet we know nothing. Simply a paradox, eh? Some coders know more than others; some have more experience than others. To the ends, there are infinite numbers of improvements that could be made, and I suppose if we had time to put them all down, not even the whole world would have books enough for them. Our point here is to continue the work we began; to see our own possibilities in modifying the game's artificial intelligence. I do humbly present:
Comprehensive Beginners' Guide to AI modification, Part 2
In the past two years, I have learned a lot about what to do and what not to do, especially when it comes to coding. A mature coder understands that the simplest fixes are the best. Thus, I implore you to take upon the mask of humility, put on the coat drenched with rain, and huddle over to the coffee shop so that you and I may have a little talk together. In clear words, I invite you to spend time reading my guide instead of wasting hours of time trying to found things out on your own, for I could not bear to see you suffer as I once did - struggling for hours trying hard to understand. You are not without help or supporters; the community is your home, even if you have none at all.
----
Thus, we begin with our Techtree and Protoy in our backup folder. As a reminder, the "y" indicates that these are for The Asian Dynasties Expansion pack, thus including all of the units and techs regarding the Asian Dynasties.
I will begin by helping you a little. The first tech you will see in the techtree is this:
If you have not read part one, I would highly advise that you do, even if you count yourself experienced in coding:
-----
Dear readers, I do now embark upon my second part of this AI guide. It is in my interests and the best interests of the community that I do so, and hopefully you can learn something from it. Never do I intend to offend; never to confuse; our aim is simple English and English is shall be.
Where shall we begin, you ask? We shall begin where we left off.
Never in the history of modding have we come this far. Yet we know nothing. Simply a paradox, eh? Some coders know more than others; some have more experience than others. To the ends, there are infinite numbers of improvements that could be made, and I suppose if we had time to put them all down, not even the whole world would have books enough for them. Our point here is to continue the work we began; to see our own possibilities in modifying the game's artificial intelligence. I do humbly present:
In the past two years, I have learned a lot about what to do and what not to do, especially when it comes to coding. A mature coder understands that the simplest fixes are the best. Thus, I implore you to take upon the mask of humility, put on the coat drenched with rain, and huddle over to the coffee shop so that you and I may have a little talk together. In clear words, I invite you to spend time reading my guide instead of wasting hours of time trying to found things out on your own, for I could not bear to see you suffer as I once did - struggling for hours trying hard to understand. You are not without help or supporters; the community is your home, even if you have none at all.
----
Thus, we begin with our Techtree and Protoy in our backup folder. As a reminder, the "y" indicates that these are for The Asian Dynasties Expansion pack, thus including all of the units and techs regarding the Asian Dynasties.
I will begin by helping you a little. The first tech you will see in the techtree is this:
<TechTree version ='3'>
<Tech name ='Age0French' type ='Normal'>
<DBID> 105< /DBID>
<Status> UNOBTAINABLE< /Status>
<Flag> Shadow< /Flag>
<Effects>
<Effect type ='Data' amount ='1.00' subtype ='Enable' relativity ='Absolute'>
<Target type ='ProtoUnit'> Explorer< /Target> < /Effect>
<Effect type ='Data' amount ='1.00' subtype ='Enable' relativity ='Absolute'>
<Target type ='ProtoUnit'> TownCenter< /Target> < /Effect>
<Effect type ='TechStatus' status ='active'> AAStandardStartingTechs< /Effect>
<Effect type ='TechStatus' status ='obtainable'> RGVoltigeur< /Effect>
<Effect type ='TechStatus' status ='obtainable'> RGGendarmes< /Effect>
<Effect type ='TechStatus' status ='obtainable'> ChurchCodeNapoleon< /Effect>
<Effect type ='TechStatus' status ='obtainable'> ChurchGardeImperial1< /Effect>
<Effect type ='Data' amount ='1.00' subtype ='Enable' relativity ='Absolute'>
<Target type ='ProtoUnit'> Hussar< /Target> < /Effect>
<Effect type ='Data' amount ='1.00' subtype ='Enable' relativity ='Absolute'>
<Target type ='ProtoUnit'> Sheep< /Target> < /Effect>
<Effect type ='Data' amount ='1.00' subtype ='Enable' relativity ='Absolute'>
<Target type ='ProtoUnit'> House< /Target> < /Effect>
<Effect type ='Data' amount ='1.00' subtype ='Enable' relativity ='Absolute'>
<Target type ='ProtoUnit'> Mill< /Target> < /Effect>
<Effect type ='TechStatus' status ='obtainable'> VeteranMusketeers< /Effect>
<Effect type ='TechStatus' status ='obtainable'> GuardMusketeers< /Effect>
<Effect type ='Data' amount ='1.00' subtype ='Enable' relativity ='Absolute'>
<Target type ='ProtoUnit'> Musketeer< /Target> < /Effect>
<Effect type ='TechStatus' status ='obtainable'> ChurchGardeImperial3< /Effect>
<Effect type ='TechStatus' status ='obtainable'> ChurchGardeImperial2< /Effect>
<Effect type ='Data' amount ='1.00' subtype ='Enable' relativity ='Absolute'>
<Target type ='ProtoUnit'> Coureur< /Target> < /Effect>
<Effect type ='TechStatus' status ='obtainable'> GuardHalberdiers< /Effect>
<Effect type ='TechStatus' status ='obtainable'> GuardDragoons< /Effect>
<Effect type ='TechStatus' status ='obtainable'> VeteranPikemen< /Effect>
<Effect type ='TechStatus' status ='obtainable'> ImperialHalberdiers< /Effect>
<Effect type ='TechStatus' status ='obtainable'> ImperialGendarme< /Effect>
<Effect type ='TechStatus' status ='obtainable'> ImperialVoltigeur< /Effect>
<Effect type ='TechStatus' status ='obtainable'> ImperialMusketeers< /Effect>
<Effect type ='TechStatus' status ='obtainable'> ImperialDragoons< /Effect>
<Effect type ='Data' amount ='1.00' subtype ='Enable' relativity ='Absolute'>
<Target type ='ProtoUnit'> Capitol< /Target> < /Effect>
<Effect type ='Data' amount ='1.00' subtype ='Enable' relativity ='Absolute'>
<Target type ='ProtoUnit'> Falconet< /Target> < /Effect>
<Effect type ='Data' amount ='1.00' subtype ='Enable' relativity ='Absolute'>
<Target type ='ProtoUnit'> ArtilleryDepot< /Target> < /Effect>
<Effect type ='Data' amount ='1.00' subtype ='Enable' relativity ='Absolute'>
<Target type ='ProtoUnit'> Stable< /Target> < /Effect>
<Effect type ='Data' amount ='1.00' subtype ='Enable' relativity ='Absolute'>
<Target type ='ProtoUnit'> Barracks< /Target> < /Effect>
<Effect type ='TechStatus' status ='obtainable'> VeteranCrossbowmen< /Effect>
<Effect type ='TechStatus' status ='obtainable'> PoliticianGeneral< /Effect>
<Effect type ='TechStatus' status ='obtainable'> PoliticianPresidente< /Effect>
<Effect type ='TechStatus' status ='obtainable'> PoliticianMohawk< /Effect>
<Effect type ='TechStatus' status ='obtainable'> PoliticianEngineer< /Effect>
<Effect type ='TechStatus' status ='obtainable'> PoliticianMusketeerFrench< /Effect>
<Effect type ='TechStatus' status ='obtainable'> PoliticianNaturalist< /Effect>
<Effect type ='TechStatus' status ='obtainable'> PoliticianMarksman< /Effect>
<Effect type ='TechStatus' status ='obtainable'> PoliticianQuartermaster< /Effect>
<Effect type ='Data' amount ='1.00' subtype ='Enable' relativity ='Absolute'>
<Target type ='ProtoUnit'> Plantation< /Target> < /Effect>
<Effect type ='Data' amount ='1.00' subtype ='Enable' relativity ='Absolute'>
<Target type ='ProtoUnit'> TradingPost< /Target> < /Effect>
<Effect type ='Data' amount ='1.00' subtype ='Enable' relativity ='Absolute'>
<Target type ='ProtoUnit'>