Make unit stay where it is.

The place to post your WML questions and answers.

Moderator: Forum Moderators

Forum rules
  • Please use [code] BBCode tags in your posts for embedding WML snippets.
  • To keep your code readable so that others can easily help you, make sure to indent it following our conventions.
Post Reply
BajMic
Posts: 44
Joined: January 24th, 2023, 1:22 am

Make unit stay where it is.

Post by BajMic »

Hello. Is there any way to make units stay where they are by bulk other than taking away their movement?

I have a detachment of 10 AI units. The AI plays normally, but these units start with designated goto_x, goto_y parameters. Once they reach their goals, they move out. I tried to keep them with a well-timed "goto" Micro AI, but they end up making extra moves to choose the other hex and not the one they currently occupy. I understand, giving each an individual micro AI would work, but is there any other way?

In other words: a bunch of AI side units has "goto_x, goto_y, " coordinates attached. I need each unit to stay in place once it reaches its destination, while the AI still plays other units.
User avatar
Lord-Knightmare
Discord Moderator
Posts: 2365
Joined: May 24th, 2010, 5:26 pm
Location: Somewhere in the depths of Irdya, gathering my army to eventually destroy the known world.
Contact:

Re: Make unit stay where it is.

Post by Lord-Knightmare »

There is a "hangout Micro AI"
Creator of "War of Legends"
Creator of the Isle of Mists survival scenario.
Maintainer of Forward They Cried
User:Knyghtmare | My Medium
User avatar
lhybrideur
Posts: 369
Joined: July 9th, 2019, 1:46 pm

Re: Make unit stay where it is.

Post by lhybrideur »

Depending on what you want you can also modify them with a ai_special=guardian (they will stay whee they are unless they can attack) or set the ai to idle_ai if they are the only units of that side.
User avatar
beetlenaut
Developer
Posts: 2827
Joined: December 8th, 2007, 3:21 am
Location: Washington State
Contact:

Re: Make unit stay where it is.

Post by beetlenaut »

There are macros available in SotA utils called FREEZE_UNIT and THAW_UNIT. They use objects, which would be simpler than removing each unit's movement every turn.
Campaigns: Dead Water,
The Founding of Borstep,
Secrets of the Ancients,
and WML Guide
Post Reply