Jump to content

[HELP] Walking without pressing ALT


Geralt

Recommended Posts

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?

  • Thanks 1
Link to comment
  • 1 year later...
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?

Link to comment
  • Scripting Moderators

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

Link to comment
Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...