HorseGetCanBeMounted(object, object, int)

Check whether an object can be mounted.

int HorseGetCanBeMounted(
    object oTarget,
    object oRider = OBJECT_INVALID,    
    int bAssignMount = FALSE



The object to be mounted.


If specified, the rider who will mount. (Default: OBJECT_INVALID)


If TRUE, the function will ignore whether someone can mount a horse in the area or not. This allows the script to check whether assignment is legal, even if mounting isn't. (Default: FALSE)


This function will return TRUE if the target can be mounted.

If a rider is specified, it will also make sure that the target can be ridden by the rider.


Similar to HorseGetIsAMount, but with the option to check that the potential rider is eligible, and the ability to use HorseGetMountFailureMessage to discover why a horse can't be mounted.

By design, this function does not check that the rider has the Mount Actions feat, in order to leave the system open to customizations that don't use the standard feats. Since the module builder determines which creatures are scripted, this is only a problem if you issue a command to an invalid creature by mistake. If necessary, you can check for Mount Actions separately, as shown in the example.

The option to check whether assignment is legal assumes that both horse and rider are in the same area.

Known Bugs

The function doesn't check whether the horse already has an owner (unless it's a Paladin mount).

When checking whether assignment (only) is legal, the function returns FALSE if the rider is a mounted PC. This is clearly wrong, because a mounted PC is allowed to have other assigned horses. Also, it does not recognize that a henchman's horse can be reassigned to a PC.


#include "x3_inc_horse"




// Check that an NPC has the Mount Actions feat and can ride a particular horse.

#include "x3_inc_horse"
void main()
  object oNPC = GetObjectByTag("enter NPC tag here");
  object oHorse = GetObjectByTag("enter horse tag here");

      AssignCommand(oNPC, HorseMount(oHorse));

See Also

functions:  HorseGetIsAMount | HorseGetMountFailureMessage
categories:  Horse Functions

author: Proleric, editor: Mistress