Save-Point
Permanently modifying move speed - Printable Version

+- Save-Point (https://www.save-point.org)
+-- Forum: Games Development (https://www.save-point.org/forum-4.html)
+--- Forum: Code Support (https://www.save-point.org/forum-20.html)
+--- Thread: Permanently modifying move speed (/thread-6452.html)



Permanently modifying move speed - Keeroh - 05-24-2017

Hello, it's me again!

I have a question, is it possible to permanently modify the move speed values? the 4: Fast is a little slow when walking through the maps and 5: Faster is too fast, I was trying to get something between those two, like 4.5 speed.

I tried going to Game_Character 1 and found @move_speed = 4. i tried changing it to @move_speed = 4.5 and it works, but if I use Set Move Route to change the player's move speed it returns to 4. I can't find where I can modify the speed in set move route to make 4: Fast become 4.5.

Thanks for the attention!  Blushing + Cheery


RE: Permanently modifying move speed - BeJeremiah - 05-24-2017

(05-24-2017, 01:51 AM)Keeroh Wrote: Hello, it's me again!

I have a question, is it possible to permanently modify the move speed values? the 4: Fast is a little slow when walking through the maps and 5: Faster is too fast, I was trying to get something between those two, like 4.5 speed.

I tried going to Game_Character 1 and found @move_speed = 4. i tried changing it to @move_speed = 4.5 and it works, but if I use Set Move Route to change the player's move speed it returns to 4. I can't find where I can modify the speed in set move route to make 4: Fast become 4.5.

Thanks for the attention!  Blushing + Cheery

Other than in game character or through a script call, you would not be able to event a variable speed that is not a whole number. Would involve editing the interpreter and still would require a script call either way.

So, a script call from an event with


Code:
$game_player.move_speed = {amt here}

Would be the main way I can suggest.


RE: Permanently modifying move speed - Keeroh - 05-24-2017

(05-24-2017, 02:24 AM)BeJeremiah Wrote:
(05-24-2017, 01:51 AM)Keeroh Wrote: Hello, it's me again!

I have a question, is it possible to permanently modify the move speed values? the 4: Fast is a little slow when walking through the maps and 5: Faster is too fast, I was trying to get something between those two, like 4.5 speed.

I tried going to Game_Character 1 and found @move_speed = 4. i tried changing it to @move_speed = 4.5 and it works, but if I use Set Move Route to change the player's move speed it returns to 4. I can't find where I can modify the speed in set move route to make 4: Fast become 4.5.

Thanks for the attention!  Blushing + Cheery

Other than in game character or through a script call, you would not be able to event a variable speed that is not a whole number. Would involve editing the interpreter and still would require a script call either way.

So, a script call from an event with



Code:
$game_player.move_speed = {amt here}

Would be the main way I can suggest.

Thanks for the fast reply! I was using game_guy's dash and sneak script, but with it I couldn't edit the player move speed through set mouve route. This script have a script call to enable or disable it, but whenever i tried using the game would crash.
It's sad because it did exactly what I wanted but oh well

I tried using $game_player.move_speed = 6 to test, but i had an error
"NoMethodError occurred while running script."


RE: Permanently modifying move speed - DerVVulfman - 05-24-2017

Hrm.... (CHECKING) ....

Okay. Well, the move_speed value in the Game_Player class was not set up to be a value that can be received via a script call. In other classes, you may see things at the beginning that read "attr_accessor :move speed" . Putting that statement at the beginning of the Game_Player class would let you read-from and write-to that value within Game_Player. Otherwise, it is a value that is only inherited from the Game_Character class and affected only by systems like the Interpreter (Map events) calls.


RE: Permanently modifying move speed - Keeroh - 05-24-2017

I see. Well, that was a good lesson about ruby xD

Let me see if I'm following right. If I put attr_accessor :move_speed in Game_Character, which is the class that have the variable move_speed, the variable becomes public and I can use it when calling Game_Player, so $game_player.move_speed = 6 will work. Am I following right?

Edit: I tested this and it worked!


RE: Permanently modifying move speed - DerVVulfman - 05-24-2017

Yep.  

BUT!!!!    To achieve the same feature for events, place the same attr_accessor statement within Game_Character and Game_Event.

That way, you can use:

$game_map.events[event_id].move_speed = value

attr_accessor allows you to read and write the specified value to/from that class.
attr_reader allows you ONLY to read from that class (within reason)

The Event and Player classes merely 'inherit' data and methods from Game_Character....
.... (Game_Player < Game_Character ) ....
So you don't need to add all the methods from Game_Character into Game_Player.  There is no 'moving' or 'jumping' methods in Game_Player.  But they exist in Game_Character.  ;)  Game_Player is what we call a 'child' class.  It's daddy is Game_Character, and since the methods are in Character.... Player has access to them.

But you still want to add the attr_accessor statements to all the classes.