Country Specific AI Base Defences

Tutorial for Yuri's Revenge YR

Avatar of Allied General

Allied General

Category: Code
Level: Intermediate
Created: Wednesday July 29, 2009 - 4:46
Updated: Sunday October 11, 2009 - 8:19
Views: 3422
Summary: Allows the AI to work with country-specific base defences
Rating
  • Staff-
  • Members-
  • Average-

0 votes

Basically if your making a mod which introduces replacement defences for a specific faction e.g fortified pillbox to replace normal pillbox or firebase instead of tesla this is the tutorial for you.

Its gonna explain the main principles so no plugin and play you have a brain, use it!

This example would be for a replacement pillbox for Americans

go to GAPILL and you see this

Owner=British,French,Germans,Americans,Alliance,Russians,Confederation,Africans,Arabs,YuriCountry

change it to this

Owner=British,French,Germans,Alliance,Russians,Confederation,Africans,Arabs,YuriCountry
ForbiddenHouses=Americans

Notice the following

(i) Americans has been removed from Owner
(ii) ForbiddenHouses with Americans has been added

This has the following effects

(i) American human player can't build pillbox

(ii) AI refuses to build this structure, note forbidden by itself does not accomplish this, best example add the standard base defence tags to GTGCAN e.g threatposed=40, remove aibuildthis=yes and isbasedefense=yes to AlliedBaseDefenses= and watch all the allied AI's (not just France) build grand cannons >_>

Now to your fortified pillbox its owner tags should look this

Owner=Americans
RequiredHouses=Americans
ForbiddenHouses=British,French,Germans,Alliance,Russians,Confederation,Africans,Arabs,YuriCountry

Following effects

(i)American human can only build pillbox
(ii) Other houses cannot build pillbox
(iii) No NCO bug as all houses are listed.

Then add the following to your base defense (don't need AIBuildThis=yes)

ThreatPosed=40 (for advanced ground based defense e.g. prism tower) 30 (for anti-infantry, anti armour only defence e.g. pillbox) 0 for AA only (e.g. flak cannon)
IsBaseDefense=yes
AntiInfantryValue=25 (25 for most effective purpose of weapon and 15 for less effective and 0 for cannot target so an gun turret would have AntiArmorValue=25 and AntiInfantry value=15 and AntiAirValue=0)
AntiArmorValue=15
AntiAirValue=0

finally add structure to AlliedBaseDefenses=

This method is much more effective then the clone method for defences which are built in bulk and doesn't reply on prerequisites, position in buildingtypeslist and as a plus it helps the ai in an anti-base defence kill mission as isbasedefence=yes is the tag it needs.

Only noticeable gameplay issue is forbbidenhouses which prevents other players from building it.

Return to top