Invoke a jump from a script

Scytheria23

New member
Hi all. I've been away from the forum for a few weeks, but all that means is that things are going well with my Opsive systems and I haven't had a serious problem for a while. Now, of course, I have one... ;)

This is the kind of problem where I have an idea for a hacky solution, but lack the knowledge to implement it. Essentially, I need to be able to force the player to jump from within a non-Opsive script (more detail under the line below, which may prompt a better solution). I can't use triggers or raycasts or any such devices, it needs to be 'called' from within the code. Essentially this:

if (this happens) FORCEPLAYERTOJUMPONCE;

Any help vastly appreciated!
Scy

----------------------

So, the details. I'm using the Horse Animset Pro integration, which has so far been very successful (although there was a lot of swearing). One thing I've just discovered though is that when the player has finished riding around and dismounts a few of his Opsive abilities are messed up, possibly retaining some info from the riding action. Crawl, for example, occurs at running speed (possibly the horse's speed). Roll no longer moves the character forwards (he 'rolls' on the spot). All of these issues, however, clear up as soon as the player jumps. It could be something to do with grounding? Hence my solution, which is to invoke a small jump on dismount. A better solution, of course, would be to figure out why the HAP integration is failing to completely remove everything on a dismount.
 
Solved. Needed to add two lines to the Ride HAP integration script:

protected override void AbilityStopped(bool force)
{
base.AbilityStopped(force);
m_CharacterLocomotion.UpdateLocation = m_StartUpdateLocation;
m_CharacterLocomotion.AbilityMotor = Vector3.zero;
m_CharacterLocomotion.SetPositionAndRotation(m_Rider.MountPosition, m_Rider.MountRotation, false);
m_CharacterLocomotion.AllowRootMotionRotation = true;
m_CharacterLocomotion.AllowRootMotionPosition = true;

}

Easy fix, nothing hacky.

Scy
 
Top