Results 1 to 33 of 33
  1. #1
    Veteran
    Join Date
    May 2007
    Location
    Above KillZ, Below StallZ
    Posts
    9,953

    Default How to use existing walk/run (sprint/run sprint/walk whatever)

    YourPawn:

    PHP Code:
    // This uses the Pawn version of SetWalking instead of UTPawn
    event SetWalkingbool bNewIsWalking )
    {
        
    super(Pawn).SetWalking(bNewIsWalking);

    If you want to reverse the control, so that you Walk by default instead of run by default, in YourPlayerController:

    PHP Code:
    // inverse the default meaning of the Run button
    function HandleWalking()
    {
        if ( 
    Pawn != None )
            
    Pawn.SetWalkingbRun == );

    Now, in YourPawn's defaultproperties, you set GroundSpeed= to the maximum run speed, and you set WalkingPct= a floating point percentage (between 0.00 and 1.00) that will be percent of the groundspeed that is used when walking.

    You may also want to set bCanWalkOffLedges=True otherwise when walking, you will not be able to fall off ledges with drops larger than small stairs.
    Last edited by Blade[UG]; 04-25-2011 at 04:38 PM.
    http://www.ericbla.de http://www.dungeondefenders.com http://en.wikipedia.org/wiki/Warm_Gun http://www.rekoil.com http://www.groundbranch.com

    - Please don't send me private messages asking programming questions, those would be better asked on the Programming forum here. Thanks

  2. #2
    MSgt. Shooter Person
    Join Date
    Aug 2010
    Posts
    467

    Default

    Cool. Thanks for this.
    Basic Parkour Obstacle Course: Link here Second Link Here

    My Youtube page: http://www.youtube.com/kinos141

  3. #3
    Redeemer
    Join Date
    Nov 2009
    Location
    Caracas
    Posts
    1,646
    Gamer IDs

    Gamertag: daimakupikoro PSN ID: lone_vampire

    Default

    thanks Blade[UG], good information !!
    http://vincenzoravo.vrs.com.ve http://www.slaughtermaze.com

    please don't fill my inbox with questions, ask in the forum, the answers will help you and others !!!

  4. #4

    Default

    Quote Originally Posted by Blade[UG] View Post
    YourPawn:

    PHP Code:
    // This uses the Pawn version of SetWalking instead of UTPawn
    event SetWalkingbool bNewIsWalking )
    {
        
    super(Pawn).SetWalking(bNewIsWalking);

    Can I ask what to put in Bindings for Shift key as the command and onrelease?
    Command=Setwalking ... perhaps. But what would change it back?
    Last edited by tomacmuni; 04-23-2011 at 04:22 AM.

  5. #5
    Redeemer
    Join Date
    Nov 2009
    Location
    Help-me!
    Posts
    1,256

    Default

    I can't understand this, by setting bRun in player controller to 1 the pawn will start walking...

    What kind of logic is that?
    (I understand the code, I just wanna know why it's inversed)
    Lead Programmer
    It's the Only NEET Thing to Do

    Programming for non-fiction.
    I'm the function of my code. Conditions are my body and calls are my blood. I have input over a thousand lines. Unknown of bugs, nor known to work. Have withstand coffee to create many programs. Yet, those hands will never code anything again. So, as I pray, Unlimited Code Works.

  6. #6
    Veteran
    Join Date
    May 2007
    Location
    Above KillZ, Below StallZ
    Posts
    9,953

    Default

    tomacmuni: by default, it's already bound.
    PHP Code:
    Bindings=(Name="LeftShift",Command="Walking"
    Saishy: SetWalking wants a True (Walking)/False (Running). The default HandleWalking defines the regular state (bRun == 0) to be running, and button down to be walking. Seems most games these days want the other way.
    http://www.ericbla.de http://www.dungeondefenders.com http://en.wikipedia.org/wiki/Warm_Gun http://www.rekoil.com http://www.groundbranch.com

    - Please don't send me private messages asking programming questions, those would be better asked on the Programming forum here. Thanks

  7. #7
    MSgt. Shooter Person
    Join Date
    Mar 2010
    Location
    Denmark
    Posts
    44

    Default

    Awesome. Implemented and works like a charm. Thanks, Blade.

  8. #8

    Default Tried it, but..

    Quote Originally Posted by Blade[UG] View Post
    tomacmuni: by default, it's already bound.
    PHP Code:
    Bindings=(Name="LeftShift",Command="Walking"
    Thanks Blade for the help ... i'm still having troubles.
    I put the line above into DefaultInput.ini (right? plus a little . in front of it)
    and used a groundspeed of 300 and a walk percentage of .33 in Mypawn, plus the event code you provided.
    When PIE I can't see any change in speed, and the log doesn't report
    shift being pressed.

  9. #9
    Veteran
    Join Date
    May 2007
    Location
    Above KillZ, Below StallZ
    Posts
    9,953

    Default

    No, you don't put that in DefaultInput, it's already there (or maybe it's in BaseInput)

    Is your game using your playercontroller and pawn?
    http://www.ericbla.de http://www.dungeondefenders.com http://en.wikipedia.org/wiki/Warm_Gun http://www.rekoil.com http://www.groundbranch.com

    - Please don't send me private messages asking programming questions, those would be better asked on the Programming forum here. Thanks

  10. #10

    Default

    Hmm, how do I check for sure that mypawn and myplayercontroller are being used?
    I have the +ModEditPackages=MyGame in DefaultEngine.ini
    Admittedly, when I do behindview with Tab I see the robot mesh not my own player mesh... so it looks like I may have missed something. Maybe my gameinfo is mucked up switching over to April version... but I'm not sure how to check really.

    [Edit: oops, that was UTPlayerReplicationInfo.uc that I didn't specify my own familyinfo -- I always forget to swap it... so now I see my player. She
    isn't running/walking though... so back to square one for me... sigh, 1AM.]
    Last edited by tomacmuni; 04-25-2011 at 01:10 PM.

  11. #11
    Veteran
    Join Date
    May 2007
    Location
    Above KillZ, Below StallZ
    Posts
    9,953

    Default

    BasicGameQuickStart


    and check in your log.
    http://www.ericbla.de http://www.dungeondefenders.com http://en.wikipedia.org/wiki/Warm_Gun http://www.rekoil.com http://www.groundbranch.com

    - Please don't send me private messages asking programming questions, those would be better asked on the Programming forum here. Thanks

  12. #12
    MSgt. Shooter Person
    Join Date
    Mar 2011
    Location
    Brisbane, Australia
    Posts
    46

    Default

    Hey Blade, I think to invert the shift button
    Code:
    Pawn.SetWalking( bRun != 0 );
    should have bRun != 1
    or bRun == 0

  13. #13
    Veteran
    Join Date
    May 2007
    Location
    Above KillZ, Below StallZ
    Posts
    9,953

    Default

    oops, you're right. I copied from PlayerController rather than the derived class. oops! lol fixed it
    http://www.ericbla.de http://www.dungeondefenders.com http://en.wikipedia.org/wiki/Warm_Gun http://www.rekoil.com http://www.groundbranch.com

    - Please don't send me private messages asking programming questions, those would be better asked on the Programming forum here. Thanks

  14. #14

    Default

    Left out of all steps I've ever come across for all these sprint/walk advices... in the PIE settings under View menu>World Properties>Game Type For PIE = MyGame (if it's not set then none of the above works in PIE though it probably does under Console or after cooking I guess but I never made it that far since it weren't workin' it seemed like). I set the default properties also in MyGame.uc to include, under the line: PlayerControllerClass=class'MyGame.MyPlayerControl ler' the additional line I spotted on a UDN page:
    DefaultPawnClass=class'MyGame.MyPawn' ... funny I missed it, but not sure how relevant it is to this problem.

    Now I am getting the Sinsal keystroke sprint/walk speed change.
    The Blade[UG] one using walkpct doesn't seem to be kicking in, but anyway, 1 out of 2 is still a pass.
    Last edited by tomacmuni; 04-26-2011 at 10:22 AM.

  15. #15
    Veteran
    Join Date
    May 2007
    Location
    Above KillZ, Below StallZ
    Posts
    9,953

    Default

    If you haven't completed even the most basic steps to getting your code to work, you're going to be frustrated no matter what you do.

    How isn't setting up the proper pawn relevant? This requires changes to both your Pawn and PlayerController, if you're extending UT classes.
    http://www.ericbla.de http://www.dungeondefenders.com http://en.wikipedia.org/wiki/Warm_Gun http://www.rekoil.com http://www.groundbranch.com

    - Please don't send me private messages asking programming questions, those would be better asked on the Programming forum here. Thanks

  16. #16
    Redeemer
    Join Date
    Nov 2009
    Location
    Help-me!
    Posts
    1,256

    Default

    Quote Originally Posted by Blade[UG] View Post
    oops, you're right. I copied from PlayerController rather than the derived class. oops! lol fixed it
    That explains everything.
    Lead Programmer
    It's the Only NEET Thing to Do

    Programming for non-fiction.
    I'm the function of my code. Conditions are my body and calls are my blood. I have input over a thousand lines. Unknown of bugs, nor known to work. Have withstand coffee to create many programs. Yet, those hands will never code anything again. So, as I pray, Unlimited Code Works.

  17. #17
    MSgt. Shooter Person
    Join Date
    Jul 2011
    Posts
    38

    Default

    Thanks Blade, I was wondering why WalkingPct didn't do anything.
    But it's more than a myracle to me how this works becuase i fail to trace it back to the root.
    I try to toggle my leftThumbstick, so the player keeps running until "something" happens.
    I don't want to write a new function when one line of code would change this, but I crawl through every class and can't find anything. (It's like this function comes out of nothing)

  18. #18
    Veteran
    Join Date
    May 2007
    Location
    Above KillZ, Below StallZ
    Posts
    9,953

    Default

    what part isn't clear?
    http://www.ericbla.de http://www.dungeondefenders.com http://en.wikipedia.org/wiki/Warm_Gun http://www.rekoil.com http://www.groundbranch.com

    - Please don't send me private messages asking programming questions, those would be better asked on the Programming forum here. Thanks

  19. #19
    MSgt. Shooter Person
    Join Date
    Jul 2011
    Posts
    38

    Default

    well, the event SetWalking, bNewIsWalking and bIsWalking are the only vars i've got and i don't know where they change my GroundSpeed. So i get bad a feeling trying to write a function which toggles my input while in background some other "unknown" function is going to change my GroundSpeed.
    It just confuses me right now.

    (bNewIsWalking changes constantly and makes it hard for me to alter this code)
    Last edited by Luke Codewalker; 07-20-2011 at 04:05 PM.

  20. #20
    MSgt. Shooter Person
    Join Date
    Nov 2009
    Location
    IRAN,IR
    Posts
    117

    Default

    hi
    can anybody write a tutorial for when player pressed left shift character running and when released character walking...
    thank you ,,,,
    Last edited by vahid67; 07-22-2011 at 04:37 AM.

  21. #21
    MSgt. Shooter Person
    Join Date
    Jul 2011
    Posts
    38

    Default

    ok, a friend and i found the culprit which caused (my) bNewIsWalking to change continuously. so no confusion anymore

    therefore i'd like to share the "toggling code"
    Code:
    var        bool    bToggler; 
    
    event SetWalking( bool bNewIsWalking )
    {
        if ( bNewIsWalking != bToggler )
        {
            if( bNewIsWalking )
                bIsWalking = !bIsWalking;
            bToggler = bNewIsWalking;
        }
    }
    or this code if you want to start with running speed
    Code:
    var        bool    bToggler;
    
    event SetWalking( bool bNewIsWalking )
    {
        if ( bNewIsWalking == bToggler )
        {
            if( !bNewIsWalking )
                bIsWalking = !bIsWalking;
            bToggler = !bNewIsWalking;
        }
    }
    hope someone will find it usefull.

    EDIT: but i still don't know where this changes my GroundSpeed and multiplies it with WalkingPct. If someone knows, please response. thanks
    Last edited by Luke Codewalker; 07-21-2011 at 10:15 PM.

  22. #22
    Veteran
    Join Date
    May 2007
    Location
    Above KillZ, Below StallZ
    Posts
    9,953

    Default

    It doesn't change ground speed. Ground speed is the max speed you can go and walking pct is the percent of that that you can go when walking is true
    http://www.ericbla.de http://www.dungeondefenders.com http://en.wikipedia.org/wiki/Warm_Gun http://www.rekoil.com http://www.groundbranch.com

    - Please don't send me private messages asking programming questions, those would be better asked on the Programming forum here. Thanks

  23. #23
    MSgt. Shooter Person
    Join Date
    Nov 2009
    Location
    IRAN,IR
    Posts
    117

    Default

    i found a tutorial and it's worked for me ...

    Here

  24. #24
    Veteran
    Join Date
    May 2007
    Location
    Above KillZ, Below StallZ
    Posts
    9,953

    Default

    Your example code there, Luke, does -exactly- what the original code does, just adding an extra variable to do it. I'd guess you missed something in the OP.
    http://www.ericbla.de http://www.dungeondefenders.com http://en.wikipedia.org/wiki/Warm_Gun http://www.rekoil.com http://www.groundbranch.com

    - Please don't send me private messages asking programming questions, those would be better asked on the Programming forum here. Thanks

  25. #25
    MSgt. Shooter Person
    Join Date
    Jul 2011
    Posts
    38

    Default

    of course blade you are right, as i mentioned before, i don't want to write an extra function if one line of code would do me the favor. i know walkingpct is the percentage of groundspeed, but somewhere it must be processed (and change the velocity) and that's what i'm looking for. (sorry if i didn't make myself clear. what's an OP?)
    greetings
    Last edited by Luke Codewalker; 07-22-2011 at 06:43 AM.

  26. #26
    Veteran
    Join Date
    May 2007
    Location
    Above KillZ, Below StallZ
    Posts
    9,953

    Default

    That's on the native side of PHYS_Walking. OP = original post

    You'd still need the HandleWalking() in the player controller, i'm curious as to what that solves, I don't see it.
    http://www.ericbla.de http://www.dungeondefenders.com http://en.wikipedia.org/wiki/Warm_Gun http://www.rekoil.com http://www.groundbranch.com

    - Please don't send me private messages asking programming questions, those would be better asked on the Programming forum here. Thanks

  27. #27
    Iron Guard
    Join Date
    Feb 2010
    Location
    Iran, Tehran
    Posts
    714

    Default

    thanx Blade[UG]

  28. #28
    MSgt. Shooter Person
    Join Date
    Jul 2011
    Posts
    38

    Default

    @blade, why do i need the HandleWalking()? (it just works fine without or did i miss something?!).
    for PHYS_walking it helps solving my lacks of understanding
    i don't want to change some vars without getting to know how they are applied. it's a personal urge to know what's going on and how it's going on when i change something. hope you'll understand

  29. #29
    Veteran
    Join Date
    May 2007
    Location
    Above KillZ, Below StallZ
    Posts
    9,953

    Default

    Well, here's how it works. Every tick, HandleWalking() is called. That sets Pawn.bIsWalking every tick. In UTPlayerController, HandleWalking forces bIsWalking to be off. So, every tick, you're both setting, and unsetting bIsWalking. And that's why you've had to write it in SetWalking -- the reason you had problems with it, is because you didn't follow directions
    http://www.ericbla.de http://www.dungeondefenders.com http://en.wikipedia.org/wiki/Warm_Gun http://www.rekoil.com http://www.groundbranch.com

    - Please don't send me private messages asking programming questions, those would be better asked on the Programming forum here. Thanks

  30. #30
    MSgt. Shooter Person
    Join Date
    Jul 2011
    Posts
    172

    Default

    i notice that the animation stays the same , legs go same speed in run or walk .

    would i change this using the animtree ? . create a walk node .

    thanks.

  31. #31
    Veteran
    Join Date
    May 2007
    Location
    Above KillZ, Below StallZ
    Posts
    9,953

    Default

    I think most people use a blend by speed.
    http://www.ericbla.de http://www.dungeondefenders.com http://en.wikipedia.org/wiki/Warm_Gun http://www.rekoil.com http://www.groundbranch.com

    - Please don't send me private messages asking programming questions, those would be better asked on the Programming forum here. Thanks

  32. #32
    Veteran
    Join Date
    May 2007
    Location
    Above KillZ, Below StallZ
    Posts
    9,953

    Default

    Forgive me for bumping this with no new information, but was just talking about it on an IRC chat, and realized that the post is approaching 2 years old, and thought maybe some new people could use the information.
    http://www.ericbla.de http://www.dungeondefenders.com http://en.wikipedia.org/wiki/Warm_Gun http://www.rekoil.com http://www.groundbranch.com

    - Please don't send me private messages asking programming questions, those would be better asked on the Programming forum here. Thanks

  33. #33
    MSgt. Shooter Person
    Join Date
    Apr 2012
    Posts
    53

    Default

    Thanks. What would be even more awesome is someone adding a walking animation to the characters that come with UDK


 

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Copyright ©2009-2011 Epic Games, Inc. All Rights Reserved.
Digital Point modules: Sphinx-based search vBulletin skin by CompletevB.com.