NPC Mounting A horse?

I’m sort of flailing on this one. How would you code an NPC to mount a horse? That’s it. :smile:
I have an idea that it’s probably a simple script - do holler if you know anything. Thanks peeps.

Sample script here

Full reference info here

Sample mounts a PC so just substitute an NPC reference (e.g. OBJECT_SELF in a conversation ActionTaken, GetObjectByTag() in other contexts).

1 Like

Hey P, Would you know why, when my NPC mounts their horse - it disappears just as fast as you sit on it. Just Fades away, like ObjectDestroy(), only I checked my code - no errant DeathCommands() to report…, :thinking:

As explained in the reference material, the expected outcome of a mount is that the horse creature vanishes as the rider acquires a horse tail.

This should look fairly seamless, but maybe not a perfect illusion.

If the rider ends up in the mounted posture with no horse (tail) visible, check that the original horse is configured correctly.

Did you create that document? Wow - very professional!

Yeah, she’s definitely mounted to thin air for a couple of seconds before returning to the ground, horseless. Tried several times with different code scenarios all of which lead to the same result.

My silly code -

    object oHorse = GetObjectByTag("VYXARA_MOUNT_01");
    HorseSetOwner(oHorse, oVyxara, TRUE);

    oHorse = HorseGetMyHorse(oVyxara);

    if(!GetIsObjectValid(oHorse))
    {
        oHorse = HorseGetHorse(oVyxara);
    }

    if(GetIsObjectValid(oHorse))
    {
        AssignCommand(oVyxara, HorseMount(oHorse));
    }
}

HorseGetMyHorse() and HorseGetHorse() are redundant here, of course, but do confirm that HorseSetOwner() is working.

Sounds like you have two issues:

  • The horse “tail” isn’t appearing under the rider
  • The mounted phenotype is being cancelled

The first issue could be with the horse template. If it isn’t a standard Bioware horse, see section “Custom Mounts” - in particular, X3_HORSE_TAIL needs to be set on the template, otherwise no horse will appear under the rider.

The second issue suggests that you might have some other custom script that’s interfering with the mounted appearance after a moment - OnHeartbeat, perhaps.

Suggested steps:

  • Ensure that the module scripts are configured as described in “Getting Started”
  • In game, test mount with a PC using the radial menu
  • If that works, try exporting the NPC and horse to a vanilla module with no custom scripts except the “Getting Started” biz
  • If the NPC mounts normally there, you have a custom script conflict

Zoom in on Vyxara’s torso - does that give you a clue? Is that the horse tail doing that? Or should I say did that?

That’s what I’m left with after the horse disappears after mount.
I am using a standard Bioware horse from the palette.

I have several hearbeat scripts. Going over some of them now.

It’s not remotely like the mounted posture (see my guide for example).

Does the torso look normal before mounting?

Is Vyxara a standard playable part-based race?

Did you verify the horse by mounting the PC in game?

Yep.

As near as I can tell it’s based off a half-orc model. 3d edition Orcs

Yes, she mount’s fine.

I tried mounting with a human NPC and the mount happens nicely, but - human model just vanishes not more than a fraction of a second later, leaving only the horse to remain.

This…

So you can edit its parts in the toolset?

Just checking.

I kind of think you are on to something here - I Can not manipulate its parts. If by parts you mean - head, chest, thigh, feet etc.

Yes, that’s what I mean.

The mounted phenotype only works for part-based (dynamic) creature models . You need to change the creature appearance to “Half-orc”, checking that you can then edit the parts. You should also find that you can select the Mounted phenotype in the toolset to preview what the rider will look like.

It seems very likely that something in your custom scripting is resetting the appearance after mounting, which is why I strongly suggest getting this to work in a vanilla module before hunting for the scripting problem.

Yeah, that worked P. She mounted just fine after importing it into a fresh module. I had to change her parts, so she looks to be a brand-new orc. I actually prefer this one, (see pic).

What would you suggest I do next? Where to start? What would the likely culprit be?

Now, it’s working inside the normal mod - she’s mounting with no missing pieces. Thanks P! For all the help. :wink:
Now,
The “hand-off”, of her calling her horse then mounting it is somewhat clunky. Sometimes she just won’t crawl up and mount. Other times it goes off without a hitch. In fact, I often have to initiate her dialog twice in order for her to mount. After speaking the same conversation file twice, the second time she mount’s - very clunky. :wink:

1 Like

True.

I prefer to use the parameters in HorseMount() that skip the animation and mount instantly. I don’t think players lose much immersion that way.

Good to know. Will give it a try. I think I’m in concurrence with you about missing anything special using the different parameters.

Not having much luck.
Would someone go over this code and see if there’s anything catawampus, awry - or just simply amiss -

code so far:

#include "x3_inc_horse"

void main()
{
    object oVyxara = OBJECT_SELF;

    object oPC = GetPCSpeaker();

    location lLoc = GetLocation(GetWaypointByTag("PARTY_LOC"));

    string sString = "long_whistle";
    AssignCommand(oPC, PlaySound(sString));

    AssignCommand(oVyxara, SurrenderToEnemies());

    object oHorse = GetObjectByTag("VYXARA_MOUNT_01");
    HorseSetOwner(oHorse, oVyxara, TRUE);

    oHorse = HorseGetMyHorse(oVyxara);

    if(!GetIsObjectValid(oHorse))
    {
        oHorse = HorseGetMyHorse(oVyxara);
    }

    if(GetIsObjectValid(oHorse))
    {
        AssignCommand(oVyxara, HorseMount(oHorse, FALSE, TRUE));
        // DelayCommand(10.0, AssignCommand(oVyxara, ActionForceMoveToLocation(lLoc, TRUE, 30.0)));
        // DestroyObject(OBJECT_SELF, 14.0);
    }
}
type or paste code here

Ignore the commented code - you know, kind of like you’re supposed to. It’s just left over code that I was toying with. :crazy_face:

As of right now, she won’t even mount when the horse is called. She just stares at her steed with utter disdain!

The problem probably lies in calling HorseMount() in conversation.

If you look at the code in x3_inc_horse, it says

if (GetIsInCombat(oRider)||GetIsInCombat(oHorse)||IsInConversation(oRider)) return;

Simplest option is probably to issue a delayed mount command to the NPC, then stop the conversation.