From NWN Lexicon
Jump to: navigation, search

HorseSetOwner(object, object, int)

Set horse owner.

void HorseSetOwner(
    object oHorse,
    object oOwner,
    int bAssign = FALSE   



The horse to be owned.


The creature who will own it.


If TRUE, the horse will also be assigned for mounting.


This function sets the owner of a horse.

Optionally, it will also set this horse to be the owner's assigned mount.


A creature may own many horses, but only one is assigned for mounting.

A henchman cannot mount via the radial menu commands unless a horse is assigned.

You can use this function to assign a horse which the target already owns - a useful feature, since other horse functions which create owners do not assign the horse for mounting.

If the horse is already owned by a different character, it will be removed from the previous owner.

If the horse or potential owner are invalid, the error is logged, and if the potential owner is a PC, they receive an error message. This function does not check whether the owner is able to ride the horse, because any creature is allowed to own a horse.

Unlike the radial menu, this function allows a dismounted NPC or henchman to own more than one horse.

If the potential owner is an NPC who is mounted, the function does nothing. If you just need additional horses to follow a mounted NPC, you can add them as henchmen of the NPC via the AddHenchman function, but the horse system won't recognize them as "owned".

An owner cannot be set on a Paladin mount.


#include " x3_inc_horse "




// Assign a horse to a PC.
#include "x3_inc_horse"
void main()
   object oPC = GetPCSpeaker();
   object oMyHorse = GetObjectByTag("enter tag here");
   HorseSetOwner(oMyHorse, oPC, TRUE);

See Also



author: Proleric, editor: Mistress