[SDK] Advanced Unit Automations

Smeagolhart,
Thanks for the art. I already had one for it, since I made the spy mission a few months back. Modders can choose whichever they prefer, as I included the one I use in the art.

To all,

v1.30 has been uploaded. It fixes the issue where units that were assigned Border Patrol would get stuck. It also fixes the Explorers No Healing option. Also included is the new spy gather intel mission. I also added several Better AI functions that my code depends on and might cause issues for mods not using Better AI. If you are using Better AI, don't merge that code; I've commented it with a fairly obvious warning.

If anyone has any further, useful, automation ideas, feel free to suggest them. I will only create those I feel will be useful, but will take suggestions.

Enjoy!
 
I merged the latest version into the beta RevDCM from the sourceforge page and nothing else. I compiled the SDK without error. When I run the game, it's showing the Sentry (Naval Units) icon for a land unit. Quick question, is there possiblity to conflict with the way RevDcm's advanced sentry actions and this mod or should I go back to the drawing board and attempt remerge?

I did notice the places you commented NOT to use the Better BTS AI code

EDIT: attached cvgamecoredll. The xml and art bits (except for mission xml) don't overwrite the revdcm base. The text file says: "This copy of RevDCM is version 2.8" (latest vsn from SVN)
 

Attachments

  • CvGameCoreDLL.zip
    1.7 MB · Views: 109
Make sure the Missions are in the same order in the XML as they appear in the Enums.h SDK file. That's how the game knows which goes where.
 
Gna. Now my game crashes on loading screen (I did not merge the bbai code since I'm using 1.00).

Debug message weird:
"Unhandled exception at 0x05f3524d (CvGameCoreDLL.dll) in Civ4BeyondSword.exe: 0xC0000005: Access violation reading location 0x00000000."

 
Suggestion hotkey for Pillage: L.
Reason: Pillage have two Ls in the word. Distingush it from Patrol.
 
Why can't I set my bomber to automate airstrike? And Fighters should also being able to automate bombard. Since both air units can do both.

Edit1: Okay, looks like fighters can do both with automate air strike.

Edit2: Now my figher is not attacking any enemy unit anymore.

Edit3: And is it intended, that bombers with automate air bomb will be exploring every round if there is no target to bomb? Edit: Looks like air bomb without doing any damage. Enemy units in cities have animations, but do not take any damage. Something is wrong with this function.

Edit4: Also, none of them is bombarding city defense. Intended?
 
Gna. Now my game crashes on loading screen (I did not merge the bbai code since I'm using 1.00).

Debug message weird:
"Unhandled exception at 0x05f3524d (CvGameCoreDLL.dll) in Civ4BeyondSword.exe: 0xC0000005: Access violation reading location 0x00000000."

Did you get that fixed? I will assume so, since your later post implies everything worked.

Suggestion hotkey for Pillage: L.
Reason: Pillage have two Ls in the word. Distingush it from Patrol.

L is used for "Load". I do need to find good hotkeys though.

Why can't I set my bomber to automate airstrike?

Purely Aesthetic. The Airstrike and Airbomb automations actually do exactly the same thing. The AI depends more on the unit than which you select, so I gave fighters the Airstrike icon, and Bombers the Airbomb one. If you disagree with the change, I put a comment in the code in CvUnit which you can change.


Edit1: Okay, looks like fighters can do both with automate air strike.

Edit2: Now my figher is not attacking any enemy unit anymore.

Edit3: And is it intended, that bombers with automate air bomb will be exploring every round if there is no target to bomb? Edit: Looks like air bomb without doing any damage. Enemy units in cities have animations, but do not take any damage. Something is wrong with this function.

Edit4: Also, none of them is bombarding city defense. Intended?

Responding Backwards,

The AI rarely bombs city defense with planes because City Defense has no effect on gunpower units and later, and you can ignore it for the most part.

What is wrong with having them explore when there are no targets? They can't intercept, so it's the next best thing.

I haven't seen the airbombing fail to give damage. Could you show two screenshots, one of it bombing, and one where all the units still have full health? I suspect the injured ones are being hidden by the healthy stronger units. In my tests, the airbomb and airstrikes worked fine.
 
OK, have P for Pillage, and have CTRL+P for Border Patrol? Btw, where do I find detailed hotkeys with their functions (other than Tips please :)).
 
IDK, I memorized some (like Load). They are all in the XML though. You could just start making a big keymap. ;)
 
Edit: Looks like air bomb without doing any damage. Enemy units in cities have animations, but do not take any damage. Something is wrong with this function.

I haven't seen the airbombing fail to give damage. Could you show two screenshots, one of it bombing, and one where all the units still have full health? I suspect the injured ones are being hidden by the healthy stronger units. In my tests, the airbomb and airstrikes worked fine.

IIRC, when you recon a city with an airplane the city defender plays the same animation as when bombed.
 
IIRC, when you recon a city with an airplane the city defender plays the same animation as when bombed.

this explains my observation and was my second thought on that.


Did you get that fixed? I will assume so, since your later post implies everything worked.

No, I have removed all espionage sleep related code.


Purely Aesthetic. The Airstrike and Airbomb automations actually do exactly the same thing.

Good to know, then both _HELP texts should be the same. ;-)


The AI rarely bombs city defense with planes because City Defense has no effect on gunpower units and later, and you can ignore it for the most part.

Okay, that means they would under special circumstances.


What is wrong with having them explore when there are no targets?

Nothing, its good. :) I just did not know if it was intended.
 
Make sure the Missions are in the same order in the XML as they appear in the Enums.h SDK file. That's how the game knows which goes where.


It seems they are matching? I'm using RevDCM, there was no automate.xml file before I merged this. I attached a copy of the CIV4AutomateInfos and the cvenums.h I'm working off of. I mean I see in the enums.h file where it mentions activity naval sentry before the new automations but they aren't definted in the civ4automateinfos so I'm kinda confused

:sad:
 

Attachments

  • Code.zip
    15.1 KB · Views: 84
In your MissionInfos.xml, make sure your MISSION_ESPIONAGE_SLEEP entry is AFTER the inquisition one.
 
Minor update:

Border Patrol AI should work better with naval units, and fast moving units. Previously, the unit would look at only adjacent tiles to figure out where to patrol to next. Now, the units will consider farther away tiles, and attempt to maintain the patrol over larger distances.

Modders: only CvUnitAI.cpp was changed. The change is save-compatible.
 
Minor Update:

Fixed a bug in Border Patrol. It's only one line of code, in CvUnitAI.cpp; Save Compatible.

Enjoy. ;)
 
hi afforess, again,

i think i have a problem,

ive merged 1.31, with revdcm 2.722, and for some reason - the workers cant build any improvement,

with 1.2 i did not had this weird problem, im sure i have merged it right, since i did it twice from scratch,

can you help me?


**
ok - i merged only the orders without the spy mission - and the worker problem is fixed,
so i think something with the spy mission wont correlate with revdcm 2.722.
 
Top Bottom