Hosting and domain costs until October 2024 have been generously sponsored by dumptruck_ds. Thank you!

Difference between revisions of "walkmove"

From Quake Wiki

m (Usage)
 
Line 6: Line 6:
 
If the entity is not on the ground and cannot fly or swim, this will always fail. Note that for flying and swimming enemies, calling this will try and level them with their enemy.
 
If the entity is not on the ground and cannot fly or swim, this will always fail. Note that for flying and swimming enemies, calling this will try and level them with their enemy.
  
'''Warning:''' The function assumes that self is the current entity that's trying to move.
+
'''Warning:''' The function assumes that '''self''' is the current entity that's trying to move.
  
 
=== Parameters ===
 
=== Parameters ===

Latest revision as of 12:03, 1 August 2023

float walkmove(float yaw, float dist)

Usage[edit]

Tries to move the entity in the given direction by the passed distance. This does not sweep the the entire movement area so large steps should be broken down into smaller parts, otherwise missed collisions can occur. This function only allows for manual movement on the x and y axes. By passing 0 for the distance it can be used to check the current position of the entity, allowing for manual collision detection.

If the entity is not on the ground and cannot fly or swim, this will always fail. Note that for flying and swimming enemies, calling this will try and level them with their enemy.

Warning: The function assumes that self is the current entity that's trying to move.

Parameters[edit]

  • yaw
The direction the entity wants to move. This is not relative to its current angle.
  • dist
The distance to try and move in map units.

Return[edit]

Returns TRUE if the movement was successful.

Example[edit]

// This function will attempt to move towards a monster's enemy with a slight angle
void SideSwipeAttack()
{
    if (!enemy_vis || enemy_range > RANGE_NEAR)
        return;

    walkmove(enemy_yaw + 15, 20);
    DoMeleeAttack();
}