Author Topic: Aliens ingore patrol priority  (Read 367 times)

Offline Cooper

  • Colonel
  • ****
  • Posts: 187
  • Chryssalids are awesome
    • View Profile
Aliens ingore patrol priority
« on: March 14, 2025, 08:52:56 pm »
Routes has always confused me.
I'm creating a UFO map, and trying to have a very high chance of at least one alien being in a specific room.
I have patrol priority set to 10 of course, yet aliens almost never go to this room, just away from it. And most aliens keep exiting the UFO, which I also don't want.
What else than patrol priority can influence an alien to stay, or go to, a specific room/set of nodes?

Offline Solarius Scorch

  • Global Moderator
  • Commander
  • *****
  • Posts: 11909
  • WE MUST DISSENT
    • View Profile
    • Nocturmal Productions modding studio website
Re: Aliens ingore patrol priority
« Reply #1 on: March 14, 2025, 09:43:34 pm »
Try making several nodes with maximum patrol priority connected to one another, like in a triangle or something. This might be enough to keep the unruly leader in place without completely preventing them from leaving the room.

Offline CrazedHarpooner

  • Colonel
  • ****
  • Posts: 186
    • View Profile
Re: Aliens ingore patrol priority
« Reply #2 on: March 15, 2025, 02:40:14 am »
It'll try to be clear on what I've come to understand from the code I've seen.

The behaviour you're looking for falls under the AI being in patrol mode, this mode in turn is split in two 'submodes' (scout and guard). It is the latter what you want as they'll move most commonly to adjacently connected nodes while the former would travel to any other node on the map that it can reach and meets other conditions (ie: non fliers won't pick flying marked nodes). There's a set of conditions for a patroling unit to switch between scout and guard and the one you can control via nodes is the rank of said node. If a unit starts at or reaches its destination node that is a non zero rank node it will switch to guard behaviour and this changes how it picks its next destination.

Guarding units will then pick the next destination from one of the connected nodes to its current one depending on highest patrol priority (flags) if it's available. They will never consider directly connected nodes that have 0 priority AND 0 rank.

There are certain limitations that might kick the unit into scout while being on guard, like all of the adjacent nodes being already targeted by other moving units or unavailable for other reasons.

Offline Cooper

  • Colonel
  • ****
  • Posts: 187
  • Chryssalids are awesome
    • View Profile
Re: Aliens ingore patrol priority
« Reply #3 on: March 15, 2025, 11:33:06 pm »
Thanks for good advice people, that helped a lot!
Realized that I knew this when I modded 10 years ago, but forgot about it after years of break.