Elin
50 ratings
Cautious Companion
2
2
   
Award
Favorite
Favorited
Unfavorite
File Size
Posted
444.721 KB
12 Nov, 2024 @ 1:24pm
1 Change Note ( view )

Subscribe to download
Cautious Companion

Description
Companions/allies have a more cautious AI in combat, with some options.

The default vanilla mechanic for non-player-characters running away only triggers at < 1/5 * MaxHP, with some randomness weighted by how hard the character was hit. See the topmost graph, if you have 44 hp then getting hit 40 damage has a higher chance of making you run away than getting hit by 5 damage at an Hp of 15. Makes sense.

This mod adds two features at the moment, which only affect your party members:
- Higher health to consider running away at. This is now set to 1/3rd of MaxHP.
- Distance calculation

The base game does not consider the distance from the player when considering whether to run away. This mod adds two distance modes, where the further away you are, the more likely it is to run away when taking damage. The primary cases for this are (a) the ally follows enemies a long distance, (b) you are running away.
The "Alone" distance is *very* fearful when it is alone.

The health to consider running away at and the distance calculation method can be changed per-ally by speaking with them.

I suggest the default distance (Sigmoid-ish/"Gradual Distance" in-game), but I'm still uncertain about the precise tuning of the health.

The graphs use a MaxHP of 58 (the default for the cat, I believe).

If you have any feedback, like you want a curve somewhere in the middle, or some suggestion for how to calculate fear then feel free to suggest it. I'm not doing powerful levels of combat yet, so this may be too aggressive, or perhaps it is still ignoring too much.

----

Addition/Removal Status: Safe, will revert back to vanilla. Does not modify any game data permanently, and stores data in its own file.

----

TODO: Add a MMB/R command to simply tell your pet to flee immediately.
TODO: Consider adding a custom condition for fleeing towards the player. The default fear just runs away from the enemy, which might send them deeper into the dungeon.
TODO: Use information about the number of enemies and fellow allies (besides the player) nearby? Harder to calculate the probability of running...

Source Code: https://github.com/MinusGix/elin-mods/tree/master/CautiousCompanion
12 Comments
trouter 16 Jan @ 2:26am 
Seems like tank AI overrides this entirely, anything with tank AI shits itself and goes sprinting off no matter what AI I set it to.
Karmapowered 15 Jan @ 12:39pm 
Hello,

I'd like to report an error I noticed in my Player.log file :

Error: Failed to load cautious companion fear modifiers: System.NullReferenceException: Object reference not set to an instance of an object
at GameIO.get_pathCurrentSave () [0x00000] in <15eede575b1846778eb12a24e8f0df22>:0
at GameIOSavePatch.GameIO_LoadGame_Post (System.String id) [0x00002] in <c014fcfc52f64c86b9a83ce276ad4619>:0

Thank you for sharing your useful mod with us.
Virkful 28 Nov, 2024 @ 9:48am 
somehow doesn't work with older younger sister with the current game update, she's fighting for her death
Kinasin 16 Nov, 2024 @ 9:10pm 
thanks
requiemfang 16 Nov, 2024 @ 7:10pm 
Yeah hard limit distance def needed
Nekyia 15 Nov, 2024 @ 7:12am 
Commenting because I absolutely am needing the hard limit distance from player mod ASAP.
REDIC 13 Nov, 2024 @ 12:54pm 
ah yeah no no. I should have said I'm tired of my bear running off *to its death*
Saber 12 Nov, 2024 @ 11:18pm 
You a real one for this, thanks.
Z03 12 Nov, 2024 @ 9:53pm 
thank you for making this!!! i appreciate it
Missing Minus  [author] 12 Nov, 2024 @ 5:58pm 
It will still run off, but will be more fearful when it gets into fights. I might make an addition (if it is wanted by people) that lets you discourage companions from running too far from you, a hard distance limit being easiest.