Page 1 of 1

[Request] Change player speed

Posted: 31 Jul 2019, 23:46
by PaperMarioYT
Good, I need a script that changes the player's speed, I need to make the character slower.

Posted: 1 Aug 2019, 22:47
by Numaki
You can change the speed of Players by using the char(j).xsp and char(j).ysp commands:
for x-Speed(Right):
Spoiler

Code: Select all

do
If char(j).xsp > 0 then
char(j).xsp = char(1).xsp * q
end if
call sleep(1)
loop
for x-Speed(Left)
Spoiler

Code: Select all

do
If char(j).xsp < 0 then
char(j).xsp = char(1).xsp * q
end if
call sleep(1)
loop
for y-Speed(Jumping)
Spoiler

Code: Select all

do
If char(j).xsp < 0 then
char(j).ysp = char(1).ysp * q
end if
call sleep(1)
loop
for y-Speed(Falling)
Spoiler

Code: Select all

do
If char(j).xsp > 0 then
char(j).ysp = char(1).ysp * q
end if
call sleep(1)
loop
j must be replaced by 1 or 2 (Represents Player 1 or 2)
q must be replaced by the number of times, the player is faster compared to the normal speed
(Because you want your character to be slower, you should replace q with a factor smaller than 1 (e.g. 0.5))
(and you must add at least two Auto-Start-Events that activate the scripts (one for each x-Direction), optionally for the other two scripts. Oh, and the .ysp command for Jumping is a bit buggy when using a factor less than 1, had to learn that the hard way... )
Hope this helps you.