The Jumping Problem

Post » Fri May 13, 2011 11:41 am

I'm in the process of making a power armor overhaul that includes a number of upgrades, including reducing fall damage and increasing jump height. But of course the whole jumping mechanic had to change when the engine was updated from Oblivion, so if you increase fjumpheightmin above about 100 (the default being 64) your character will seem to land on an invisible ledge on the way back down, halting for a second or two before starting to fall again. Even if you stay below this value, jumping off of something will bring up the ledge if you're falling far enough. I've searched around and it doesn't look like anyone's found a way around this. I've heard that the jump animation is timed or something, and your fall ends when time is up, causing that mid-air pause. One thing I have noticed, though, is that if you just walk off of something, rather than jumping, your fall will be smooth and ledge-less regardless of how high it is. Has anybody looked into somehow tricking the engine into thinking you're just falling? You can measure z-velocity using getpos, so maybe it would be possible to trigger some kind of animation change, or temporarily make it think you've landed, when it's about equal to zero (meaning you're at the highest point in your jump). Any help or suggestions of stuff I could try would be appreciated.
User avatar
Nauty
 
Posts: 3410
Joined: Wed Jan 24, 2007 6:58 pm

Post » Fri May 13, 2011 3:22 pm

Try calling player.setscale 1 every frame while they are falling.
User avatar
Czar Kahchi
 
Posts: 3306
Joined: Mon Jul 30, 2007 11:56 am

Post » Fri May 13, 2011 6:06 pm

If that works, how would I detect the fall? I could start a timer every time they hit the jump key, and do the setscale for the next ten seconds or so, or maybe just check to see which animation is playing. Do you know another way? I ask because it would also help me with the sound synching in my liberty prime mod if I could differentiate between the player being on the ground or airborne. I notice you were able to prevent the player from clipping through the ground with the jetpack mod.

*Edit - Lol, as a quick test I made a quest script that called setscale every 1/10th of a second. It does remove the interruption in the fall, but it also resets your fall speed. It would make for a great parachute effect.
User avatar
Josee Leach
 
Posts: 3371
Joined: Tue Dec 26, 2006 10:50 pm

Post » Fri May 13, 2011 1:08 pm

Well clipping through the ground is sort of stopped at the LOD mesh. I say sort of because the player model keeps getting drawn as resting on the LOD mesh, but getpos z will indicate the player is still losing height if you continue to set his position lower.

In your case though I think calling setscale 1 for the whole process, or using getpos z to determine the point he starts falling then setting his scale for the fall time would work fine.

You can use getpos z to tell when he hits the ground, if for a frame it is no longer decreasing, then stop calling setscale at that point. A normally falling player will stop at the ground, not fall to the LOD mesh.

There is a function for OBSE something like isonground, but it's kind of hit and miss unless the player is standing still.

Hope this helps some, I pretty sure this can be pulled off without too much trouble. I assume you are calling resetfalldamagetimer, or are you setting it up so that they still take some damage in big falls?

Edit: Ya I forgot about the effect of setscale also resetting the velocity, that's exactly why I used it for the jetpack to stop that annoying jumping in mid air lol.

Maybe try calling setrestrained 1 at the apex.
User avatar
Imy Davies
 
Posts: 3479
Joined: Fri Jul 14, 2006 6:42 pm

Post » Fri May 13, 2011 6:40 pm

At the moment I'm increasing fJumpFallHeightMin, but resetfalldamagetimer would be better from a compatibility standpoint, so I may change back. I could even keep track of the number of the amount of time fallen, and damage the player proportionally once they hit, without messing up compatibility. The setscale trick doesn't seem to work though, unless there's really a difference between calling it every frame and calling it every 0.1 seconds. The player's fall speed gets reset to zero every time setscale is called, so you fall at a very slow, constant rate, rather than accelerating until you hit the ground. I'm a couple of minutes away from trying out my temporary landing idea, so I'll post once I see how that works out.
User avatar
Marta Wolko
 
Posts: 3383
Joined: Mon Aug 28, 2006 6:51 am

Post » Fri May 13, 2011 11:17 am

I haven't tried this myself, but forcing a new animation on the player using the castimmediatelyonself command like a few of the vehicle mods do might be enough to clear what data is stored when the player falls after playing the jump animation.
User avatar
Elea Rossi
 
Posts: 3554
Joined: Tue Mar 27, 2007 1:39 am

Post » Fri May 13, 2011 9:12 am

My fix seems to work. :dance: I've got two quests running, each with a 0.05s quest delay. The JumpFallFixInit quest is "start game enabled". The JumpFallFix quest is triggered by the JumpFallFixInit quest when the player presses the "jump" control key.

Here's the code if someone wants to try it out:

scn PPAJumpFallFixInitQuestScriptbegin gamemode	IF getquestrunning PPAJumpFallFix	ELSE		IF iscontrolpressed 12			startquest PPAJumpFallFix		ENDif	ENDifend


scn PPAJumpFallFixQuestScriptfloat fZVelfloat fZPosfloat fZPosLastshort sInitref rLandingshort sLandCountbegin gamemode		IF sLandCount		IF sLandCount < 3			set sLandCount to sLandCount + 1			return		ELSE			set sLandCount to 0			set sInit to 0			rLanding.disable			rLanding.markfordelete			stopquest PPAJumpFallFix		ENDif	ELSE		IF sInit			set fZPos to player.getpos Z			set fZVel to fZPos - fZPosLast                        set fZPosLast to fZPos				IF (fZVel < 0 && sLandCount == 0)				set rLanding to player.placeatme PPALandingMesh				set sLandCount to 1			ENDif		ELSE			set fZPosLast to -10000000			set sInit to 1		ENDif	ENDifend


The PPALandingMesh item is a static mesh that's basically just a renamed base from the baseball diamond. I was planning on tweaking the model to give it near-zero thickness and a transparent texture, but it exists for so few frames that you can't see it. If anyone can repeat this to verify it works... try jumping off of stuff...

*Edit - Limited success actually. Unless you are running forward, you will stop at the top of your jump as if the invisible baseball diamond is still there. I'll try using setpos to lower you a bit at that point to see if that helps. This script can be used as a starting place though for trying out the animation change idea (but requires FOSE).
User avatar
alicia hillier
 
Posts: 3387
Joined: Tue Feb 06, 2007 2:57 am

Post » Fri May 13, 2011 5:40 am

Maybe tapcontrol to make the player move forward for a few frames when the mesh is placed?
User avatar
Justin Bywater
 
Posts: 3264
Joined: Tue Sep 11, 2007 10:44 pm

Post » Fri May 13, 2011 6:53 pm

I got it resolved. It was a weird coincidence where I left out a line of code that prevented my fix from ever happening, plus the increased jump height I was using for the test just happened be timed just perfect so that the invisible ledge issue popped up right after the top of your jump. After fixing that, the fix works as expected. There's a slight hiccup as the player goes from the knees-raised pose used for the jump animation loop to the standing pose that signifies you've landed, but its not very noticeable in 1st person. It does look slightly out of place in third person, but not too bad.

*Edit - http://www.fallout3nexus.com/imageshare/images/1250436-1277420614.jpg
User avatar
Mrs Pooh
 
Posts: 3340
Joined: Wed Oct 24, 2007 7:30 pm


Return to Fallout 3