I made buildings with initial payload and everything seems to work, except for a "small" detail: The whole thing is the wrong house
When AI creates the pre-occupied buildings, they come out as neutral.
If the building is sellable it will be auto-sold, infantry will emerge (as with my occupiable foxhole, in pic not depicted since it was auto-sold)
AI will continue creating them to "fight" the invasion of enemy soldiers, except, they will just join these hostiles instead.
If the case the building is not sellable or something, it will still attack the AI anyways.
It seems to me that the problem is the logic was designed for vehicles ("Troop crawlers") and not tested properly on buildings.
Something which the developers might have not identified is the order of the algorithm of creation of a building occupied in this way. They might have told the game this:
Step 1: Create neutral infantry ->
Step 2: Put in [technotype] ->
Step 3: Make infantry the same owner as [technotype]
But the non-owned infantry will just interrupt the chain by making the building neutral in Step 2 by occupying it (something which doesn't happen in vehicles), therefore step 3 reconfirms everyone as neutral. This is speculation as how the error might have come to be.
Anyways, any fix or workaround will be greatly appreaciated, or if anyone can report this to ares for a hotfix (not really developed these day but this should be doable?)
In case there is interest here are my codes for both pre-occupied Bunker and Manhole (pillbox). Nothing out of the ordinary.
This unwanted behavior still happens if the buildings are set as
Crewed=yes
As me be very bery smart, I also tried later to make the building into a static Battle Fortress. That logic just doesn't work on buildings, though.
Spoiler (click here to read it):
Code:
;Soviet Bunker, pre-occupied since AI won't often do so
[NABNKR_AI]
Image=NABNKR
UIName=Name:NABNKR
Name=Soviet Battle Bunker
Adjacent=3 ;2
AIBasePlanningSide=1 ;gs 0 for New Order, 1 for Soviet, 2 for Yodvavresh
Armor=concrete ;steel
BaseNormal=no
BuildCat=Combat
Prerequisite=NACNST,FACTIONBUILDING
Capturable=false
ClickRepairable=yes
Cost=1200 ;500
Crewed=no
DebrisAnim=Dbris3sm,Dbris4lg,Dbris4sm,Dbris6sm,Dbris7lg,Dbris7sm,Dbris8sm,Dbris10lg,Dbris10sm
Explosion=manimFire,TWLT070,S_BANG48,S_BRNL58,S_CLSN58,S_TUMU60
IsBaseDefense=yes
MaxDebris=15
MinDebris=5
Owner=British,French,Germans,Americans,Alliance,Russians,Confederation,Africans,Arabs,YuriCountry
Powered=no
Sight=6
Strength=600
TechLevel=-1 ; AI should be able to build techlevel -1
;AIBuildThis=no ; Being raidable just gives you free stuff as they leave it ungarrisoned coz ai is stupid
;Now that it comes with single conscripts, use this
AntiInfantryValue=25 ;0
AntiArmorValue=15 ;0
AntiAirValue=0
;made so AI will build it.
;gs these three are in abstract units and just help the AI pick the right base defense. (see AIForcePredictionFudge)
CanBeOccupied=yes
MaxNumberOccupants=6 ;5
CanOccupyFire=yes
;Bunker.Raidable=yes
;May generate unwanted effects with pre-occupation
;Nevermind, the unwanted effects happen anyhow...
UC.PassThrough=1%
InitialPayload.Types=E2
InitialPayload.Nums=6
Code:
; PillBox for AI, occupiable but pre-crewed
[GAPILL_AI]
Image=GAFOXH
UIName=Name:GAPILL
Name=Allied Pill Box
Nominal=yes
;Primary=Vulcan2
BuildCat=Combat
Strength=400
Armor=steel
Prerequisite=BARRACKS,GACNST
TechLevel=-1
Adjacent=4
ROT=10
Sight=7
DetectDisguise=no
Owner=British,French,Germans,Americans,Alliance,Russians,Confederation,Africans,Arabs,YuriCountry
AIBasePlanningSide=0 ;gs 0 for New Order, 1 for Soviet, 2 for Yodvavresh
Cost=600
BaseNormal=no
Points=30
Power=0
Crewed=no
Capturable=false
Explosion=manimFire,TWLT070,S_BANG48,S_BRNL58,S_CLSN58,S_TUMU60
DebrisAnim=Dbris1sm,Dbris1lg,Dbris4sm,Dbris5sm,Dbris4lg,Dbris7sm,Dbris8sm,Dbris5lg,Dbris4lg
MaxDebris=15
MinDebris=5
;Turret=yes
;TurretAnim=LASER
;TurretAnimIsVoxel=true
;TurretAnimX=-8
;TurretAnimY=16
;TurretAnimZAdjust=-40
ThreatPosed=30 ; This value MUST be 0 for all building addons
DamageParticleSystems=SparkSys,LGSparkSys
IsBaseDefense=yes
HasStupidGuardMode=false
ImmuneToPsionics=no ; defaults to yes for buildings, no for others
AntiInfantryValue=25
AntiArmorValue=10
AntiAirValue=0
;gs these three are in abstract units and just help the AI pick the right base defense. (see AIForcePredictionFudge)
CanBeOccupied=yes
MaxNumberOccupants=2
CanOccupyFire=yes
;Bunker.Raidable=yes
;Generates unwanted effects with pre-occupation
UC.PassThrough=1%
By the way, it only behaves like that for AI, and only if the tech level is -1 (buildable by AI, but unbuildable by player)
If there is other way in which the AI may build this but not the player, you tell me. Perhaps having another building with techlevel -1 as prerequisite? _________________
Try the prerequisite trick. The AI is supposed to respect Prerequisites, so you should use a duplicate building with AIBuildThis. Make sure the player has no way to own it, though. Something like a mind-control-resistent, uncapturable base defense should do the trick. QUICK_EDIT
Just checked, you're right. I seem to have misread the prerequisite flow chart. Then preventing the player from building it simply a matter of giving it a prerequisite that the player can't own, like YAROCK or something. QUICK_EDIT
I will try that, However note that ModEnc only says that AI ignores buildlimits when setting Task Forces.
Quote:
AI players are not subject to any unit's BuildLimit. AI players will build whichever units are required by the chosen TaskForce regardless of how many instances of those units the AI player already owns.
In my experience, AI normally obeys buildlimits of buildings in terms of constructing only one at the time - such as Superweapons in the vanilla game. (unless you have set the optional rule of AI base doubling, in which case they will make two, but at the same time)
Yet, I will report any findings.
PS: Well, that did seem to do the trick! Although I did increase the AI value for defense and Added
Code:
AIBuildThis=yes
So it might not be the only consideration... (it used to build all gun turrets before, perhaps because the loaded bunkers were much more expensive for a similar defense value) ; now, in contrast, it is the turrets which it never builds.
But, the BuildLimit=0 does seem like a good way to bar players while allowing AI to use buildings which doesn't need TechLevel=-1 , so that works too _________________
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum