I'm working on a game, where the best speed possible would be somwhere around 2000
I want 2000, to equate to around 1WD(ish, anywhere from 1 to 10WD is fine), while a speed of 10, would be somwhere nearer to a WD of 100.
WD = Walk Delay, or the delay in ticks between steps a player takes.
Is there a good way of doing this? =D
R_shn_t
ID:158604
![]() Jul 31 2009, 4:44 am
|
|
![]() Jul 31 2009, 5:08 am
|
|
Well, depending on how your setting your speed you may just want to edit two vars at once, one being the speed the player sees and the other the speed var that you use for your walk delay. Again, this may not work if the intervals aren't set specifically, like in a system where for every mile you walk you gain 1 speed or something like that.
|
Well the speed is based on levels, and items.
Certain Items such at heavy armor will reduce the speed by 200. Basicly I need a good equasion for changing speed high into delay low |
If you don't mind a linear fit:
10*m+b=100 2000*m+b=1 b=100-10*m b=1-2000*m 100-10*m = 1-2000*m 1990*m = -99 m=-0.0497487 b=100 So simplifed/rounded off: delay = -0.05*speed+101 |
Hmm, try something like this:
delay = ((speed - (speed*2) + 2000) /20) round that with round() proc to get an even number and then check to make sure its not 0, if its zero make it 0(as a speed of 2000 would make it 0). The makes speed a negative number equal to its positive state then adds 2000, which, with a speed of 0 would make this var 2000, 2000 divided by 20 is 100, your max delay. Although, a delay of 10 seconds is awfully large. EDIT: And in posting this, I solved a problem of my own I hadn't taken the time to think about, thank you Rushnut. |