Npc Horse or guar riding....

Post » Fri May 27, 2011 10:41 pm

Ok, so i know that madmax made a little man riding a horse around pegas ranch, but with that script, the man rode the horse to set spots in a circle. Is there a way to make an npc mount a horse and then use ai to control the horse? Like to where the npc could ride the horse wherever he wanted without having to follow coordinates? In the horse riding script recourse, http://planetelderscrolls.gamespy.com/View.php?view=Mods.Detail&id=8320 , it includes a script that only allows the horse to move if the player is constantly running. the horse wont go unless the player had W pushed down. That might work for the allowing of npc to go wherever, but how would the npc mount the horse?
User avatar
Jarrett Willis
 
Posts: 3409
Joined: Thu Jul 19, 2007 6:01 pm

Post » Fri May 27, 2011 10:29 pm

In essence, you need to write the reverse of the usual riding scripts.
Instead of having the horse follow the player, you need to have the NPC positioned relative to the horse. You also have to account for the fact both may change cells, and at different times (I'd just keep them in one cell, don't let them go between cells, it'll be much easier).

Otherwise, just put something like this on the NPC:
Set pX to "horse"->GetPos XSet pY to "horse"->GetPos YSet pZ to "horse"->GetPos Z"self"->SetPos X pX"self"->SetPos Y pY"self"->SetPos Z pZ


Now, that can't take care of rotation, but rotation doesn't work (right) on NPCs (sometimes). You might be able to use "self"->Position or PositionCell to do it with rotation. You'll need to equip riding pants.
That also assumes the center of the horse, for positioning and rotation, is directly under the saddle. If it's set further forward or back, you'll need to involve trig to place the PC in the right spot.
User avatar
Helen Quill
 
Posts: 3334
Joined: Fri Oct 13, 2006 1:12 pm

Post » Fri May 27, 2011 11:12 am

That’s very interesting, Peachykeen!

:)
User avatar
XPidgex Jefferson
 
Posts: 3398
Joined: Fri Sep 08, 2006 4:39 pm

Post » Fri May 27, 2011 4:53 pm

Thanks Pk!
User avatar
Laura Samson
 
Posts: 3337
Joined: Wed Aug 29, 2007 6:36 pm


Return to III - Morrowind