Modding AI retreat conditions

Normal difficulty

Seems that, as of 1.12, the Normal AI fleets instantly flee whenever they don't have the upper hand (or forces aren't balanced), even if it means repeatedly leaving friendly, populated planets behind. They turn tail and run as soon as a superior force jumps in, and don't stop till they somehow manage to even the odds (by stumbling onto another one of their fleets, for instance) or have nowhere else to run.

For fun's sake, the AI should only flee when it's severely outnumbered and/or outgunned. I'd like several fleet battles over the course of any given game, instead of a single, final, potentially boring one.

I guess there must be a trigger somewhere that evaluates an AI fleet's opposition and determines whether it flees or stays and fights. How can I mod this to make the Normal AI less cowardly?

5,679 views 9 replies
Reply #1 Top

Please deal with this Star/Clad.  Even large fleets turn tail instead of putting up even minimal defense, they'll run all the way back to their homeworld and then put up a pitiful fight.

Reply #2 Top

But isn't there a way we can deal with this ourselves, before a patch comes? Can't be that hard to mod it...

:|

Reply #4 Top

Damn. It kills a lot of the fun...

I've heard there's quite a gap between Normal and Hard, so I'd be the one getting steamrolled if I switched difficulties.

Shelving time. :'(

Reply #5 Top

I had the same problem even on Hard difficulty, and here's how i solved it.

 

If you download the Distant star mod, you'll notice there's a special module for the Phase jump inhibitor that completely blocks off jumping in its radius.

I gave that ability to all Carrier-class capital ships, so now whatever is in range of them, cannot initiate jump.

Since the AI knows it can't initiate jump (as opposed to increased jump time) it doesnt even try to, and fights to the death. (If you only give +700% jump time as the phase inhibitor, enemy fleets will just get slaughtered trying to jump away).

This way, every fight where there's a carrier is a fight to the death. You can of course give the ability to other ships or whatever you see fit.

The good thing is that you get to enjoy fights in the game, not just the big final fight on the last planet owned by an empire. The bad thing is that every time some AI fleet comes near you, they can't flee anymore, even if you wanted them to. (For example, i'd like them to flee if BADLY outnumbered).

What can i say... better than nothing.

 

I'd like to modify the Phase disruption to a toggle ability, so that i can decide to turn it off when i think the AI should be allowed to retreat, but i dont know how to do it :P

Reply #6 Top

That's pretty interesting! Ideally, I'd want the two support capital ships of each race (the TEC's Dunov and Akkan, for instance) to possess this ability. Of course, it's really a double-edged sword, as you could find yourself in a disadvantageous position if the enemy ambushes one of your fleets with overwhelming numbers. You'd have to concentrate your fire on the support capship and then make a run for it. You'd still lose some ships, but it'd make things more dramatic and interesting.

Anyway, I'm a complete n00b at modding Sins. I just managed to convert .entity files to editable text and back, but even though the non-binary content is more understandable, it's not so enough for me. I'll need a couple of tutorials (at least to know what's what) and some direct experimentation.

According to derbal213's Interdictor mod, the files that need to be modded are AbilityHyperspaceDisruption.entity, BuffHyperspaceDisruptionSpawner.entity, BuffHyperspaceDisruptionTarget.entity and the corresponding entities of the ships you want to possess the ability. However, beyond that, I'm in the dark.

Any pointers?

Reply #8 Top

This is a quick and dirty way of doing it. I did this for my own mod. I say quick and dirty, because it changes the phase inhibitor (module) to also block phase jumps. I actually liked it better myself. Anyways, onto the how.  

-open up BuffHyperspaceDisruptionTarget.entity

paste this

TXT
entityType "Buff"
onReapplyDuplicateType "KeepOldBuff"
buffExclusivityForAIType "ExclusivePerPlayer"
isInterruptable FALSE
isChannelling FALSE
numInstantActions 0
numPeriodicActions 0
numOverTimeActions 0
numEntityModifiers 0
numEntityBoolModifiers 1
entityBoolModifier "DisablePhaseJump"
numFinishConditions 3
finishCondition
    finishConditionType "FirstSpawnerNoLongerHasBuff"
    buffTypeToQuery "BuffHyperspaceDisruptionSpawner"
