[SDK] Advanced Unit Automations

I was able to compile it. Everything seems okay, no error messages but I run AI-Autoplay about 10 turns and I get CTD. I'm not sure what's up.

The CTD is probably unrelated, as the AI can not automate, and will never use any of the additional code I added. The problem must be elsewhere. If you haven't learned how to debug your code yet, open a thread in the SDK forum, and I can try to help. ;)
 
New update. Please check over all the merged code, as I made a few adjustments to the Border Patrol AI to avoid getting stuck.

Any other automations I should add? On a somewhat side-note, I made a new Mission for spies to sleep in a city until their max espionage bonus (5 turns in BTS) and then wake up. Would anyone be interested in me adding that to the OP?
 
New update. Please check over all the merged code, as I made a few adjustments to the Border Patrol AI to avoid getting stuck.

Any other automations I should add? On a somewhat side-note, I made a new Mission for spies to sleep in a city until their max espionage bonus (5 turns in BTS) and then wake up. Would anyone be interested in me adding that to the OP?

Yes my code must be messed up elsewhere, I'll start from scratch, I don't have a lot in there from the RevDCM core.

The max espionage bonus thing sounds great. Sounds like "Infiltrate" should be the option, that isn't taken right?
 
Yep, I did. It's on the second post though. I'll fix it in the next version. I figured out why the bug Cybah reported happened, and rewrote the Border Patrol code.
 
??? Did you add any source code for the non healing option? I can find your enums, but no actual AI sources which alter behavior. Also, there is no text key for that player option. :p
 
yeah thanks i know.

so after 1.2 you re uploaded the files?

It will be fixed in 1.3

Hey Afforess can you make a thread like this one for the complete "battle features" different implementation from Dales' modcomp you did the other day (I think you posted it somewhere as part of the RevDCM development)

Possibly, but when I have some free time, maybe by this weekend. If I forget, throw me a PM.

??? Did you add any source code for the non healing option? I can find your enums, but no actual AI sources which alter behavior. Also, there is no text key for that player option. :p

I did, but I forgot to include it. :blush:

I'll fix that for 1.3 too. ;)
 
Really? I did include those. Are you sure you updated the text files right?
 
Yes, did not found it in Automations_Civ4GameText.xml (there is no other text file).
 
Really? They are right here, at the top of the file:

Code:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<Civ4GameText xmlns="http://www.firaxis.com">
	<TEXT>
		<Tag>TXT_KEY_PLAYER_OPTION_IGNORE_DANGER</Tag>
		<English>Automated Pillaging Ignores Danger</English>
		<French>Automated Pillaging Ignores Danger</French>
		<German>Automated Pillaging Ignores Danger</German>
		<Italian>Automated Pillaging Ignores Danger</Italian>
		<Spanish>Automated Pillaging Ignores Danger</Spanish>
	</TEXT>
	<TEXT>
		<Tag>TXT_KEY_PLAYER_OPTION_IGNORE_DANGER_HELP</Tag>
		<English>Troops automated to pillage will ignore enemy units and may enter dangerous situations.</English>
		<French>Troops automated to pillage will ignore enemy units and may enter dangerous situations.</French>
		<German>Troops automated to pillage will ignore enemy units and may enter dangerous situations.</German>
		<Italian>Troops automated to pillage will ignore enemy units and may enter dangerous situations.</Italian>
		<Spanish>Troops automated to pillage will ignore enemy units and may enter dangerous situations.</Spanish>
	</TEXT>
	<TEXT>
		<Tag>TXT_KEY_PLAYER_OPTION_AVOID_BARBARIANS</Tag>
		<English>Automated Pillaging Avoids Barbarians</English>
		<French>Automated Pillaging Avoids Barbarians</French>
		<German>Automated Pillaging Avoids Barbarians</German>
		<Italian>Automated Pillaging Avoids Barbarians</Italian>
		<Spanish>Automated Pillaging Avoids Barbarians</Spanish>
	</TEXT>
	<TEXT>
		<Tag>TXT_KEY_PLAYER_OPTION_AVOID_BARBARIANS_HELP</Tag>
		<English>Troops automated to pillage will avoid entering barbarian territory and will not pillage barbarian settlements.</English>
		<French>Troops automated to pillage will avoid entering barbarian territory and will not pillage barbarian settlements.</French>
		<German>Troops automated to pillage will avoid entering barbarian territory and will not pillage barbarian settlements.</German>
		<Italian>Troops automated to pillage will avoid entering barbarian territory and will not pillage barbarian settlements.</Italian>
		<Spanish>Troops automated to pillage will avoid entering barbarian territory and will not pillage barbarian settlements.</Spanish>
	</TEXT>
[COLOR="Red"]	<TEXT>
		<Tag>TXT_KEY_PLAYEROPTION_AUTOMATED_AIR_CAN_REBASE</Tag>
		<English>Automated Air Units Can Rebase</English>
		<French>Automated Air Units Can Rebase</French>
		<German>Automated Air Units Can Rebase</German>
		<Italian>Automated Air Units Can Rebase</Italian>
		<Spanish>Automated Air Units Can Rebase</Spanish>
	</TEXT>
	<TEXT>
		<Tag>TXT_KEY_PLAYEROPTION_AUTOMATED_AIR_CAN_REBASE_HELP</Tag>
		<English>Automated Strike Craft will be allowed to rebase into more offensive positions</English>
		<French>Automated Strike Craft will be allowed to rebase into more offensive positions</French>
		<German>Automated Strike Craft will be allowed to rebase into more offensive positions</German>
		<Italian>Automated Strike Craft will be allowed to rebase into more offensive positions</Italian>
		<Spanish>Automated Strike Craft will be allowed to rebase into more offensive positions</Spanish>
	</TEXT>
	<TEXT>
		<Tag>TXT_KEY_PLAYEROPTION_AUTOMATED_AIR_CAN_DEFEND</Tag>
		<English>Automated Air Units Can Defend</English>
		<French>Automated Air Units Can Defend</French>
		<German>Automated Air Units Can Defend</German>
		<Italian>Automated Air Units Can Defend</Italian>
		<Spanish>Automated Air Units Can Defend</Spanish>
	</TEXT>
	<TEXT>
		<Tag>TXT_KEY_PLAYEROPTION_AUTOMATED_AIR_CAN_DEFEND_HELP</Tag>
		<English>Automated Strike Craft will be allowed to intercept potiental enemy aircraft</English>
		<French>Automated Strike Craft will be allowed to intercept potiental enemy aircraft</French>
		<German>Automated Strike Craft will be allowed to intercept potiental enemy aircraft</German>
		<Italian>Automated Strike Craft will be allowed to intercept potiental enemy aircraft</Italian>
		<Spanish>Automated Strike Craft will be allowed to intercept potiental enemy aircraft</Spanish>
	</TEXT>
	<TEXT>
		<Tag>TXT_KEY_PLAYEROPTION_NO_EXPLORER_HEALING</Tag>
		<English>Automated Explorers Cannot Heal</English>
		<French>Automated Explorers Cannot Heal</French>
		<German>Automated Explorers Cannot Heal</German>
		<Italian>Automated Explorers Cannot Heal</Italian>
		<Spanish>Automated Explorers Cannot Heal</Spanish>
	</TEXT>
	<TEXT>
		<Tag>TXT_KEY_PLAYEROPTION_NO_EXPLORER_HEALING_HELP</Tag>
		<English>Automated Explorers will not be allowed to heal</English>
		<French>Automated Explorers will not be allowed to heal</French>
		<German>Automated Explorers will not be allowed to heal</German>
		<Italian>Automated Explorers will not be allowed to heal</Italian>
		<Spanish>Automated Explorers will not be allowed to heal</Spanish>
	</TEXT>[/COLOR]
	<TEXT>
		<Tag>TXT_KEY_ACTION_AUTOMATE_PILLAGE</Tag>
		<English>Automate Pillage</English>
		<French>Automate Pillage</French>
		<German>Automate Pillage</German>
		<Italian>Automate Pillage</Italian>
		<Spanish>Automate Pillage</Spanish>
	</TEXT>
	<TEXT>
		<Tag>TXT_KEY_ACTION_AUTOMATE_PILLAGE_HELP</Tag>
		<English>Send the unit to search and destroy enemy's improvements</English>
		<French>Send the unit to search and destroy enemy's improvements</French>
		<German>Send the unit to search and destroy enemy's improvements</German>
		<Italian>Send the unit to search and destroy enemy's improvements</Italian>
		<Spanish>Send the unit to search and destroy enemy's improvements</Spanish>
	</TEXT>
	<TEXT>
		<Tag>TXT_KEY_ACTION_AUTOMATE_HUNT</Tag>
		<English>Automate Hunt</English>
		<French>Automate Hunt</French>
		<German>Automate Hunt</German>
		<Italian>Automate Hunt</Italian>
		<Spanish>Automate Hunt</Spanish>
	</TEXT>
	<TEXT>
		<Tag>TXT_KEY_ACTION_AUTOMATE_BORDER_PATROL_HELP</Tag>
		<English>Send the unit to patrol your civilization's borders and kill invading enemy units</English>
		<French>Send the unit to patrol your civilization's borders and kill invading enemy units</French>
		<German>Send the unit to patrol your civilization's borders and kill invading enemy units</German>
		<Italian>Send the unit to patrol your civilization's borders and kill invading enemy units</Italian>
		<Spanish>Send the unit to patrol your civilization's borders and kill invading enemy units</Spanish>
	</TEXT>
	<TEXT>
		<Tag>TXT_KEY_ACTION_AUTOMATE_CITY_DEFENSE</Tag>
		<English>Automate City Defense</English>
		<French>Automate City Defense</French>
		<German>Automate City Defense</German>
		<Italian>Automate City Defense</Italian>
		<Spanish>Automate City Defense</Spanish>
	</TEXT>
	<TEXT>
		<Tag>TXT_KEY_ACTION_AUTOMATE_CITY_DEFENSE_HELP</Tag>
		<English>Will protect the city from nearby attackers.</English>
		<French>Will protect the city from nearby attackers.</French>
		<German>Will protect the city from nearby attackers.</German>
		<Italian>Will protect the city from nearby attackers.</Italian>
		<Spanish>Will protect the city from nearby attackers.</Spanish>
	</TEXT>
	<TEXT>
		<Tag>TXT_KEY_ACTION_AUTOMATE_BORDER_PATROL</Tag>
		<English>Automate Border Patrol</English>
		<French>Automate Border Patrol</French>
		<German>Automate Border Patrol</German>
		<Italian>Automate Border Patrol</Italian>
		<Spanish>Automate Border Patrol</Spanish>
	</TEXT>
	<TEXT>
		<Tag>TXT_KEY_ACTION_AUTOMATE_HUNT_HELP</Tag>
		<English>Send the unit to hunt down and kill any enemy units it can find.</English>
		<French>Send the unit to hunt down and kill any enemy units it can find.</French>
		<German>Send the unit to hunt down and kill any enemy units it can find.</German>
		<Italian>Send the unit to hunt down and kill any enemy units it can find.</Italian>
		<Spanish>Send the unit to hunt down and kill any enemy units it can find.</Spanish>
	</TEXT>
	<TEXT>
		<Tag>TXT_KEY_ACTION_AUTOMATE_HURRY</Tag>
		<English>Automate Hurry</English>
		<French>Automate Hurry</French>
		<German>Automate Hurry</German>
		<Italian>Automate Hurry</Italian>
		<Spanish>Automate Hurry</Spanish>
	</TEXT>
	<TEXT>
		<Tag>TXT_KEY_ACTION_AUTOMATE_HURRY_HELP</Tag>
		<English>Send the unit to hurry the construction of a building in a nearby city.</English>
		<French>Send the unit to hurry the construction of a building in a nearby city.</French>
		<German>Send the unit to hurry the construction of a building in a nearby city.</German>
		<Italian>Send the unit to hurry the construction of a building in a nearby city.</Italian>
		<Spanish>Send the unit to hurry the construction of a building in a nearby city.</Spanish>
	</TEXT>
	<TEXT>
		<Tag>TXT_KEY_ACTION_AUTOMATE_PIRATE</Tag>
		<English>Automate Piracy</English>
		<French>Automate Piracy</French>
		<German>Automate Piracy</German>
		<Italian>Automate Piracy</Italian>
		<Spanish>Automate Piracy</Spanish>
	</TEXT>
	<TEXT>
		<Tag>TXT_KEY_ACTION_AUTOMATE_PIRATE_HELP</Tag>
		<English>Send the unit to plunder and raid nearby settlements, and sink weak or unprotected transports.</English>
		<French>Send the unit to plunder and raid nearby settlements, and sink weak or unprotected transports.</French>
		<German>Send the unit to plunder and raid nearby settlements, and sink weak or unprotected transports.</German>
		<Italian>Send the unit to plunder and raid nearby settlements, and sink weak or unprotected transports.</Italian>
		<Spanish>Send the unit to plunder and raid nearby settlements, and sink weak or unprotected transports.</Spanish>
	</TEXT>
	<TEXT>
		<Tag>TXT_KEY_ACTION_AUTOMATE_AIRSTRIKE</Tag>
		<English>Automate Airstrike</English>
		<French>Automate Airstrike</French>
		<German>Automate Airstrike</German>
		<Italian>Automate Airstrike</Italian>
		<Spanish>Automate Airstrike</Spanish>
	</TEXT>
	<TEXT>
		<Tag>TXT_KEY_ACTION_AUTOMATE_AIRSTRIKE_HELP</Tag>
		<English>Send the unit to attack enemy units whereever possible.</English>
		<French>Send the unit to attack enemy units whereever possible.</French>
		<German>Send the unit to attack enemy units whereever possible.</German>
		<Italian>Send the unit to attack enemy units whereever possible.</Italian>
		<Spanish>Send the unit to attack enemy units whereever possible.</Spanish>
	</TEXT>
	<TEXT>
		<Tag>TXT_KEY_ACTION_AUTOMATE_AIRBOMB</Tag>
		<English>Automate Airbomb</English>
		<French>Automate Airbomb</French>
		<German>Automate Airbomb</German>
		<Italian>Automate Airbomb</Italian>
		<Spanish>Automate Airbomb</Spanish>
	</TEXT>
	<TEXT>
		<Tag>TXT_KEY_ACTION_AUTOMATE_AIRBOMB_HELP</Tag>
		<English>Send the unit to attack enemy fortifications, improvements, and cities wherevever possible.</English>
		<French>Send the unit to attack enemy fortifications, improvements, and cities wherevever possible.</French>
		<German>Send the unit to attack enemy fortifications, improvements, and cities wherevever possible.</German>
		<Italian>Send the unit to attack enemy fortifications, improvements, and cities wherevever possible.</Italian>
		<Spanish>Send the unit to attack enemy fortifications, improvements, and cities wherevever possible.</Spanish>
	</TEXT>
