• Just a reminder that providing specifics on, sharing links to, or naming websites where ROMs can be accessed is against the rules. If your post has any of this information it will be removed.
  • Our friends from the Johto Times are hosting a favorite Pokémon poll - and we'd love for you to participate! Click here for information on how to vote for your favorites!
  • Serena, Kris, Dawn, Red - which Pokémon protagonist is your favorite? Let us know by voting in our grand final favorite protagonist poll!
  • PokéCommunity supports the Stop Killing Games movement. If you're a resident of the UK or EU, consider signing one of the petitions to stop publishers from destroying games. Click here for more information!
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

How can I create an item that teleport to a certain place?

  • 152
    Posts
    15
    Years
    • Seen Jul 6, 2022
    I have thought to put this in the script "PokemonItemEffects":

    ItemHandlers::UseFromBag.add(:AZUREFLUTE,proc{|item|
    Kernel.pbMessage(_INTL("{1} TEXT {2}.",$Trainer.name,PBItems.getName(item)))
    Kernel.pbMessage(_INTL("{1} TEXT."))
    next 1
    })

    I want to go to one map determined on having used the flute. Then I want to use the flute again to return to the map in which I was before.

    I don't know how to do it. :(
     
    You don't know how to copy the Escape Rope?

    The only difference between the two is where the destination coordinates come from. Presumably your Azure Flute will transport the player from anywhere in the game to a particular map, and then using it again will return them to the spot they used it before.

    Make a new variable in $PokemonGlobal similar to $PokemonGlobal.escapePoint (identical to, actually, but with a different name). This will be where the return coordinates are stored. The destination coordinates can be hardcoded in Settings.

    When using the flute, check whether your variable is nil or []. If so, store the player's current coordinates in that variable and then go to your hardcoded coordinates. If there are already coordinates in that variable, go to them and then erase your variable. Simple.

    Any features beyond that are easy to derive.
     
    I have been testing with the script, but I cannot do that I work.

    I have gone to the section "PokemonField" and I took this Escaperope's part:

    Spoiler:


    Below of this, I also have added this:

    Spoiler:


    Then I went to the section "PokemonItemEffects" and I took this Escaperope's part:

    Spoiler:


    Below of this, I also have added this:

    Spoiler:


    Then I did the same thing with another Escaperope's part of the same section:

    Spoiler:


    Below of this, I also have added this:

    Spoiler:


    I don't know that I must modify to put the ID Map.

    I did something similar with an item that can only be used when a switch is on, I'll post it later when I edit this post.
    Yes, please!!
     
    If you have copied the escape rope, it should work like the escape rope:

    In an event of a door or something (usually a cave entrance) put script: pbSetAzureFlute. (check for an escape rope event for an example and the exact usage)

    Then, IMPORTANT IN PROGRAMMING: test if it works so far. Test whether the Azure now indeed works exactly like an escape rope.

    Whe you are done, and everything works fine, make sure the item does what you want: put in the script where you use the item 1) a thing that transfers the player and 2) 'pbSetAzureFlute'. Then, when on the new locating, you should be able to use the flute as if it were an escape rope. (make sure the flute is not deleted upon usage, if that's what you want)

    I personally think you don't even need to copy the part of the escaperope, you could just use it instead. Where you call the function 'pbSetAzureFlute', just call the function 'pbSetEscapeRope'. This means that you can also use the escape rope to go back to the original location, but personally, I don't see that as a problem.

    Lastly, thank you for bringing up this question! I gave me many ideas for my own game: a temporary transfer to Mars, Venus or just the moon would be awesome... when the three main regions are finished that is, and I'm just halfway with the first...
     
    Sorry, I've been out the last couple of days ^_^'

    Spoiler:

    This is my PokemonItemEffects
    Icy Feather is the item, so you can use this for reference.
     
    Sorry, I've been out the last couple of days ^_^'
    This is my PokemonItemEffects
    Icy Feather is the item, so you can use this for reference.

    Thanks you! :)
    But I do not understand the switches that you have put, and even I continue without knowing since I do for script that the player goes to the map Spear Pillar. ~_~
     
    That item won't work properly... Just saying.

    The switch is obviously game specific TACHAN.

    I'd use $game_map.map_id!=xx, where xx is the map id of your Ice Plateau, not whether a switch is true, this way, the switch doesn't have to be set upon entering and exiting that map.

    EDIT:
    Code:
    ItemHandlers::UseInField.add(:FEATHER,proc{|item|
       escape=($PokemonGlobal.escapePoint rescue nil)
       if !escape || escape==[]
         Kernel.pbMessage(_INTL("Can't use that here."))
         next
       end
       if $game_player.pbHasDependentEvents?
         Kernel.pbMessage(_INTL("It can't be used when you have someone with you."))
         next
       end
       Kernel.pbMessage(_INTL("{1} used the ICY FEATHER.",$Trainer.name))
       pbFadeOutIn(99999){
          Kernel.pbCancelVehicles
          $game_temp.player_new_map_id=escape[0]
          $game_temp.player_new_x=escape[1]
          $game_temp.player_new_y=escape[2]
          $game_temp.player_new_direction=escape[3]
          $scene.transfer_player
          $game_map.autoplay
          $game_map.refresh
       }
       pbEraseEscapePoint
    })
    First thing, this is Escape Rope with a new name... You'll want to completely change this pretty much.
    Code:
          $game_temp.player_new_map_id=escape[0]
          $game_temp.player_new_x=escape[1]
          $game_temp.player_new_y=escape[2]
          $game_temp.player_new_direction=escape[3]
    These are probably what you'll want to manually change... Pretty self explanatory.
    Map ID to where you want to "teleport".
    X Position.
    Y Position.
    Direction you want the player to face.
    Otherwise it will read an escape point from metadata and send you to there... I'm pretty sure you don't want that, and if you do, set manually so you have control over it anyway (I would)

    Now this:
    Code:
    ItemHandlers::UseFromBag.add(:FEATHER,proc{|item|
       if $game_switches[61]=false
         Kernel.pbMessage(_INTL("It can't be used outside of the Ice Plateau."))
         next 0
       end
       if $game_player.pbHasDependentEvents?
         Kernel.pbMessage(_INTL("It can't be used when you have someone with you."))
         next 0
       end
       if ($PokemonGlobal.escapePoint rescue false) && $PokemonGlobal.escapePoint.length>0
         $game_switches[61]=false
         $game_switches[60]=false
         next 2 # End screen and consume item
       else
         Kernel.pbMessage(_INTL("It can't be used outside of the Ice Plateau."))
         next 0
       end
    })
    $game_switches[61]=false: will SET the switch to false.
    $game_switches[61]==false: will CHECK whether the switch is false.
    $game_switches[61]!=false: will check whether the switch is NOT false.
    So using if $game_switches[61]=false; will return that switch false, whether you turn it on or not... Thus the item, will not function properly.
     
    Last edited:
    Back
    Top