finishCondition
    finishConditionType "OutOfRange"
finishCondition
    finishConditionType "OwnerChanged"

 

-for an example we will mod this PhaseColony.entity (Vasari Colony ship)

-scroll all the way to the bottom..to the ability lists

ability:0 "AbilityPhaseFrigateColonize"
ability:1 ""
ability:2 ""
ability:3 ""

-and type in "AbiltyHyperspaceDisruption" in ability 3

ability:0 "AbilityPhaseFrigateColonize"
ability:1 ""
ability:2 ""
ability:3 "AbilityHyperspaceDisruption"

 

-This will inherit the original range of the Phase Inhibitor. If you wish to change that the range can be found in BuffHyperspaceDisruptionSpawner.entity

targetFilter
        numOwnerships 1
        ownership "Enemy"
        numObjects 2
        object "CapitalShip"
        object "Frigate"
        numConstraints 1
        constraint "CanBeJumpBlocked"
    range
        Level:0 100000.000000
        Level:1 0.000000
        Level:2 0.000000

My range looks a little odd because I wanted it to affect the entire gravity well.

 

-As to how to add them to Cap ships, that might need some more work. I think you can only have 4 abilitys on a ship. (I could be wrong, I'm still newbish on modding)

 

 

Reply #9 Top

To those who wanted to add "DisablePhaseJumping" to structures/ships as a toggle-able ability, here's how I did it if you're still interested:

First off, I didn't want to overwrite the original always-on jump inhibition ability, so I made a new ability.  I'll name each file that needs created, post what I have in it, and then I'll name the files I changed and what I changed to support/use the new ability.... I'm using entrenchment btw, so my capships/frigates/structures etc have 5 abilities (0-4) instead of 4. This makes it much easier to add it to cap ships as they now have a free spot! :)

K files created in order of use by the game:

AbilityHyperspaceDisable.entity:

TXT
entityType "Ability"
buffInstantActionType "ApplyOrRemoveBuffToSelf"
instantActionTriggerType "AlwaysPerform"
buffType "BuffHyperspaceDisableSpawner"
effectInfo
 effectAttachInfo
  attachType "Invalid"
 smallEffectName ""
 largeEffectName ""
 soundID ""
toggleStateOnNameStringID "IDS_ABILITY_HYPERSPACEDISABLEACTIVE_NAME"
toggleStateOnDescStringID "IDS_ABILITY_HYPERSPACEDISABLEACTIVE_DESCRIPTION"
needsToFaceTarget FALSE
canCollideWithTarget TRUE
moveThruTarget FALSE
isUltimateAbility FALSE
maxNumLevels 1
levelSourceType "FixedLevel0"
aiUseTime "Anytime"
aiUseTargetCondition "Any"
isAutoCastAvailable TRUE
isAutoCastOnByDefault FALSE
pickRandomPlanetToExploreForAutoCastTarget FALSE
ignoreNonCombatShipsForAutoCastTarget TRUE
onlyAutoCastWhenDamageTakenExceedsPerc 0.000000
useCostType "AntiMatter"
antiMatterCost
 Level:0 0.000000
 Level:1 0.000000
 Level:2 0.000000
cooldownTime
 Level:0 0.000000
 Level:1 0.000000
 Level:2 0.000000
researchPrerequisites
 NumResearchPrerequisites 0
nameStringID "IDS_ABILITY_HYPERSPACEDISABLE_NAME"
descStringID "IDS_ABILITY_HYPERSPACEDISABLE_DESCRIPTION"
hudIcon "HUDICON_ABILITY_BOOSTRESOURCEEXTRACTION"
smallHudIcon "HUDICON_ABILITY_BOOSTRESOURCEEXTRACTION_ACTIVE"
infoCardIcon ""

I used the Hudicons I did because I figured this out using the Psi tradeport toggleable ability "boost resource extraction".  If you want to change those to other hudicons or customs, you probably can... I'm happy with these images though :)

 

BuffHyperspaceDisableSpawner.entity

