Knuckle Cracker

Creeper World 3 => The Coder's Corner => Topic started by: Panlew on January 06, 2015, 11:59:59 PM

Title: Is there any way to check if the Command Node moves?
Post by: Panlew on January 06, 2015, 11:59:59 PM
And if it's possible, how do you do it?
Title: Re: Is there any way to check if the Command Node moves?
Post by: Grayzzur on January 07, 2015, 09:18:29 AM
Get the unit IDs for the command nodes, save their position, and watch their CONST_ISLANDED attribute. If they go from 1 (landed) to 0 (moving), they're on the move. You can then just assume that once it's landed, it has moved, or track the before and after X/Y coordinates and see if it changed if you need to be that picky. Useful commands to look up in the wiki:
GetAllUnitsInRange
GetUnitType (compare to "COMMANDNODE")
GetUnitAttribute (CONST_ISLANDED, CONST_COORDX, CONST_COORDY)