Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 12-30-2012, 08:27 AM
sssssssssss sssssssssss is offline
Cyril Rain
sssssssssss's Avatar
Join Date: May 2003
Location: Texas, USA
Posts: 1,134
sssssssssss will become famous soon enough
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.
__________________
Cyril Rain
Creator and leader of SLX
Admin of Elysium
Elysium's Facebook Page: http://facebook.com/GraalOnlineElysium
Graal Forum Thread: http://forums.graalonline.com...
Graalians Thread: http://www.graalians.com...


Reply With Quote
  #2  
Old 12-30-2012, 08:40 AM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
I haven't done it myself, but you should be able to just adjust player.defaultwalkspeed and player.diagonalwalkspeed. v6 only.
__________________
Reply With Quote
  #3  
Old 12-30-2012, 03:11 PM
sssssssssss sssssssssss is offline
Cyril Rain
sssssssssss's Avatar
Join Date: May 2003
Location: Texas, USA
Posts: 1,134
sssssssssss will become famous soon enough
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.
__________________
Cyril Rain
Creator and leader of SLX
Admin of Elysium
Elysium's Facebook Page: http://facebook.com/GraalOnlineElysium
Graal Forum Thread: http://forums.graalonline.com...
Graalians Thread: http://www.graalians.com...



Last edited by sssssssssss; 12-30-2012 at 03:53 PM..
Reply With Quote
  #4  
Old 12-30-2012, 04:04 PM
Gunderak Gunderak is offline
Coder
Gunderak's Avatar
Join Date: Jun 2011
Location: Australia
Posts: 795
Gunderak is on a distinguished road
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..
__________________

Gund for president.

Remote PM {P*}x (Graal813044) from eraiphone -> Stefan: I hav 1 qustion
*Gunderak: he hav 1
*Gunderak: qustion
Reply With Quote
  #5  
Old 12-30-2012, 04:08 PM
scriptless scriptless is offline
Banned
Join Date: Dec 2008
Location: N-Pulse
Posts: 1,412
scriptless is a splendid one to beholdscriptless is a splendid one to beholdscriptless is a splendid one to beholdscriptless is a splendid one to behold
Quote:
Originally Posted by cbk1994 View Post
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.
Reply With Quote
  #6  
Old 12-30-2012, 04:29 PM
sssssssssss sssssssssss is offline
Cyril Rain
sssssssssss's Avatar
Join Date: May 2003
Location: Texas, USA
Posts: 1,134
sssssssssss will become famous soon enough
Quote:
Originally Posted by Gunderak View Post
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...
__________________
Cyril Rain
Creator and leader of SLX
Admin of Elysium
Elysium's Facebook Page: http://facebook.com/GraalOnlineElysium
Graal Forum Thread: http://forums.graalonline.com...
Graalians Thread: http://www.graalians.com...


Reply With Quote
  #7  
Old 12-31-2012, 12:18 AM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Quote:
Originally Posted by scriptless View Post
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.
__________________
Reply With Quote
  #8  
Old 12-31-2012, 01:55 AM
Tricxta Tricxta is offline
The Muffin Man
Tricxta's Avatar
Join Date: Oct 2010
Location: Australia
Posts: 563
Tricxta is just really niceTricxta is just really nice
Quote:
Originally Posted by sssssssssss View Post
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.. >_>
__________________
Quote:
Originally Posted by Crono View Post
No look at it, Stefan is totally trolling Thor. Calling Classic a "playerworld" (something it's not supposed to be) is the ultimate subtle insult to a true fan.

It's genius.
Reply With Quote
  #9  
Old 12-31-2012, 04:10 AM
sssssssssss sssssssssss is offline
Cyril Rain
sssssssssss's Avatar
Join Date: May 2003
Location: Texas, USA
Posts: 1,134
sssssssssss will become famous soon enough
Quote:
Originally Posted by Tricxta View Post
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).
__________________
Cyril Rain
Creator and leader of SLX
Admin of Elysium
Elysium's Facebook Page: http://facebook.com/GraalOnlineElysium
Graal Forum Thread: http://forums.graalonline.com...
Graalians Thread: http://www.graalians.com...


Reply With Quote
  #10  
Old 12-31-2012, 06:10 AM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
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.
__________________
Reply With Quote
  #11  
Old 12-31-2012, 06:17 AM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
Can you not just alter player.defaultwalkspeed while swimming and switch it back when they're not in water?
Reply With Quote
  #12  
Old 12-31-2012, 06:22 AM
sssssssssss sssssssssss is offline
Cyril Rain
sssssssssss's Avatar
Join Date: May 2003
Location: Texas, USA
Posts: 1,134
sssssssssss will become famous soon enough
Quote:
Originally Posted by cbk1994 View Post
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 View Post
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.
__________________
Cyril Rain
Creator and leader of SLX
Admin of Elysium
Elysium's Facebook Page: http://facebook.com/GraalOnlineElysium
Graal Forum Thread: http://forums.graalonline.com...
Graalians Thread: http://www.graalians.com...


Reply With Quote
  #13  
Old 12-31-2012, 06:54 AM
xXziroXx xXziroXx is offline
Malorian
xXziroXx's Avatar
Join Date: May 2004
Posts: 5,289
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
Quote:
Originally Posted by sssssssssss View Post
I tried it didn't work.
How about showing us what you tried?
__________________
Follow my work on social media post-Graal:Updated august 2025.
Reply With Quote
  #14  
Old 12-31-2012, 06:58 AM
sssssssssss sssssssssss is offline
Cyril Rain
sssssssssss's Avatar
Join Date: May 2003
Location: Texas, USA
Posts: 1,134
sssssssssss will become famous soon enough
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
  

__________________
Cyril Rain
Creator and leader of SLX
Admin of Elysium
Elysium's Facebook Page: http://facebook.com/GraalOnlineElysium
Graal Forum Thread: http://forums.graalonline.com...
Graalians Thread: http://www.graalians.com...


Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 01:51 AM.


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