</Civ4GameText>
 
Had been concentrating only on RoM and Modpacks so did not realize this thread was here until someone linked this to Neoteric World Mod... My man, you are amazing :D. You are like a machine after you take someone's ideas and distill them into real things!! :goodjob: And now I understand why betas are slow in coming! Worth every second waiting. And yeah I have occasional bug like Cybah showed you several posts above so I'm looking forward to your fixes.

Plus had you caught that bug where Hunt or Border Patrol unit just freeze and I had to manually hit either Hunt or BP button again before they attack an unit facing it?
 
Yes my code must be messed up elsewhere, I'll start from scratch, I don't have a lot in there from the RevDCM core.

The max espionage bonus thing sounds great. Sounds like "Infiltrate" should be the option, that isn't taken right?

Infiltrate duh of course that is the great spy thing. I guess then "Sleeper Cell" or something would be more appropriate. Made ya a button if you like. Its tough for me to tell what they'll look like in game hah without seeing it, but this should cover what you've described


 

Attachments

  • sleeper_cell.zip
    1.4 KB · Views: 66
I just continued my game and now I think I know how to dexcribe the freezing bug better.

Ok, the turn starts and there is a city that no longer have any building to construct so it open up pop-up. Now I'm assuming here: the unit (in my case it was Chinese junk on Hunt mission) was trying to do its stuff while I was adding in buildings for next construction jobs for that city I mentioned above. I closed the city screen. I'm taken immediately to that automated unit. Well, needless to say, I just hit Hunt again and it went ahead and attacked the enemy unit.

So until you figure out how to fix that, I will just go ahead and use that Option box option to minimize pop-ups until all unit actions are done with. Maybe it will solve that problem. If not, I will report back.
 
Top Bottom