Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

Starsector 0.97a is out! (02/02/24); New blog post: Simulator Enhancements (03/13/24)

Author Topic: How to disable AI fleet retreating.  (Read 3458 times)

Linnis

  • Admiral
  • *****
  • Posts: 1009
    • View Profile
How to disable AI fleet retreating.
« on: July 10, 2014, 04:52:57 AM »

So is there a way to change my game in a way so the enemy AI fleet don't decide to retreat?

Also is there a way to disable capture points in missions?
« Last Edit: July 10, 2014, 04:55:34 AM by Linnis »
Logged

Debido

  • Admiral
  • *****
  • Posts: 1183
    • View Profile
Re: How to disable AI fleet retreating.
« Reply #1 on: July 10, 2014, 04:50:28 PM »

Are we talking in campaign or mission?
Logged

Linnis

  • Admiral
  • *****
  • Posts: 1009
    • View Profile
Re: How to disable AI fleet retreating.
« Reply #2 on: July 11, 2014, 06:03:14 AM »

Missions
Logged

Debido

  • Admiral
  • *****
  • Posts: 1183
    • View Profile
Re: How to disable AI fleet retreating.
« Reply #3 on: July 11, 2014, 11:37:49 AM »

Code: java
            if (ship.isAlive() && ship.getOriginalOwner() == 1 && !ship.isShuttlePod() && !ship.isWingLeader() && !ship.isDrone()) {
                CombatFleetManagerAPI eManager = engine.getFleetManager(FleetSide.ENEMY);
                if (eManager.getAssignmentFor(ship) != null && eManager.getAssignmentFor(ship).getType() == CombatAssignmentType.RETREAT) {
                    eManager.orderSearchAndDestroy(eManager.getDeployedFleetMember(ship), false);
                }
            }

Usually found in for a loop going over each ship, you can do smarter orders than just search and destroy, but this works fairly well.

This is really a modding question.
Logged

Linnis

  • Admiral
  • *****
  • Posts: 1009
    • View Profile
Re: How to disable AI fleet retreating.
« Reply #4 on: July 11, 2014, 10:18:15 PM »

Aow, sorry I thought I posted in Modding "General"  : P

Well, I haven't looked closely in on the specifics but would it possible to edit this... eManager or some other to make it so that CombatAssignmentType.RETREAT does nothing instead?
Logged

Debido

  • Admiral
  • *****
  • Posts: 1183
    • View Profile
Re: How to disable AI fleet retreating.
« Reply #5 on: July 11, 2014, 10:45:07 PM »

hm, you might be able to tell it to go to a custom way point which is in it's current location? Have a look at the CombatFleetManagerAPI and assignments.

http://fractalsoftworks.com/starfarer.api/com/fs/starfarer/api/combat/CombatFleetManagerAPI.html
Logged

Halsemon

  • Ensign
  • *
  • Posts: 5
    • View Profile
Re: How to disable AI fleet retreating.
« Reply #6 on: August 31, 2014, 05:36:31 PM »

Hello, I hope this isn't considered as necro'ing but I suppose it might and I apologize. The original poster of the thread was curious about mission prevention of retreating, but might I inquire as to how one prevents the campaign ships from retreating if at all possible?
Logged