Forum rules - please read before posting.

Change the height of the jump

Is there a way to change the jump speed value of the movement setting using the action list etc.? And is it possible to set the value of jump speed to 10 or more?

Comments

  • What value are you looking to change it to, if over 10?

    The height of a jump is determined not just the jump speed, but also the properties of the character's Rigidbody - i.e. mass, etc.

    To change the value of any Manager property through script, right-click it's label to copy an API reference to it. In the case of the jump speed, it's:

    AC.KickStarter.settingsManager.jumpSpeed
    

    You can place this in a custom script function to set it as desired:

    public float newJumpSpeed = 15f;
    
    public void SetJumpSpeed ()
    {
        AC.KickStarter.settingsManager.jumpSpeed = newJumpSpeed;
    }
    

    This function (SetJumpSpeed) can then be triggered by using the Object: Send message Action to send a custom message with the same name.

  • edited May 2020

    Jump Speed I think I'll probably be about 20 because I want to intentionally implement a glitch like the one in the second minute of this video.
    Where is the custom script function?
    https://adventurecreator.org/tutorials/writing-custom-action
    Should I duplicate the template as in this tutorial?
    I'm sorry if my English is hard to understand.

  • You don't need to write a custom Action - using a custom script function avoids you having to do that.

    Create a new C# script and place the code above inside it. So if your script is named e.g. UpdateJumpSpeed.cs, it would look like this:

    using UnityEngine;
    using AC;
    
    public class UpdateJumpSpeed : MonoBehaviour
    {
    
        public float newJumpSpeed = 15f;
    
        public void SetJumpSpeed ()
        {
            AC.KickStarter.settingsManager.jumpSpeed = newJumpSpeed;
        }
    
    }
    

    Attatch it to an empty GameObject, then make it a prefab and remove from the scene.

    You can then use the Object: Send message or Object: Call event Action to trigger the "SetJumpSpeed" function by assigning the prefab in the Action's object field.

  • I made a script according to the procedure, made the attached object prefab, deleted it from the scene, created a trigger with send message, but it did not work.
    unity version is 2019.3.4
    AC is 1.70.4
    https://ibb.co/cCQNW5K

  • Every time I trigger, I get an error.
    SendMessage TurnOn has no receiver!
    UnityEngine.GameObject: SendMessage (String)

  • edited May 2020

    You need to specify the "SetJumpSpeed" function - not "Turn On".

    Set the Action's Message to send field to Custom, then the Method name to SetJumpSpeed.

    Alternatively, use the Object: Call event Action to select the function directly.

  • It worked. I really appreciate it.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.