Help - Search - Members - Calendar
Full Version: Q: Making character aways run(dash). And a clock (timer) question.
RPG RPG Revolution Forums > Game Engines > RPG Maker VX Discussion
drebenk
Hi,

I'm wondering how to make my character aways move with the speed he is running (dashing) with when the Shift key is pressed?

I know that the default walk speed is 4 but what's the default run speed? And then after I put that value as a walk speed how to make the character move with the same speed even if the Shift key is pressed?

My second question is about the timer. Is there a way to add time to it?

For example you start a map and the timer starts from 10 back to 0. But if you walk over an even the time will increase by 1 sec. So far I only see commands for timer stop and start but no command to add time to the current timer time.
Night5h4d3
as far as the second question goes, use a call script:
$game_system.timer += <Time To Add> * Graphics.frame_rate


Edit--
Putting 1 for the time to add should mean 1 second.
drebenk
@Night5h4d3 thanks for the answer. BTW can I put a number with decimal in it? For example - 1.5 ?
Lyran
I think for the first question about speed, there is a script that I found. But I can't find its source. Its the one which allows you to jump, move diagonally... and also, even have something like the Dash button always pressed, if you want to.

So, basically its by using a script, if anyone already did something like that over here, please post its own version... Or I could Copy-Paste the one I downloaded from another site(I rather not do it, I'd feel uncomfortable).
Xarak
Sprinting makes you move at the speed of 5 - twice as fast as normal. You don't need a script.
drebenk
@Xarak well the normal move speed is 4, so if sprinting doubles your move speed then the speed should be 8. I tried with 8 as speed for normal movement but it is way to fast.

So I set the movement speed to 5 and it seems OK. The problem is that if you press the Shift key the character starts moving even faster. That's why I want a way to eliminate the Shift key. This can be done by either making the sprint speed (when the Shift key is being pressed) the same as the walking speed or by eliminating the use of Shift key somehow.

I think that the better way is to make the run speed the same as the movement speed - the problem is that I don't know which part of which script handles this speed.
Night5h4d3
it should support decimals/floats, but if it doesn't, you can try:

$game_system.timer.to_f += <Time To Add> * Graphics.frame_rate

But probably it wont be able to 'display' them, if you give the person 3 & 1/2 seconds, it probably will only show a 3, and in 1 & 1/2 seconds it'll decrease to 2.
leongon
Check for "Update While Moving" in Game_Character script.
drebenk
@Night5h4d3 thanks. I do not need these half seconds to be displayed but to use them to sync the clock better.

@leongon what should I change in that section in order to make the run speed the same as the walk speed - if the walk speed is 5.
leongon
QUOTE (drebenk @ Mar 5 2010, 03:11 PM) *
@leongon what should I change in that section in order to make the run speed the same as the walk speed - if the walk speed is 5.


Default walk speed there is 2, and dashing speed is walk*2, if I remember correctly... So if you want always dash, and dash speed be same as walk speed, then set walk as 4 and dash *1.
Lyran
QUOTE (leongon @ Mar 5 2010, 11:52 PM) *
QUOTE (drebenk @ Mar 5 2010, 03:11 PM) *
@leongon what should I change in that section in order to make the run speed the same as the walk speed - if the walk speed is 5.


Default walk speed there is 2, and dashing speed is walk*2, if I remember correctly... So if you want always dash, and dash speed be same as walk speed, then set walk as 4 and dash *1.


I was thinking that something like that should work. Dash is set as Double speed of Walking, so if one make Dash = Walk Speed, then the rest is up to set the Walking Speed time.
drebenk
@leongon on line 57 of the Game_Character script I've set:

@move_speed = 5 (the default value was 4)

Then on lines 307-320 I have:

CODE
#--------------------------------------------------------------------------
# * Update While Moving
#--------------------------------------------------------------------------
def update_move
distance = 2 ** @move_speed # Convert to movement distance
distance *= 2 if dash? # If dashing, double it
@real_x = [@real_x - distance, @x * 256].max if @x * 256 < @real_x
@real_x = [@real_x + distance, @x * 256].min if @x * 256 > @real_x
@real_y = [@real_y - distance, @y * 256].max if @y * 256 < @real_y
@real_y = [@real_y + distance, @y * 256].min if @y * 256 > @real_y
update_bush_depth unless moving?
if @walk_anime
@anime_count += 1.5
elsif @step_anime
@anime_count += 1
end
end


So I need to change what here?
leongon
Then just:
CODE
#--------------------------------------------------------------------------
# * Update While Moving
#--------------------------------------------------------------------------
def update_move
distance = 2 ** @move_speed # Convert to movement distance
distance *= 1 if dash? # If dashing, double it - not, now same as walking.
@real_x = [@real_x - distance, @x * 256].max if @x * 256 < @real_x
@real_x = [@real_x + distance, @x * 256].min if @x * 256 > @real_x
@real_y = [@real_y - distance, @y * 256].max if @y * 256 < @real_y
@real_y = [@real_y + distance, @y * 256].min if @y * 256 > @real_y
update_bush_depth unless moving?
if @walk_anime
@anime_count += 1.5
elsif @step_anime
@anime_count += 1
end
end
drebenk
@leongon thanks a lot, it works like a charm! ^^

All questions answered, all problems solved.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2013 Invision Power Services, Inc.