[DiscordArchive] Anyone know any TC functions to get a unit’s current speed?
[DiscordArchive] Anyone know any TC functions to get a unit’s current speed?
Archived author: robinsch • Posted: 2023-09-11T10:55:11.785000+00:00
Original source
GetSpeed should give you the speed.
Archived author: robinsch • Posted: 2023-09-11T10:55:20.070000+00:00
Original source
It's just speed rate * base rate
Archived author: robinsch • Posted: 2023-09-11T10:56:08.408000+00:00
Original source
You just need to map active movement flags to speed type you want.
Archived author: robinsch • Posted: 2023-09-11T10:56:31.638000+00:00
Original source
```
if (player->HasUnitMovementFlag(MOVEMENTFLAG_SWIMMING))
moveType = MOVE_SWIM;
else if (player->IsFlying())
moveType = MOVE_FLIGHT;
else if (player->HasUnitMovementFlag(MOVEMENTFLAG_WALKING))
moveType = MOVE_WALK;
else
moveType = MOVE_RUN;
```
Archived author: robinsch • Posted: 2023-09-11T10:59:52.258000+00:00
Original source
it think the only special case you would have is jumping but movement packet should contains direction of the jump and xyspeed