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.

How do you make telport like in "buu's fury"

Saar

Member

Well, If anyone play the legendry of goku 3 Buu's fury, There was a skill (not in battle, In normal...ya know..) Anway, The skill can telport you anywhere on map, And i want to make something like this, how can u make it?
 

Saar

Member

About the script thing, I did the "Tele" Skill, When the player get's his first job.
So, How do I make the script to not work before the player gets he's job (BTW I still didn't test the script cuz I g2g now =X)
 

Haki

Member

@Brewmeister: Thanks, didn't notice that.

@Saar: The script will not work unless the switch number 1 is on. The switch itself is activated by the common event so there should be no problems.

Here is the corrected script:
Code:
 def check_event(x, y)
    for event in $game_map.events.values
      if event.x == x and event.y == y
        return event.id
      end
    end
    return nil
  end

class Game_Player
  alias new_update update
  def update
    new_update
    if $game_switches[1] == true #number of the switch that activates teleport
      if Input.press?(Input::R) == true
        d = $game_variables[1] #number of variable where distance is stored
        current_x = $game_player.x
        current_y = $game_player.y
        loop do
        next_x = rand($game_map.width)
        next_y = rand($game_map.height)
        if d * d >= (next_x - current_x) * (next_x - current_x) + (next_y - current_y) * (next_y - current_y)
          if $game_map.passable?(next_x, next_y,0, nil) == true and $game_map.valid?(next_x, next_y) == true and  $game_map.check_event(next_x, next_y) == nil
              $game_player.moveto(next_x, next_y)
              $game_switches[1] = false
              break
          end
        end
        end
      end
    end
  end
end
 

Haki

Member

Ah, my stupid copy/paste methods! Now I see the error! The "check_event" method is nod defined inside the class!

Just put "class Game_Map" above "def check_event(x, y)" and another "end" above "class Game_Player"!
 

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