Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Super Simple Vehicle System & World Map

I'm sorry...but this is really confusing for us non-scripters...or for us idiots lol. I'm having problems following your directions....

I'm just trying to make a boat, but I'm using the word Ship instead of boat in all my switches and stuff. I'm having trouble knowing what parts in the script are the places where I need to change "boat" to "Ship", and where to change the switches and variable numbers to my own.
 

Monk

Member

sillypieman;284693 said:
I'm sorry...but this is really confusing for us non-scripters...or for us idiots lol. I'm having problems following your directions....

I'm just trying to make a boat, but I'm using the word Ship instead of boat in all my switches and stuff. I'm having trouble knowing what parts in the script are the places where I need to change "boat" to "Ship", and where to change the switches and variable numbers to my own.
The names of switches are purely for the programmer's reference and have no bearing on the outcome of events - the program doesn't match names (it only matches numbers - you don't even have to name switches and they will work like normal), so if there is a problem that is occurring, it is not due to the switch names.
 
No, I meant knowing where to change numbers. Cuz the original script assumes you are using switch 2 for the boat one right? My boat switch is number 279.

Okay, here's what's going on. I can get on the boat, but then I can't move in the water, and if I hold CTRL to go up to the land and push enter I can't get off...so in other words it's not working for me lol.
 

Monk

Member

sillypieman;284701 said:
No, I meant knowing where to change numbers. Cuz the original script assumes you are using switch 2 for the boat one right? My boat switch is number 279.

Okay, here's what's going on. I can get on the boat, but then I can't move in the water, and if I hold CTRL to go up to the land and push enter I can't get off...so in other words it's not working for me lol.
I'm not familiar with this particular vehicle script (I use my own), but it's hard to tell unless I had your project, since the problem could be any number of things related to switches. Just do your best to make sure that any reference in his events to switch 2 are now set to switch 279. Make sure to check every page of every event on the map. Chances are you missed just one of them and it's messing things up.
 
I thought I did....I had the water as number 2.

Well, I'm using Seph's right now...I just need to do some more complex switches and events and conditional branches, but I've almost got a system worked out. I use only specific landing places, so that really makes it easier.

But if there's an airship in my game, I probably will need to use this script instead.

Edit: Who do I give credit to for using the Ship characterset?
 
I've run into an issue...

I copied the script completely from the demo (I mean like, Events, switches, EVERYTHING. I even set the terrain tags...)

The only problem is, my character doesn't move on the map once I set all the terrain tags!

Can anyone help me?

If it helps, I'm using Mr. Mo's ABS. I'm not sure if that is the cause of the problem?

~EDIT

Another note, Im not using SBABS, Just the normal ABS.
 
you should make this compatible with mr.mo's SBABS, i tried to use it in it, but of course, the allies "refuse" to get in the boat, i'll try to figure it out.
 
can someone help me out here? I'm kinda new with scripting...
whenever I enter a vehicle, the vehicle turns purple and doesn't move anywhere... I'm not quite sure what I'm doing wrong...
here's what it looks like...

Code:
class Game_Character
  def passable?(x, y, d)
    
    # Get new coordinates
    new_x = x + (d == 6 ? 1 : d == 4 ? -1 : 0)
    new_y = y + (d == 2 ? 1 : d == 8 ? -1 : 0)
    
    # If coordinates are outside of map
    unless $game_map.valid?(new_x, new_y)
      return false
    end
    
    # If through is ON
    if @through
      return true
    end
        
    # If unable to leave first move tile in designated direction
    unless $game_map.passable?(x, y, d, self)
      return false
    end
    
    # If unable to enter move tile in designated direction
    unless $game_map.passable?(new_x, new_y, 10 - d)
      return false
    end
        
    #check terrain for vehicle
    check_terrain(new_x, new_y)    
      
    # Loop all events
    for event in $game_map.events.values
      # If event coordinates are consistent with move destination
      if event.x == new_x and event.y == new_y
        @state = true
        # If through is OFF
        unless event.through
          # If self is event
          if self != $game_player
            return false
          end
          # With self as the player and partner graphic as character
          if event.character_name != ""
            return false
          end
        end
      end
    end
    
    if @state == false
      return false
    end      
    
    # If player coordinates are consistent with move destination
    if $game_player.x == new_x and $game_player.y == new_y
      # If through is OFF
      unless $game_player.through
        # If your own graphic is the character
        if @character_name != ""
          return false
        end
      end
    end
      
    
    return true
    
  end
  
  #--------------------------------------------------------------------------
  # * Check the terrain for the vehicle
  #   @terrain (0=none, 1=river, 2=ocean, 3=air, 4=ground)
  #   @vehicle (0=foot, 1=canoe, 2=boat, 3=dragon)
  #   @state (true=passable tile, false=unpassable tile)
  #--------------------------------------------------------------------------
  def check_terrain(new_x, new_y)  
    @state = false
    @terrain = $game_map.terrain_tag(new_x, new_y)
    @vehicle = $game_variables[1]
    
    @state = true if @vehicle == 0 && @terrain == 4  #foot & ground
    @state = true if @vehicle == 1 && @terrain == 3  #canoe & river
    @state = true if @vehicle == 2 && @terrain == 2  #boat & ocean
    @state = true if @vehicle == 3                   #dragon
    @state = true if @terrain == 0
  end

end

class Game_Player < Game_Character
  
  alias in_vehicle_alias update
  #--------------------------------------------------------------------------
  # * Memorize actor graphic
  #--------------------------------------------------------------------------      
  def actor_memorize
    @actor_name = $game_actors[1].character_name
    @actor_hue = $game_actors[1].character_hue
    @battler_name = $game_actors[1].battler_name
    @battler_hue = $game_actors[1].battler_hue
    return true
  end

  #--------------------------------------------------------------------------
  # * Restore actor graphic
  #--------------------------------------------------------------------------      
  def actor_restore
    actor = $game_actors[1]
    actor.set_graphic(@actor_name.to_s, @actor_hue, @battler_name.to_s, @battler_hue)
    $game_player.refresh
    return true
  end    
  
  #--------------------------------------------------------------------------
  # * Enter a vehicle
  #--------------------------------------------------------------------------        
  def enter_vehicle(type)
    
    $game_system.menu_disabled = true
    $game_system.save_disabled = true    
    
    if type != "dragon"
      @through = true
      move_forward
      @through = false    
    end
    
    actor_memorize
    actor = $game_actors[1]    
    actor.set_graphic(type, @actor_hue, @battler_name.to_s, @battler_hue) 
    
    $game_switches[285] = false    #Canoe Off     
    $game_switches[283] = false    #Boat Off     
    $game_switches[284] = false    #Dragon Off         
    
    if type == "canoe"
      $game_variables[1] = 1       #set terrian
      $game_switches[285] = true    #Canoe On
      Audio.bgm_play("Audio/BGM/047-Positive05", 100, 100) #play canoe music
  
    elsif type == "boat"
      $game_variables[1] = 2       #set terrian
      $game_switches[283] = true    #Boat On      
      Audio.bgm_play("Audio/BGM/046-Positive04", 100, 100) #play ship music
      
    elsif type == "dragon"
      $game_variables[1] = 3       #set terrian
      $game_switches[284] = true    #Dragon On  
      Audio.bgm_play("Audio/BGM/045-Positive03", 100, 100) #play dragon music
      
    end
    
    $game_player.refresh
    $game_map.refresh
    
    return true
  end

  #--------------------------------------------------------------------------
  # * Enter a vehicle
  #--------------------------------------------------------------------------        
  def exit_vehicle

    $game_system.menu_disabled = false    
    $game_system.save_disabled = false
    
    if @terrain == 4
            
      if $game_switches[285] == true      #getting off canoe
        canoe = $game_map.events[3]     #get canoe event
        canoe.moveto(x, y)              #move to player's x, y coords
        $game_switches[285] = false       #Canoe Off   
        $game_variables[55] = x          #set canoe x coord
        $game_variables[56] = y          #set canoe y coord
        @through = true
        move_forward
        @through = false          
        
      elsif $game_switches[283] == true   #getting off boat
        boat = $game_map.events[2]      #get boat event
        boat.moveto(x, y)               #move to player's x, y coords        
        $game_switches[283] = false       #Boat Off    
        $game_variables[57] = x          #set boat x coord
        $game_variables[58] = y          #set boate y coord  
        @through = true
        move_forward
        @through = false                  
        
      elsif $game_switches[284] == true   #getting off dragon
        dragon = $game_map.events[4]    #get dragon event
        dragon.moveto(x, y)             #move to player's x, y coords        
        $game_switches[284] = false       #Dragon Off    
        $game_variables[59] = x          #set dragon x coord
        $game_variables[60] = y          #set dragon y coord        
      end
      
      # get off vehicle
      actor_restore
    
      # reset terrain
      $game_variables[1] = 0           
    
      # play walking music
      Audio.bgm_play("Audio/BGM/044-Positive02", 100, 100) #play music
      
      $game_player.refresh  
      $game_map.refresh    
    
    end
  
  end 
  
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    in_vehicle_alias
    # if not on ground terrain, check for boat exit
    if $game_variables[1] != 0
      if Input.trigger?(Input::C)
        exit_vehicle
      end   
    end
  end
 
end
variables:
55=conoe X
56=conoe y
57=boat x
58=boat y
59=dragon x
60=dragon y
switches:
285=conoe off
283=boat off
284=dragon off

... WHAT DO I DO?!
 

mawk

Sponsor

Not sure if this has already been called to your attention, but it's possible to become the canoe. :P

I rode the dragon to where the canoe was, faced the canoe, and pressed C while facing the canoe (and standing in the correct spot to mount the dragon, which I did.) I rode the dragon to the ice island. As soon as I dismounted, though, Arshes' caracterset had been replaced with that of the canoe. Nothing could reverse the change, not even climbing into the canoe and out again.

Again, sorry if this has been brought up already. I know how much it sucks to hear so much repetition about a bug or something.

EDIT: Oh, hell, it has. Well, sorry.
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top