Identify allied players with a script?

Hello Friends,

I’ve been thinking about a new game mode where the enemy CPU players get stronger and stronger as a timer counts down. So maybe they get researches granted or RU injections that get higher and higher every 15 min. It seems that after a while you can siege out even the strongest CPUs once your fleet gets butch enough, and I thought it’d be fun to make it so there’s real time pressure to knock the players out asap.

I like to play with CPUs on my team too though, so I can’t just base it on whether or not they’re AI.

Any ideas?

Thanks!

Is there a way to force the A.I. to go after bounties very aggressively? Make them a #1 priority for the A.I. and then increase the bounty. Maybe have more than one bounty appear at once. This would give the A.I. an edge because it would almost certainly see the bounty before the player does. This seems like a more appropriate avenue to pursue. The only hitch is getting the A.I. to go after bounties in a quick and efficient way.

I bet it could be set up so that a relic gets spawned right next to the CPUs starting point (haha), but that still doesn’t solve the problem of determining whether of not the CPU is teamed up with a player. I have a research that gets granted based on whether or not the slot is CPU or human, but that still doesn’t solve the problem.

I think I might have to set up teams in the map file like the single player game, but I’m not to sure if that would work in MP.

1 Like

Pretty sure the function your after is AreAllied

Also, there doesnt appear to be any functions in the lua script that actually tells the ai to go after crates or such. If the ai isnt coded to go after them, then it is possible to use CPU_AddSobGroup and CPU_RemoveSobGroup to manually take control of the ai units in the gametype scope to get them to go after other things.

edit found the ai actions in the cpuplayers.lua file, for relics it just sets the relic as a defend target and only for units within range. For crates, it tells only scouts to go for the crate. Room for improvements on both of these.

3 Likes

Ah cool, thanks!

Yeah, that might really work:

1- So the script would go through each player to see if they have the research that identifies them as a CPU.

2- Then in the next step it checks to see if they’re allied with a player that doesn’t have that research. So Slot 0 checks 1-7, Slot 5 checks 0-4 and 6-7, etc.

Then if 1 is negative, then they DON’T get the bonus. Because they’re a stinking meat-bag human.

And if 1 is positive and 2 is positive, then they DON’T get the bonus. Because they’re friends with a stinking meat-bag human.

And if 1 is positive and 2 is negative, then they DO get the bonus. Because they neither are, nor are they friends with a stinking meat-bag human.

Okay, thanks a lot guys! This should be enough help to start some testing.

1 Like

Instead of having research to identify a cpu player, you could instead use Player_GetLevelOfDifficulty( playerIndex )

A return of 0 means the player is human, while a return higher then 0 means its a cpu player .

You might also need to check if the player is alive Player_IsAlive( playerIndex )