Geralt Posted April 16, 2021 Posted April 16, 2021 Hey everyone! I'd like to make a script that makes my character walk insted of running without pressing the walk button. So the default movement should be walking. I don't know how to start, any ideas please?
βurak Posted April 16, 2021 Posted April 16, 2021 function FORCE_PLAYER_WALK( player, condition ) if( condition == true ) then bindKey(player, "w", "down", function() setControlState(player, "walk", true) setControlState(player, "forwards", true) end) bindKey(player, "w", "up", function() setControlState(player, "walk", false) setControlState(player, "forwards", false) end) toggleControl( player, "sprint", false ) toggleControl( player, "forwards", false ) toggleControl( player, "backwards", false ) toggleControl( player, "left", false ) toggleControl( player, "right", false ) elseif( condition == false ) then toggleControl( player, "sprint", true ) toggleControl( player, "forwards", true ) toggleControl( player, "backwards", true ) toggleControl( player, "left", true ) toggleControl( player, "right", true ) unbindKey( player, "w", "down" ) unbindKey( player, "w", "up" ) else return nil end end addCommandHandler("force", function( player ) FORCE_PLAYER_WALK( player, true ) end ) addCommandHandler("forceend", function( player ) FORCE_PLAYER_WALK( player, false ) end ) maybe like that? 1
Geralt Posted April 16, 2021 Author Posted April 16, 2021 This was a great help, thank you! I made some modifications, walking now is always forced and I also added left/right/backwards movement. It seems like it's working just like I imagined, thanks again! 1
Gyrosos Posted July 2, 2022 Posted July 2, 2022 On 16/04/2021 at 14:06, Geralt said: This was a great help, thank you! I made some modifications, walking now is always forced and I also added left/right/backwards movement. It seems like it's working just like I imagined, thanks again! Can you tell me how, or send me the script, how exactly did you add left/right/backwards movement?
Shady1 Posted July 2, 2022 Posted July 2, 2022 13 minutes ago, Gyrosos said: Can you tell me how, or send me the script, how exactly did you add left/right/backwards movement? The codes you want above are available, you just have to make meta.xml
Human Resources Staff Vinyard Posted July 3, 2022 Human Resources Staff Posted July 3, 2022 Locking this as the thread is a bit old. There are code snippets above, as Shady stated, but if you have further issues/questions on this matter, please create a new topic. @Gyrosos
Recommended Posts