1 (edited by FreedTerror 2021-12-01 21:06:17)

Topic: Cancel Move When Landing With Move File Results

A while back @MrPonton posted some code to use a movefile on cancel move on landing http://www.ufe3d.com/forum/viewtopic.php?id=2751

I just wanted to make a new thread to show the results of said code.

The Code:

In PhysicsScript.cs change this

if (moveSetScript.basicMoves.landing.animMap[0].clip != null
                            && (controlScript.currentMove == null ||
                            (controlScript.currentMove != null && controlScript.currentMove.cancelMoveWheLanding)))
                        {

                            controlScript.isAirRecovering = false;
                            airAnimation = moveSetScript.basicMoves.landing;
                            moveDirection = 0;
                            horizontalJumpForce = 0;
                            isLanding = true;
                            controlScript.KillCurrentMove();
                            delayTime = (Fix64)controlScript.myInfo.physics.landingDelay / (Fix64)UFE.Config.fps;
                            UFE.DelaySynchronizedAction(ResetLanding, delayTime);

                            if (airAnimation.autoSpeed)
                            {
                                animationSpeed = moveSetScript.GetAnimationLength(airAnimation.name) / delayTime;
                            }
                        }

to this

if (moveSetScript.basicMoves.landing.animMap[0].clip != null
                        && (controlScript.currentMove == null ||
                        (controlScript.currentMove != null && controlScript.currentMove.cancelMoveWheLanding))){

                        if (controlScript.currentMove.cancelMoveWheLanding && controlScript.currentMove.moveToCancelLanding != null)
                        {
                            controlScript.CastMove(controlScript.currentMove.moveToCancelLanding, true);
                        }
                        else
                        {
                            controlScript.isAirRecovering = false;
                            airAnimation = moveSetScript.basicMoves.landing;
                            moveDirection = 0;
                            horizontalJumpForce = 0;
                            isLanding = true;
                            controlScript.KillCurrentMove();
                            delayTime = (Fix64)controlScript.myInfo.physics.landingDelay / (Fix64)UFE.config.fps;
                            UFE.DelaySynchronizedAction(ResetLanding, delayTime);
                        }

                        if (airAnimation.autoSpeed) {
                            animationSpeed = moveSetScript.GetAnimationLength(airAnimation.name) / delayTime;
                        }

In MoveEditorWindow.cs change this

 moveInfo.cancelMoveWheLanding = EditorGUILayout.Toggle("Cancel Move On Landing", moveInfo.cancelMoveWheLanding, toggleStyle);

to this

 moveInfo.cancelMoveWheLanding = EditorGUILayout.Toggle("Cancel Move On Landing", moveInfo.cancelMoveWheLanding, toggleStyle);
                            if (moveInfo.cancelMoveWheLanding) {
                                moveInfo.moveToCancelLanding = (MoveInfo)EditorGUILayout.ObjectField("Move To Cancel Into:", moveInfo.moveToCancelLanding, typeof(MoveInfo), false);
                            }

In MoveInfo.cs find this

public bool cancelMoveWheLanding;

add this under it

public MoveInfo moveToCancelLanding;

Result:
you'll see this in the move editor now
https://i.imgur.com/VLR1QmA.png

Good news is it does work
https://i.imgur.com/TtCS8J0.gif

Bad news is we do get some errors
This happens when a normal landing occurs
https://i.imgur.com/CDD00nY.gif

errors in console
https://i.imgur.com/HkyOlaz.png
https://i.imgur.com/dbC8LUz.png

Hopefully this will help @mistermind at getting this feature implemented!

Share

Thumbs up +2 Thumbs down

2 (edited by Starcutter 2022-01-04 22:08:44)

Re: Cancel Move When Landing With Move File Results

I got it to work perfectly! To fix the errors you were getting, I changed your code in PhysicsScript to the following:

if (moveSetScript.basicMoves.landing.animMap[0].clip != null){
                        if (controlScript.currentMove != null && controlScript.currentMove.cancelMoveWheLanding)
                        {
                            if (controlScript.currentMove.cancelMoveWheLanding && controlScript.currentMove.moveToCancelLanding != null)
                            {
                                controlScript.CastMove(controlScript.currentMove.moveToCancelLanding, true);
                            }
                            else
                            {
                                controlScript.isAirRecovering = false;
                                airAnimation = moveSetScript.basicMoves.landing;
                                moveDirection = 0;
                                horizontalJumpForce = 0;
                                isLanding = true;
                                controlScript.KillCurrentMove();
                                delayTime = (Fix64)controlScript.myInfo.physics.landingDelay / (Fix64)UFE.config.fps;
                                UFE.DelaySynchronizedAction(ResetLanding, delayTime);

                                if (airAnimation.autoSpeed)
                                {
                                    animationSpeed = moveSetScript.GetAnimationLength(airAnimation.name) / delayTime;
                                }
                            }
                        }

                        if(controlScript.currentMove == null)
                        {
                            controlScript.isAirRecovering = false;
                            airAnimation = moveSetScript.basicMoves.landing;
                            moveDirection = 0;
                            horizontalJumpForce = 0;
                            isLanding = true;
                            controlScript.KillCurrentMove();
                            delayTime = (Fix64)controlScript.myInfo.physics.landingDelay / (Fix64)UFE.config.fps;
                            UFE.DelaySynchronizedAction(ResetLanding, delayTime);

                            if (airAnimation.autoSpeed)
                            {
                                animationSpeed = moveSetScript.GetAnimationLength(airAnimation.name) / delayTime;
                            }
                        }

                        
                    }

That should fix the issue with regular landing, it did for me!

Share

Thumbs up +1 Thumbs down

Re: Cancel Move When Landing With Move File Results

I'll have to try this sometime thanks for the code.

Share

Thumbs up Thumbs down