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?
 

Davey

Member

Just make a new skill in the database, make a common event where you teleport to the map you want, go to the new skill and edit 'common event' to the common event you made.

You must also set 'occasion' to 'only from the menu', and (optionally) the sp cost...
 

Haki

Member

Make a skill "teleport" and set a common event to change the graphic of your character to a cursor and sets "trough" on for the character. Set the common event to parallel process and when the player presses a key the graphic changes back to normal and trough is off. The only problem is the player could be "teleported" to a non-passable tile.
 

Haki

Member

Ok, let's solve this. First, create two common events. Name one "teleport start", and the other one "teleport". In the first one, set a switch operation and turn a switch on. In the second one, set that it is a parallel process and it's activated with the switch you used in the first event. Now, change actor graphic to a cursor, or whatever you want. Activate through. Assign three variables. The first one is the player x,the second is player y, and the third is the map id. Set if the key you select is pressed, the game checks this script:

$game_map.passable?($game_variables[1],$game_variables[2],0,nil)

Now if this is true, set the player's graphic to change back to normal, de-activate through and turn the switch you used to start the event off.

That's all for events, now create a skill, name it "teleport" and set everything as you like. Set that you can only use it from the menu and that it calls the "teleport start" common event.
 

Saar

Member

That's not what i really wanted, I want the player not to move anywhere at map, I want him to teleport (like the telport event) anywhere, without walking there, just immedtly telport there..
 
You either have to choose a place to teleport to, or randomly teleport to another spot on the map.
Which is it? And if it's "choose", how would you like the player to choose?
If it's random, are there any rules?  (at least x spaces away,  only passable tiles, not near another enemy)???
 
Ok, I'm going to assume that you want it to be RANDOM.

by "x spaces", I meant a certain number of spaces (x being a variable)

Does it need to be completely random, or would it suffice to select a finite number of spots on the map that are 'safe' to transport to?
 
Ok, it was actually easier to make it completely random.

This will allow you to set a minimum distance from your current spot or an enemy.
change "min_dist = 5" to whatever distance you want.
Define an enemy (Monster) by making the first character of the event name, 'M' (capital m).  (i.e. rename EV005 to MV005).

Paste this in a new script right above 'Main'

Code:
#--------------------------------------------------------
# Random Transport to any passable tile on current map
#
# Be careful. You could trap the player if you have passable
# map tiles that are surrounded by impassable tiles.
#
# call with:  $game_player.rand_trans
#
# set min_dist to a minimum distance away from current spot.
#
# Also avoids any event that starts with 'M'  (Monster) by the
# same distance
#
# Brewmeister - 16May08  (for Saar)
#--------------------------------------------------------

class Game_Player
  
  def rand_trans
    min_dist = 5
    too_close = false
    width = $game_map.width
    height = $game_map.height
    while true
      rand_x = rand(width)
      rand_y = rand(height)
      dist_x = rand_x - self.x
      dist_y = rand_y - self.y
      distance = Math.hypot(dist_x, dist_y)
      if distance < min_dist
        next
      end
      unless $game_map.passable?(rand_x, rand_y, 0)
        next
      end
      # check distance from all enemies
      for event in $game_map.events.values
        if event.name[0,1] == "M"  #event name starts with M
          dist_x = rand_x - event.x
          dist_y = rand_y - event.y
          distance = Math.hypot(dist_x, dist_y)
          if distance < min_dist
            too_close = true
            break
          end
        end
      end
      if too_close
        too_close = false
        next
      else
        break
      end
    end
    moveto(rand_x, rand_y)
  end
end

Be Well

ref: Sniagyte_event
 

Haki

Member

I made a version where you can choose the distance of the tile where you want your character to teleport.

Create a skill named "teleport", set it as you like and make it call common event 1.

Common event 1 should look like this:

Code:
@>Switch:[0001] = ON
@>Message: Enter a distance
@>Input Number: [0001], 2 Digits

Now paste this code above Main:

Code:
class Game_Map
  
  def check_event(x, y)
    for event in $game_map.events.values
      if event.x == x and event.y == y
        return event.id
      else
        return nil
      end
    end
  end
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

When you use the skill you will be asked for distance and the player will be teleported to a passable tile within the range.
 
Cool!  2 choices.  :scruff:

Haki, it looks like you can queue the ability up, then use the "W" key to activate it. Nice.

What happens if you have it queued up, and go to a different map, or to battle & activate it?

Be Well
 
Haki, change the check_event method to:

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

Otherwise, it's only checking the first event. And not returning 'nil' if there are no events.

Ref: Random_Transport
 

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