HorseMount(object, int, int, int)

Action - mount a horse.

void HorseMount(
    object oHorse,
    int nAnimate = TRUE,    
    int bInstant = FALSE,   
    int nState = 0



The horse to be mounted by the caller.


If TRUE, the full mounting animation sequence is used.


If TRUE, the caller jumps instantly to the mounted position; otherwise, the caller moves to the horse before mounting instantly. Has no effect if full animation is specified.


An internal variable used by the function itself, that need not be modified.


This function will cause the calling object to attempt to mount the horse.


This is an Action which must be added to the caller's queue. As with all Actions, it is not executed immediately.

The function doesn't require the horse to be assigned or owned prior to mounting.

If the caller is unable to mount the horse for any reason, nothing happens. A floating text error message is displayed if the caller is a PC.

If you unintentionally command a rider with no appropriate model to mount, strange things will happen, so you may want to check for this in your script using HorseGetCanBeMounted.

In cutscenes, time must be allowed for the animation to complete. The default is (6.0 + HORSE_MOUNT_DURATION) because there's a 6 second timeout on getting into position before the animation.

It's wise to allow another second or two for action queue lag etc. Really strange bugs can occur if your script doesn't wait long enough for mounting to complete before pressing on with the action, because this function manages fragile AI switches.

If you over-ride the defaults, the formula is (6.0 + (HORSE_MOUNT_DURATION + fX3_MOUNT_DELAY) * fX3_MOUNT_MULTIPLE).


#include "x3_inc_horse"




// This example actions the PC to mount their assigned horse.
#include "x3_inc_horse"

void main()
   object oPC    = GetPCSpeaker();
   object oHorse = HorseGetMyHorse(oPC);

      AssignCommand(oPC, HorseMount(oHorse));

See Also

functions:  HorseInstantMount | HorseSetOwner | HorseDismount | HorseGetCanBeMounted | HorseGetHorse | HorseGetMyHorse
categories:  Horse Functions

author: Proleric, editor: Mistress