Jump to content

Is there a way to get AI ships to fight each other?


SageThe13th

Recommended Posts

I don't have an answer, sadly. But I am very interested in finding out if there is one.

 

As I just explained in my Enemy of my enemy suggestion, my current singleplayer galaxy has the condition where normally friendly factions are now allied with bandits. It's such that for every bandit ship I destroy, I lose over 13000 rep with any faction in the system! Yet these waves of bandits keep coming for my blood, like clockwork.

Link to comment
Share on other sites

On the documentation, ShipAI entities have 2 interesting functions that could help you:

 

function registerEnemyEntity(int index)

 

function unregisterEnemyEntity(int index)

 

 

I havent' tested them personally... But in theory if you have a shipA and shipB, this pseudocode will make them enemies to each other independently of the faction they belong to, and if there is no other nearby hostile entity close, they will attack each other:

 

local aiA = ShipAI(shipA.index)
local aiB = ShipAI(shipB.index)

aiA.registerEnemyEntity(ShipB.index)
aiB.registerEnemyEntity(ShipA.index)

-- Put both to aggresive
aiA.setAggressive
aiB.setAggressive

 

Far from home this week... So can't access my gaming desktop to check 100% that works, but hope it helps you as a starting point.

Link to comment
Share on other sites

I don't have an answer, sadly. But I am very interested in finding out if there is one.

 

As I just explained in my Enemy of my enemy suggestion, my current singleplayer galaxy has the condition where normally friendly factions are now allied with bandits. It's such that for every bandit ship I destroy, I lose over 13000 rep with any faction in the system! Yet these waves of bandits keep coming for my blood, like clockwork.

 

Are those factions allied with pirates? They could have the "Empathy" trait instead. In my galaxy I have one of those empathic factions. But they still fight pirates, so I just weaken them and wait. Alternatively, I eliminate those pests hitting them with asteroids or with each other (force turrets). First option is easier.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...