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.

Need a Button Script

Hey i looked everywere and didn't find anything, (wasn't expecting to :crazy: ) but anyway i need a script were I just press w and it pops up a map then i press w agian and the map is gone
I know that's really easy :dead: but i tryed to do it myself and i kept getting errors so please i need help

Script~Need's to do
After the main character gets a map i just
Press W and opens up a screen with a map on it.
press W and it closes the same screen to go back to the game.

pretty simple...sad i couldn't do it myself :down: .
 

arev

Sponsor

Would you accept event system for this? If so, here's one:

Conditional branch: Button L pressed # alternatively "Script: Input.trigger?(Input::L)"
_Conditional branch: Item "Map" posessed
__Conditional branch: Switch [0001] is ON
___Erase picture: 1 # that's your map
___Switch [0001] OFF
__Else
___Show Picture: 1, map, blabla
___Switch [0001] ON
__End
_End
End
 
arevulopapo":33f2t7m8 said:
Would you accept event system for this? If so, here's one:

Conditional branch: Button L pressed # alternatively "Script: Input.trigger?(Input::L)"
_Conditional branch: Item "Map" posessed
__Conditional branch: Switch [0001] is ON
___Erase picture: 1 # that's your map
___Switch [0001] OFF
__Else
___Show Picture: 1, map, blabla
___Switch [0001] ON
__End
_End
End

that's kinda hard to understand...
 
Brewmeister":2j7casrg said:
I think Actingman meant delete just his post. I assume he posted, then erased what he posted...???

Will there be only one map in your game? (as an item that the player can open?)
Yeah that's what I did.  I meant to reply to something else lol.
 
Brewmeister":1rja6d52 said:
I think Actingman meant delete just his post. I assume he posted, then erased what he posted...???

Will there be only one map in your game? (as an item that the player can open?)

yeh only one map in my game, it's just one really big map
 
You're not being very detailed in your request....

Is the map image larger than the screen? (640x480)
Do you want the pop-up to show the players current location on the map?
And, if so...  How? (Red X, Cross hairs, Blinking Sphincter, or just centered on current position)

Crose Eye
See Picture
Describe Picture
Ask someone to, "Make look like picture."  :scruff:

Be Well
 
Aaaaaaaaaaalllllllllllllllllllll  righty then!  :scruff:

Here ya go.  Paste right above main.
Code:
#-------------------------------------------------------------------------------
# World Map Display Script
# 26Feb08 - Brew
#
# Place World_Map.png in your 'pictures' folder
#-------------------------------------------------------------------------------

class Scene_Map

  alias scene_map_update update
  
  def initialize
    @map_showing = 0  # current picture number
  end
  
  def update
    scene_map_update         # Call the original update method
    if Input.trigger?(Input::Z)   # 'D' key   (R = 'W' key)
      # If map is already showing
      if @map_showing > 0
        # Erase Map
        $game_screen.pictures[@map_showing].erase
        @map_showing = 0
      else
        # determine if any other pictures are showing
        for i in 1..50
          if $game_screen.pictures[i].name == ""
            @map_showing = i
            break
          end
        end
        # display picture
        $game_screen.pictures[@map_showing].show("World_Map", 1,
                 320, 240, 100, 100, 255, 0)
      end
    end
  end
end

This uses the 'D' key.  You can change the Z to an R to use the 'W' key.

Be Well
 
A script is really not needed at all to do this.  Honestly arevulopapo was right WAY at the beggining.  A simple event should suffice.  Now, may I ask...How do you make a game if you don't even understand simple events such as using a conditional branch?  Just curious...
 
I know how to use the event system -.-
it's just that i don't want to copy/paste the freaking event on ALL my maps...

(also this game is mostly story line...)

EDIT: also yes thank you BrewMeister :lol:
 

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