Vehicles: How they work and how to add a new one

● ARCHIVED · READ-ONLY
Started by Shiokazu 9 posts View original ↗
  1. i'll keep it short, with a quick intro.

    i never scripted anything in my life nor i know anything about ruby, i was trying to figure out alone how vehicles work reading through the code thats default within the rpg maker. /breathes/ I am now stuck with a thing, i need a vehicle, simply because dashing is not quick enough and i want to add a little more immersion. i need a vehicle that works on the land, i can put on the reasons if anyone here want to know but for now i'll try to keep it short.

    so, could someone explain to me, how vehicles work in the maker, and how can i add a new vehicle, because eventing wont work on this matter.

    thank you so much in advance.
  2. How interesting!


    Vehicles are defined in $data_system. You have $data_system.boat, $data_system.ship and $data_system.airship. Each of these is a RPG::System::Vehicle object, which keeps track of the character name and index of the sprite, the BGM to play while you're in the vehicle, the starting map id and its x and y coordinates. The initial settings for these, obviously, come from the System tab in the editor.


    In theory, you could adjust the Game_Vehicle class to add new vehicle types with the appropriate settings, then update Game_Map so it creates the additional vehicles. Then you'd need to adjust the Game_Player class to cater for the new vehicles. If you're after something that just works on land, you wouldn't have to make any adjustments to Game_Player's map_passable? method, as it would default to walking passability if you're not in the boat, ship or airship. You'd also have to check for anywhere else vehicles are referred to, and see what else needs to be modded for the possibility of other vehicle types.


    However, if you JUST want to dash faster, it'd be easier to change the dashing speed than to try adding new vehicles.


    Game_CharacterBase class


    real_move_speed method


    change this:

    @move_speed + (dash? ? 1 : 0)to this:
    Code:
    @move_speed + (dash? ? 2 : 0)

    Also note ... the default move speed (for walking) is 4, which is the same speed as the boat. Therefore the default dash speed, without changing that script, is 5, which is the same speed as the ship. If you're saying that's not fast enough, then you are saying that neither the boat nor the ship would be fast enough for you, and you'd want to move at the speed of the airship when dashing.


    In that case, change the method to this instead:

    Code:
    dash? ? 6 : @move_speed
  3. thank you for the answer, it helped a lot, and made me understand a little bit more of the code.

    currently working on a way to load the vehicle, since i dont see a place to define the graphics and load it into the map. im probably going to work on a small script to work with this.
  4. How are your scripting skills?
  5. Shaz said:
    How are your scripting skills?
    ... well...

     im not gonna lie, i have 0 skills.
  6. :) I'll move it and we'll see if someone can do it for you.
  7. thank you very much, while im at it, i'll try to see what i can do by myself.
  8. Same problem here. i'm trying to make a space themed game but the vehicles tracks aren't programmed as water so they don't move.
  9. sorry if i'm offending. but if you have 0 skills in scripting. you might better use someone else script. (or see how they do that in that script if your purpose is for education...).

    one of the scripts that adds vehicles i know is by victor. you might want to check it out.