Forum rules - please read before posting.

Action(s) Request: Player Walk Speed, Player Run Speed.

edited August 2014 in Engine development
I've looked thoroughly and I am almost certain that I cannot do this from an Action List currently, What I'm requesting is to addon these actions:

Player  walkSpeedScale  Var
Player  runSpeedScale    Var
Player InstantVelocity/MovementSpeed Var (I'm not sure if this one exists now, but basically I want to change the players movement from 10 to 2 immediately as if some super brakes kicked in :)

To be able to change from an action, that way I can call upon my desired action at anytime whether I want to restore the speed to a default factor or change it to something else.

Thanks

Comments

  • You can already: use the Character: Animate Action, and set the method to Set Standard.  Selecting either Walk or Run will let you change the speed.
  • Ahhhh,

    wonderful, I for some reason had Character Animate unchecked from Action List, 

    can you please explain a little bit more,

    image
    image

    What exactly will change move speed float, the Speed float in animator ? (not sure why it says new parameter name? )

    "Selecting either Walk or Run will let you change the speed." I do not have currently options like that in Animate, perhaps because I'm suing the new move to cursor system that you updated for me ( thanks again ),

    I tried looking into the set constraint to walk enabled, run enabled, i thought maybe there you could change their speed but I couldn't find that.
  • Seems the option is missing for Mecanim characters.  I'll add it in 1.38 - thanks for the alert.

    "Parameter name" refers to the Mecanim variable that AC will update with the character's speed.  This is useful if you want to play a different walk animation, for example.
  • ah okay lovely I shall wait for the update,

    thanks Chris, sorry this is off topic but can I be expecting on the next update (for the new walking system) to move to cursor without the need of holding it down, either only on click/touch and or hold.... or if you can give me an idea of when it could be possible to get that option available.

    thanks a lot much appreciated.
  • That was already added!  Look for the Single-click works too? checkbox under Movement settings in the Settings Manager.
  • I really dont mean to be a pain... but I really looked thoroughly and could not find that option, the movement method I am using is Straight To Cursor,

    after under the Movement settings I do not get that option Single-Click... 

    I dont mean to be a pain about this, but perhaps it is a bug? I am currently on version:  1.37a

    please let me know if you need me to provide screenshots if for some reason you see it and I do not...
  • Not at all: there's a bug, and your questions helped me find it.  Seems the option doesn't display when your Input method is set to Touch Screen.  I'm assuming this is why it's not showing up for you.

    Luckily, this is only a visibility issue.  I'll have a fix in 1.38, but in the meantime you can simply change your Input method to Mouse And Keyboard, check the option, then change back to Touch Screen.  The option won't be visible, but it'll still be checked.
  • Thank you very much,

    however there is a problem still... I tried swapping to keyboard and mouse that option does show up, and i even tested the game with the option selected, for some reason when I click elsewhere the character turns that way, but it does not walk/run to the point clicked.

    Must have some other bug as well... unless I'm doing something wrong but I have meshes and I'd assume it will walk/run straight to the point clicked.

    Please let me know what I'm missing or if its another bug.

    thanks 
  • edited August 2014
    Ah i see,

    I have to double click to get it moving , can this be changed to single click? (and it still doesn't work only about 1 out of 100 clicks or more it worked and i get errors such as ) :

    NullReferenceException: Object reference not set to an instance of an object
    AC.Char.SetPath (.Paths pathOb) (at Assets/AdventureCreator/Scripts/Character/Char.cs:904)
    ActionPlayerLock.Run () (at Assets/AdventureCreator/Scripts/Actions/ActionPlayerLock.cs:113)
    AC.ActionList+<RunAction>c__Iterator2.MoveNext () (at Assets/AdventureCreator/Scripts/ActionList/ActionList.cs:192)
    UnityEngine.MonoBehaviour:StartCoroutine(String, Object)
    AC.ActionList:ProcessAction(Int32) (at Assets/AdventureCreator/Scripts/ActionList/ActionList.cs:164)
    AC.ActionList:BeginActionList(Int32) (at Assets/AdventureCreator/Scripts/ActionList/ActionList.cs:142)
    AC.ActionList:Interact() (at Assets/AdventureCreator/Scripts/ActionList/ActionList.cs:111)
    ActionRunActionList:Run() (at Assets/AdventureCreator/Scripts/Actions/ActionRunActionList.cs:82)
    AC.<RunAction>c__Iterator2:MoveNext() (at Assets/AdventureCreator/Scripts/ActionList/ActionList.cs:192)
    UnityEngine.MonoBehaviour:StartCoroutine(String, Object)
    AC.ActionList:ProcessAction(Int32) (at Assets/AdventureCreator/Scripts/ActionList/ActionList.cs:164)
    AC.ActionList:BeginActionList(Int32) (at Assets/AdventureCreator/Scripts/ActionList/ActionList.cs:142)
    AC.ActionList:Interact() (at Assets/AdventureCreator/Scripts/ActionList/ActionList.cs:111)
    AC_Trigger:Interact() (at Assets/AdventureCreator/Scripts/Logic/AC_Trigger.cs:33)
    AC_Trigger:OnTriggerExit(Collider) (at Assets/AdventureCreator/Scripts/Logic/AC_Trigger.cs:97)

    there was another one but i cant get it again... i'll keep trying 

    edit; So i build the game for iOS and tested it on there, for some reason i cannot just touch anywhere on the screen it has to be very close to the middle for the player to move, could the run/walk threshold have something to do with it ? i cant even click on the "menu" top right corner it doesnt open... I have the walk as 3 and run as 4, that way it's mainly running unless very near by the character is clicked to walk...
  • edited August 2014
    Sorry to bother here so much... another update,

    after I placed the terrain as Trigger only things changed a bit, ( i have an invisible terrain so that the player can touch anywhere on the map, and other platforms where it actually walks on the levels.. ) I just made the terrain as trigger,

    and I get this error:

    NullReferenceException: Object reference not set to an instance of an object
    AC.Char.SetPath (.Paths pathOb) (at Assets/AdventureCreator/Scripts/Character/Char.cs:904)
    ActionPlayerLock.Run () (at Assets/AdventureCreator/Scripts/Actions/ActionPlayerLock.cs:113)
    AC.ActionList+<RunAction>c__Iterator2.MoveNext () (at Assets/AdventureCreator/Scripts/ActionList/ActionList.cs:192)
    UnityEngine.MonoBehaviour:StartCoroutine(String, Object)
    AC.ActionList:ProcessAction(Int32) (at Assets/AdventureCreator/Scripts/ActionList/ActionList.cs:164)
    AC.ActionList:BeginActionList(Int32) (at Assets/AdventureCreator/Scripts/ActionList/ActionList.cs:142)
    AC.ActionList:Interact() (at Assets/AdventureCreator/Scripts/ActionList/ActionList.cs:111)
    ActionRunActionList:Run() (at Assets/AdventureCreator/Scripts/Actions/ActionRunActionList.cs:82)
    AC.<RunAction>c__Iterator2:MoveNext() (at Assets/AdventureCreator/Scripts/ActionList/ActionList.cs:192)
    UnityEngine.MonoBehaviour:StartCoroutine(String, Object)
    AC.ActionList:ProcessAction(Int32) (at Assets/AdventureCreator/Scripts/ActionList/ActionList.cs:164)
    AC.ActionList:BeginActionList(Int32) (at Assets/AdventureCreator/Scripts/ActionList/ActionList.cs:142)
    AC.ActionList:Interact() (at Assets/AdventureCreator/Scripts/ActionList/ActionList.cs:111)
    AC_Trigger:Interact() (at Assets/AdventureCreator/Scripts/Logic/AC_Trigger.cs:33)
    AC_Trigger:OnTriggerExit(Collider) (at Assets/AdventureCreator/Scripts/Logic/AC_Trigger.cs:97)

    After I get that error the player will not move further.

    I'm going to build this for iOS now again with the new changes and see how it reacts.

    update: So I tried multiply times different ways of doing this ( currently no stripping level) but if i "touch" to a place now on the phone (no matter whether its left below right anywhere on the map) the character will go "straight in a straight line", if i touch and hold however it almost works 100% the way it should, sometimes it glitches when the touch is near by the player and especially after the player dies and gets teleported back to the beginning of the level the "touch" and hold no longer works the same way it thinks for example if i touch and hold above the character to move forward in a straight line it literally turns backward... and mainly does circles as if i'm moving the touch behind the player etc. 

    i really have no idea why this is happening it works great in unity.

    It's almost as if the "cursor" that the iOS dont have is moved and when you try to press on the screen it remembers the previous position of it and its all messed up
  • This is getting far too complicated, without enough explanation as to how your scene is specifically set up.  Please post some screenshots to better explain the problem.  A short video would be even better.
  • Hey Chris, sorry I've been away for a little bit, anyways I did one better I made a project backup and tried to minimize it as much as i could, anyways I've sent you a PM with the project link if you could be so kind and be hands on with it, I believe it will be better than looking at a video to pin point things as I really don't see how my project could be an issue, I do strongly believe it is something with AC, I hope otherwise I'd be lost... as the movement takes place in AC and really other assets don't have much input but "add on" things to the screen as eye candy. 

    It doesn't work for me as iOS see if it does for you, settings should all be the same except i've removed all the enemies on the scene and other things , just need the walk/running system working...

    thanks so much!
  • Hello,

    I know it's a very old post but maybe someone might need an action to change the character's walk speed scale from ActionList.

    Just name it: ActionCharChangeSpeed.cs

    namespace AC
    {

    [System.Serializable]
    public class ActionCharChangeSpeed : Action
    {

    public int parameterID = -1;
    public int constantID = 0;
    public bool isPlayer;
    public Char animChar;
    public float speed;


    public ActionCharChangeSpeed()
    {
    this.isDisplayed = true;
    category = ActionCategory.Character;
    title = "Change Speed";
    description = "Change the Walk Speed of the character.";
    }


    override public void AssignValues (List parameters)
    {
    animChar = AssignFile(parameters, parameterID, constantID, animChar);
    speed = AssignFloat(parameters, parameterID, speed);

    if (isPlayer) {
    animChar = KickStarter.player;
    }
    }


    override public float Run ()
    {
    if(animChar) {
    if (isPlayer) {
    animChar.GetComponent().walkSpeedScale = speed;
    } else {
    animChar.walkSpeedScale = speed;
    }
    }

    return 0f;
    }


    #if UNITY_EDITOR

    override public void ShowGUI (List parameters)
    {
    isPlayer = EditorGUILayout.Toggle("Is Player?", isPlayer);
    if (isPlayer) {
    if (Application.isPlaying) {
    animChar = KickStarter.player;
    }
    else if (AdvGame.GetReferences().settingsManager) {
    animChar = AdvGame.GetReferences().settingsManager.GetDefaultPlayer();
    }
    }
    else {
    parameterID = Action.ChooseParameterGUI("Character:", parameters, parameterID, ParameterType.GameObject);
    if (parameterID >= 0) {
    constantID = 0;
    animChar = null;
    }
    else {
    animChar = (Char)EditorGUILayout.ObjectField("Character:", animChar, typeof(Char), true);

    constantID = FieldToID(animChar, constantID);
    animChar = IDToField(animChar, constantID, true);
    }
    }

    speed = EditorGUILayout.FloatField("Speed for Walk:", speed);

    AfterRunningOption ();
    }

    #endif

    }

    }
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.