Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Player Speed (https://forums.graalonline.com/forums/showthread.php?t=134267696)

sssssssssss 12-30-2012 08:27 AM

Player Speed
 
I'm really just wanting ideas on the best, most effecient ways to slow down a player using default movement.

I know you can get better results with this sort of stuff on custom movement, but I need it for something else. I tried to do the opposite of "staff boots" style and got a butload of callstack errors... so some ideas if someone wouldn't mind? And I'm not asking you to do it for me, just need a different point of view to approach it, either my brain is racked or I'm just too focused in a bad way lately...

Thanks you.

cbk1994 12-30-2012 08:40 AM

I haven't done it myself, but you should be able to just adjust player.defaultwalkspeed and player.diagonalwalkspeed. v6 only.

sssssssssss 12-30-2012 03:11 PM

Just tried defaultwalkspeed, pretty cool.

just to add it seems the defaults are:

player.defaultwalkspeed = 0.5;
player.diagonalwalkspeed = 1;

in case anyone comes directed here from search and doesn't know...not that it's too difficult to find out though either...


What about while swimming though? It's the only other "movement" that is rarely touched...
I know I can disable movement in a timeout with water check, then just watch keys and move the player, but the way I script I try to do everything to avoid a continous timeout if I can, so I was hoping there was another way.

Gunderak 12-30-2012 04:04 PM

I suppose something like this?
PHP Code:

//#CLIENTSIDE
function onKeyDown(code){
  if(
code in 3740|){
    
//Movement keys?
  
}


But then I suppose you've got j and the other walk keys..

scriptless 12-30-2012 04:08 PM

Quote:

Originally Posted by cbk1994 (Post 1711207)
I haven't done it myself, but you should be able to just adjust player.defaultwalkspeed and player.diagonalwalkspeed. v6 only.

I thought V5 supported this too? I could have sworn I was told that you could change default walking speed in v5..

Tho I guess this is better then servers simply giving you level 3 shield just to make you run faster.

sssssssssss 12-30-2012 04:29 PM

Quote:

Originally Posted by Gunderak (Post 1711222)
I suppose something like this?
PHP Code:

//#CLIENTSIDE
function onKeyDown(code){
  if(
code in 3740|){
    
//Movement keys?
  
}


But then I suppose you've got j and the other walk keys..

I appreciate it, but I got that part. Timeout to onwater and handle keys after disabling movement if in water.

I'm wondering if there is a better way than that though, as I hate using timeouts...

cbk1994 12-31-2012 12:18 AM

Quote:

Originally Posted by scriptless (Post 1711224)
I thought V5 supported this too? I could have sworn I was told that you could change default walking speed in v5..

You could try but I'm pretty sure the answer is no.

Tricxta 12-31-2012 01:55 AM

Quote:

Originally Posted by sssssssssss (Post 1711229)
I appreciate it, but I got that part. Timeout to onwater and handle keys after disabling movement if in water.

I'm wondering if there is a better way than that though, as I hate using timeouts...

I don't understand what you're saying but... maybe this is what you're after?

PHP Code:

//#CLIENTSIDE
function onKeyDown(code){
  if (!
playerswimming)return;

  
//is on water..


Perhaps.. >_>

sssssssssss 12-31-2012 04:10 AM

Quote:

Originally Posted by Tricxta (Post 1711268)
I don't understand what you're saying but... maybe this is what you're after?

PHP Code:

//#CLIENTSIDE
function onKeyDown(code){
  if (!
playerswimming)return;

  
//is on water..


Perhaps.. >_>

I'm trying to see if there is some equivalent to something like player.defaultwalkspeed.

Basically I'm just trying to stay away from the typical:

if player in water
timeout>timer

disabledefmovement
if(dir keys)
player.x/y +-


I really don't want to have to disabledefmovement if there is another logic to slowing down a player if they are in water/swimming. I tried player.x/y -+= 0.001 and got callstack errors and loop exceeding limits. I could avoid that only moving the x/y onkeypressed I suppose but was just hoping there was a different logic I could approach (like me not even knowing player.defaultwalkspeed was there).

cbk1994 12-31-2012 06:10 AM

If you're getting loop limit errors, you're doing something wrong. Post your code?

I don't know what the problem is or if timeouts are necessary in this case, but there's no reason to have such an extreme aversion to timeouts as long as you're not doing too much in them—sometimes you just can't avoid them.

DustyPorViva 12-31-2012 06:17 AM

Can you not just alter player.defaultwalkspeed while swimming and switch it back when they're not in water?

sssssssssss 12-31-2012 06:22 AM

Quote:

Originally Posted by cbk1994 (Post 1711292)
If you're getting loop limit errors, you're doing something wrong. Post your code?

I don't know what the problem is or if timeouts are necessary in this case, but there's no reason to have such an extreme aversion to timeouts as long as you're not doing too much in them—sometimes you just can't avoid them.

It's not really that I need help with it. I'm pretty sure I know what I did wrong, and could start it on keydowns instead. Was just hoping for a more effecient way outside of timeout checks to player.swimming.

Quote:

Originally Posted by DustyPorViva (Post 1711293)
Can you not just alter player.defaultwalkspeed while swimming and switch it back when they're not in water?

I tried it didn't work.

xXziroXx 12-31-2012 06:54 AM

Quote:

Originally Posted by sssssssssss (Post 1711295)
I tried it didn't work.

How about showing us what you tried? :asleep:

sssssssssss 12-31-2012 06:58 AM

xD

God knows what I did but it works lol. Sry. Fer real.

The onwater check I have wouldn't work, but player.swimming does...


PHP Code:

if (player.swimming)
  {
    
player.defaultwalkspeed 0.1;
  }else{
    
defaultGanis(); // resets speed there
  




All times are GMT +2. The time now is 03:54 PM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.