dMZX Forums: Slow down player movment - dMZX Forums

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Slow down player movment command exist? Suggestion

#1 User is offline   Mr Goof 

  • Newbie
  • Pip
  • Group: Members
  • Posts: 14
  • Joined: 14-June 05

Posted 20 January 2024 - 06:14 AM

Hi everyone,
Ive checked the help file wondering if there is a command to slow down the players movements. Looking to have an effect placed on the player to slow them down for a time period. I did try using lockplayer unlockplayer with waits inside a loop but the effect was choppy and not what I wanted. Any advice would be appreciated much thanks in advance.
0

#2 User is offline   Dr Lancer-X 

  • 電波、届いた?
  • Group: DigiStaff
  • Posts: 8,938
  • Joined: 20-March 02
  • Location:ur mom nmiaow

Posted 20 January 2024 - 07:14 AM

Unfortunately there's not. The reason the lockplayer/unlockplayer loop is bad is because the player is controlled with cursor keys and autorepeat, which means the player only moves one tile when a key is pressed, but if you hold it, the player moves multiple tiles. This means the player can be finely controlled with individual keystrokes, but that you can move longer distances in one direction by holding down a key. This is what you want, but in the context of a robot locking and unlocking the player every cycle, these fine motions are lost because around 50% of the time they won't be registered. Ideally, what you would have with a slowed down player is the same precise individual movement, but the hold down movement is slowed.

Here's something hacky that may be more along the lines of the kind of thing you want:

: "l"
set "local2" to "('playerx'x'playery')"
wait for 1
if "('playerx'x'playery')" != "local2" then "mov"
goto "l"
: "mov"
lockplayer
wait for 1
unlockplayer
goto "l"


Upon detecting a player movement, we lock the player for a cycle. This means that the player will remain responsive but won't be able to move more than 1 tile in 2 cycles.
Posted Image
<Malwyn> Yes, yes. Don't worry I'd rather masturbate with broken glass than ask you for help again. :(
0

#3 User is offline   Mr Goof 

  • Newbie
  • Pip
  • Group: Members
  • Posts: 14
  • Joined: 14-June 05

Posted 21 January 2024 - 02:09 AM

Thank you for the code suggestion and why it was not working i get it now, lol
0

#4 User is offline   Mr Goof 

  • Newbie
  • Pip
  • Group: Members
  • Posts: 14
  • Joined: 14-June 05

Posted 21 January 2024 - 03:04 AM

I just used it and it is working a lot better thank you :) ... off to coding :pirate:

This post has been edited by Mr Goof: 21 January 2024 - 03:06 AM

0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users