new function: isVTOLidle()

For AI and campaign script related discussions and questions
Post Reply
User avatar
DylanDog
Code contributor
Code contributor
Posts: 347
Joined: 08 Apr 2009, 15:15
Location: Germany
Contact:

new function: isVTOLidle()

Post by DylanDog »

Hello

Would be nice to have a function to check if a single VTOL is idle or not. While you can do this with not VTOL droids by checking the order given, this is not possible with VTOLs.

isVTOLidle() should return true when:
  • The weapon is fully charged. If the VTOL is rearming should return false.
  • There are no orders assigned to it.
  • VTOL is not flying (this is just "nice to have").
If you know a way to check this without using a a new function let me know.

DD
My Warzone 2100 mods:
Download DyDo-AI for Warzone skirmish/multiplayer games.
Download A2C-HM (Alpha 2 Campaign - Hard Mode).
Download A3C-HM (Alpha 3 Campaign - Hard Mode).
User avatar
Zarel
Elite
Elite
Posts: 5770
Joined: 03 Jan 2008, 23:35
Location: Minnesota, USA
Contact:

Re: new function: isVTOLidle()

Post by Zarel »

Check the action. DACTION_NONE (doing nothing) or DACTION_DROIDREPAIR (auto-repairing) means "idle".
User avatar
DylanDog
Code contributor
Code contributor
Posts: 347
Joined: 08 Apr 2009, 15:15
Location: Germany
Contact:

Re: new function: isVTOLidle()

Post by DylanDog »

Zarel wrote:Check the action. DACTION_NONE (doing nothing) or DACTION_DROIDREPAIR (auto-repairing) means "idle".
DACTION_NONE is missing in the scripting manual.

Do I check it with:

Code: Select all

if ( droid.action == DACTION_NONE){ do some stuff }
?
My Warzone 2100 mods:
Download DyDo-AI for Warzone skirmish/multiplayer games.
Download A2C-HM (Alpha 2 Campaign - Hard Mode).
Download A3C-HM (Alpha 3 Campaign - Hard Mode).
Per
Warzone 2100 Team Member
Warzone 2100 Team Member
Posts: 3780
Joined: 03 Aug 2006, 19:39

Re: new function: isVTOLidle()

Post by Per »

That should work. The droid.action stuff is somewhat recent, I think (ie not 1.10).
User avatar
DylanDog
Code contributor
Code contributor
Posts: 347
Joined: 08 Apr 2009, 15:15
Location: Germany
Contact:

Re: new function: isVTOLidle()

Post by DylanDog »

thanks
My Warzone 2100 mods:
Download DyDo-AI for Warzone skirmish/multiplayer games.
Download A2C-HM (Alpha 2 Campaign - Hard Mode).
Download A3C-HM (Alpha 3 Campaign - Hard Mode).
Post Reply