TXT
entityType "Buff"
onReapplyDuplicateType "PrioritizeOldBuffs"
buffStackingLimitType "ForAllPlayers"
stackingLimit 1
allowFirstSpawnerToStack FALSE
buffExclusivityForAIType "ExclusiveForAllPlayers"
isInterruptable FALSE
isChannelling FALSE
numInstantActions 0
numPeriodicActions 1
periodicAction
 actionCountType "Infinite"
 actionIntervalTime
  Level:0 2.500000
  Level:1 0.000000
  Level:2 0.000000
 buffInstantActionType "ApplyBuffToTargetsInRadius"
 instantActionTriggerType "AlwaysPerform"
 buffType "BuffHyperspaceDisableTarget"
 targetFilter
  numOwnerships 1
  ownership "Enemy"
  numObjects 2
  object "CapitalShip"
  object "Frigate"
  numSpaces 1
  space "Normal"
  numConstraints 0
 range
  Level:0 50000.000000
  Level:1 0.000000
  Level:2 0.000000
 maxTargetCount
  Level:0 -1.000000
  Level:1 -1.000000
  Level:2 -1.000000
 effectInfo
  effectAttachInfo
   attachType "Invalid"
  smallEffectName ""
  largeEffectName ""
  soundID ""
numOverTimeActions 0
numEntityModifiers 0
numEntityBoolModifiers 0
numFinishConditions 1
finishCondition
 finishConditionType "OwnerChanged"

 

BuffHyperspaceDisableTarget.entity

TXT
entityType "Buff"
onReapplyDuplicateType "PrioritizeOldBuffs"
buffStackingLimitType "ForAllPlayers"
stackingLimit -1
buffExclusivityForAIType "NotExclusive"
isInterruptable FALSE
isChannelling FALSE
numInstantActions 0
numPeriodicActions 0
numOverTimeActions 0
numEntityModifiers 0
numEntityBoolModifiers 1
entityBoolModifier "DisablePhaseJump"
numFinishConditions 3
finishCondition
    finishConditionType "FirstSpawnerNoLongerHasBuff"
    buffTypeToQuery "BuffHyperspaceDisableSpawner"
finishCondition
    finishConditionType "OutOfRange"
finishCondition
    finishConditionType "OwnerChanged"

 

Then open "English.str", add 4 to the line "NumStrings" and add these 4 entries:

StringInfo
 ID "IDS_ABILITY_HYPERSPACEDISABLEACTIVE_NAME"
 Value "Stop Phase Space Jamming."
StringInfo
 ID "IDS_ABILITY_HYPERSPACEDISABLEACTIVE_DESCRIPTION"
 Value "Ships are once again allowed to phase jump."
StringInfo
 ID "IDS_ABILITY_HYPERSPACEDISABLE_NAME"
 Value "Begin Phase Space Jamming."
StringInfo
 ID "IDS_ABILITY_HYPERSPACEDISABLE_DESCRIPTION"
 Value "Jams the Phase space engine on enemy ships preventing phase jumps."

The above steps all get the ability recognized/usable by the game, the following is an example of how to use it in-game:

Open a capship file (for example I'll use the Advent Radiance Battleship... "CAPITALSHIP_PSIBATTLESHIP.entity")

move that capital ship's passive ability to "ability4" (which is ability 5) (If a capital ship does not have any passive abilities, you'll have to choose one to remove, because any ability that's in spot 5 is not clickable on the main hud (just the point allocation hud).

Once the passive is in spot 5 (it's ok that you can't click it anywhere other than point allocation, because once it's Purchased, it's "always on"), add "AbilityHyperspaceDisable" to the spot where the passive ability was

That's it. Load the game, enable the mod with these files in it, create the capital ship you've edited, and you now can turn the ability to phase jump on/off for any enemy ships in range :)

You can add this ability to any structure or ship with an ability list, just make sure that whichever spot you add it to has a space in-game for the button... Otherwise you can't click it! (starbases and capital ships only have 4 "windows" because of the upgrade button and point allocation button that each has respectively. Frigates have all 5 windows open for their 5 abilities) Again, passives in spot 5 still work because... they're passive! :)