Submit Your Article


 
RPG Maker

Welcome Guest ( Log In | Register )


  Games Resources RPG Maker VX RPG Maker XP Scripts Tutorials Downloads

 
Reply to this topicStart new topic
> World/Location Window, Version 1.0
Sailerius
post Jul 5 2009, 10:54 AM
Post #1


Blue Blue Glass Moon
Group Icon

Group: Revolutionary
Posts: 881
Type: Developer
RM Skill: Beginner





Version: 1.0
Author: Sailerius
Release Date: 07/05/09


Introduction
I wrote this for a game a friend of mine is making. It's nothing special, but it's my first script. So, I'm looking for comments on how to improve it and what I did right/wrong. I'm not too familiar with scripting conventions.

Features
It shows a window at the top left of the screen that displays the name of the current world and below it the name of the map. The window can be hidden and displayed by manipulating a switch, whose ID number you specify.

Script
[Show/Hide] World/Location Window

CODE
#==============================================================================
# ** Window_Location
#------------------------------------------------------------------------------
#  This window displays universe name and map name.
#  Version 1.0
#  Written by Sailerius
#
#  Instructions: Define the constants below.
#  You can make the location window visible/invisible by toggling the visibility switch.
#  It will display the name of the current map.
#  You can define what it says for each universe below.
#==============================================================================
class Window_Location < Window_Base
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    #--------------------------------------------------------------------------
    # * Constants: Edit these values to customize
    #--------------------------------------------------------------------------
    $VISIBILITY_SWITCH = 1 # Enter the ID number of the switch used to determine window visibility
    $WORLD_VAR = 1 # Enter the ID number of the variable used to determine current universe
    #--------------------------------------------------------------------------
    # * Values: Here, enter what you want the location window to display for each
    # variable value.  For example, for WORLD[1], enter what you want the universe
    # section of the window to say when the variable is set to 1.
    # Feel free to add more.
    # NOTE: If you set the variable to a number not defined here, it'll probably crash.
    #--------------------------------------------------------------------------
    $WORLD=[]
    $WORLD[0] = "Undefined"
    $WORLD[1] = "Universe 1"
    $WORLD[2] = "Universe 2"
    $WORLD[3] = "Universe 3"
    $WORLD[4] = "Universe 4"
    $WORLD[5] = "Universe 5"
    $WORLD[6] = "Universe 6"
    #--------------------------------------------------------------------------
    # Don't edit anything below here.
    #--------------------------------------------------------------------------
    super(0, 0, 160, 64) #96
    self.contents = Bitmap.new(width - 32, height - 32)
    self.contents.font.size = 16
    self.visible = $game_switches[$VISIBILITY_SWITCH]
    refresh
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    self.contents.font.color = system_color
    self.contents.draw_text(4, -8, 120, 32, $WORLD[$game_variables[$WORLD_VAR]])
    self.contents.font.color = normal_color
    self.contents.draw_text(4, 4, 120, 32, $game_map.name, 1)
  end
end
  #==========================================================================
====
  # * Game_Map
  #==========================================================================
====
class Game_Map
  def name
    $map_infos[@map_id]
  end
end
  #==========================================================================
====
  # * Scene_Title
  #==========================================================================
====
class Scene_Title
  # Enables ability to show map name on screen
  $map_infos = load_data("Data/MapInfos.rxdata")
  for key in $map_infos.keys
    $map_infos[key] = $map_infos[key].name
  end
end
  #==========================================================================
====
  # * Scene_Map
  #==========================================================================
====
class Scene_Map
  attr_accessor:location_window
  #--------------------------------------------------------------------------
  # * Main Processing
  #--------------------------------------------------------------------------
  def main
    # Make sprite set
    @spriteset = Spriteset_Map.new
    # Make message window
    @message_window = Window_Message.new
    # Make location window
    @location_window = Window_Location.new
    @location_window.x = 0
    @location_window.y = 0
    # Transition run
    Graphics.transition
    # Main loop
    loop do
      # Update game screen
      Graphics.update
      # Update input information
      Input.update
      # Frame update
      update
      # Abort loop if screen is changed
      if $scene != self
        break
      end
    end
    # Prepare for transition
    Graphics.freeze
    # Dispose of sprite set
    @spriteset.dispose
    # Dispose of message window
    @message_window.dispose
    # Dispose of location window
    @location_window.dispose
    # If switching to title screen
    if $scene.is_a?(Scene_Title)
      # Fade out screen
      Graphics.transition
      Graphics.freeze
    end
  end
  #--------------------------------------------------------------------------
  # * Player Place Move
  #--------------------------------------------------------------------------
  def transfer_player
    # Clear player place move call flag
    $game_temp.player_transferring = false
    # If move destination is different than current map
    if $game_map.map_id != $game_temp.player_new_map_id
      # Set up a new map
      $game_map.setup($game_temp.player_new_map_id)
      @location_window.refresh
    end
    # Set up player position
    $game_player.moveto($game_temp.player_new_x, $game_temp.player_new_y)
    # Set player direction
    case $game_temp.player_new_direction
    when 2  # down
      $game_player.turn_down
    when 4  # left
      $game_player.turn_left
    when 6  # right
      $game_player.turn_right
    when 8  # up
      $game_player.turn_up
    end
    # Straighten player position
    $game_player.straighten
    # Update map (run parallel process event)
    $game_map.update
    # Remake sprite set
    @spriteset.dispose
    @spriteset = Spriteset_Map.new
    # If processing transition
    if $game_temp.transition_processing
      # Clear transition processing flag
      $game_temp.transition_processing = false
      # Execute transition
      Graphics.transition(20)
    end
    # Run automatic change for BGM and BGS set on the map
    $game_map.autoplay
    # Frame reset
    Graphics.frame_reset
    # Update input information
    Input.update
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    # Loop
    loop do
      # Update map, interpreter, and player order
      # (this update order is important for when conditions are fulfilled
      # to run any event, and the player isn't provided the opportunity to
      # move in an instant)
      $game_map.update
      $game_system.map_interpreter.update
      $game_player.update
      # Update system (timer), screen
      $game_system.update
      $game_screen.update
      # Abort loop if player isn't place moving
      unless $game_temp.player_transferring
        break
      end
      # Run place move
      transfer_player
      # Abort loop if transition processing
      if $game_temp.transition_processing
        break
      end
    end
    # Update sprite set
    @spriteset.update
    # Update message window
    @message_window.update
    # Update location window
    @location_window.update
    # If game over
    if $game_temp.gameover
      # Switch to game over screen
      $scene = Scene_Gameover.new
      return
    end
    # If returning to title screen
    if $game_temp.to_title
      # Change to title screen
      $scene = Scene_Title.new
      return
    end
    # If transition processing
    if $game_temp.transition_processing
      # Clear transition processing flag
      $game_temp.transition_processing = false
      # Execute transition
      if $game_temp.transition_name == ""
        Graphics.transition(20)
      else
        Graphics.transition(40, "Graphics/Transitions/" +
          $game_temp.transition_name)
      end
    end
    # If showing message window
    if $game_temp.message_window_showing
      return
    end
    # If encounter list isn't empty, and encounter count is 0
    if $game_player.encounter_count == 0 and $game_map.encounter_list != []
      # If event is running or encounter is not forbidden
      unless $game_system.map_interpreter.running? or
             $game_system.encounter_disabled
        # Confirm troop
        n = rand($game_map.encounter_list.size)
        troop_id = $game_map.encounter_list[n]
        # If troop is valid
        if $data_troops[troop_id] != nil
          # Set battle calling flag
          $game_temp.battle_calling = true
          $game_temp.battle_troop_id = troop_id
          $game_temp.battle_can_escape = true
          $game_temp.battle_can_lose = false
          $game_temp.battle_proc = nil
        end
      end
    end
    # If B button was pressed
    if Input.trigger?(Input::B)
      # If event is running, or menu is not forbidden
      unless $game_system.map_interpreter.running? or
             $game_system.menu_disabled
        # Set menu calling flag or beep flag
        $game_temp.menu_calling = true
        $game_temp.menu_beep = true
      end
    end
    # If debug mode is ON and F9 key was pressed
    if $DEBUG and Input.press?(Input::F9)
      # Set debug calling flag
      $game_temp.debug_calling = true
    end
    # If player is not moving
    unless $game_player.moving?
      # Run calling of each screen
      if $game_temp.battle_calling
        call_battle
      elsif $game_temp.shop_calling
        call_shop
      elsif $game_temp.name_calling
        call_name
      elsif $game_temp.menu_calling
        call_menu
      elsif $game_temp.save_calling
        call_save
      elsif $game_temp.debug_calling
        call_debug
      end
    end
  end
end


Customization
You can define as many worlds as you want. Just be sure that you have them all written into the script under the constants sections.

Compatibility
Probably doesn't work with anything that modifies Scene_Map.

Screenshot


Installation
Paste the script into a new slot above Main.

FAQ


Terms and Conditions
Free to use however you want. I don't know why you'd want to. Just be sure to credit me and let me know so I can see your game!

This post has been edited by Sailerius: Jul 5 2009, 10:54 AM


__________________________
Go to the top of the page
 
+Quote Post
   
JEHINC.
post Sep 15 2009, 01:16 PM
Post #2


Level 5
Group Icon

Group: Member
Posts: 61
Type: Developer
RM Skill: Skilled




Not bad.


__________________________


Go to the top of the page
 
+Quote Post
   
dsoulja85
post Sep 19 2009, 03:06 PM
Post #3


Level 10
Group Icon

Group: Revolutionary
Posts: 160
Type: Developer
RM Skill: Skilled




for your first script not bad at all,
Go to the top of the page
 
+Quote Post
   
Taiine
post Oct 15 2009, 03:31 PM
Post #4


Level 17
Group Icon

Group: Revolutionary
Posts: 333
Type: Mapper
RM Skill: Advanced




Not sure what I'm doing wrong. I made a new game (just to try this) poped it in, left all the settings as is. Made a event for player touch set to control switch 1 to toggle viewing then a control variable to show the 'world' I wanted.

However nothing shows. I even tried it with a yes/no option item event and still nothing displays.

Am I doing something wrong here or?

This is something I've been looking for for a very long time (minus it saying the map map name) and had high hopes, but I can't get it to trigger.

This post has been edited by Taiine: Oct 15 2009, 03:32 PM


__________________________

an RMXP Game utilizing Blizz-ABS


Concept Projects: DASH! The Masters Game | Finny Adventures (temp title)
My first RMXP Script: Taiine's Solo Player Custom Menu System v0.6 (UPDATED 13th of Nov 10)

Go to the top of the page
 
+Quote Post
   
Pandemikk
post Oct 15 2009, 04:43 PM
Post #5


Level 19
Group Icon

Group: Revolutionary
Posts: 394
Type: Writer
RM Skill: Advanced




Try a parallel process that switches the switch on.


__________________________
Click here! Beware, once you click it you have to post no matter what! Mwahaha!



Looking for an intelligent debate? A challenger appears! Looking to exchange grandiloquent gibberish? A challenger disappears!
Go to the top of the page
 
+Quote Post
   
Taiine
post Oct 15 2009, 09:31 PM
Post #6


Level 17
Group Icon

Group: Revolutionary
Posts: 333
Type: Mapper
RM Skill: Advanced




That's nice, parallel process with one control switch to turn it on (and nothing else0

But making control variables wont change the town listed, it just stats at whatever you have as the first location in the list.

...also was hoping that this could be toggled. Like you walk over a player touch event, it comes up, shows the town name, then vanishes after # secs.

This post has been edited by Taiine: Oct 15 2009, 09:34 PM


__________________________

an RMXP Game utilizing Blizz-ABS


Concept Projects: DASH! The Masters Game | Finny Adventures (temp title)
My first RMXP Script: Taiine's Solo Player Custom Menu System v0.6 (UPDATED 13th of Nov 10)

Go to the top of the page
 
+Quote Post
   
Pandemikk
post Oct 15 2009, 09:44 PM
Post #7


Level 19
Group Icon

Group: Revolutionary
Posts: 394
Type: Writer
RM Skill: Advanced




Just make the parallel process wait for around 100-200 frames and then put in erase event. That way the screen will show up for about 10 seconds everytime you enter the map.


__________________________
Click here! Beware, once you click it you have to post no matter what! Mwahaha!



Looking for an intelligent debate? A challenger appears! Looking to exchange grandiloquent gibberish? A challenger disappears!
Go to the top of the page
 
+Quote Post
   
Taiine
post Oct 15 2009, 11:44 PM
Post #8


Level 17
Group Icon

Group: Revolutionary
Posts: 333
Type: Mapper
RM Skill: Advanced




QUOTE (Pandemikk @ Oct 15 2009, 10:44 PM) *
Just make the parallel process wait for around 100-200 frames and then put in erase event. That way the screen will show up for about 10 seconds everytime you enter the map.



But that is just it, I do not want it to just be when you enter the map. I was hoping with the way this was done, with the being able to change locations by variables that I could set different areas of the same map to display their own 'location'. as in you walk over an event, and it triggers to show the location your in then vanishes. Move somewhere else, walk over another and it shows another location.

as is even with having the location thing on all the time, regardless of the variable I set to show the different 'worlds' it still will only show just the first one.

This is the -only- location script I have ever found that did not only use the map name for the 'location' cause I really rather name them something I can better keep track of and sorted.


__________________________

an RMXP Game utilizing Blizz-ABS


Concept Projects: DASH! The Masters Game | Finny Adventures (temp title)
My first RMXP Script: Taiine's Solo Player Custom Menu System v0.6 (UPDATED 13th of Nov 10)

Go to the top of the page
 
+Quote Post
   
Pandemikk
post Oct 16 2009, 04:48 PM
Post #9


Level 19
Group Icon

Group: Revolutionary
Posts: 394
Type: Writer
RM Skill: Advanced




Then use a player touch before parallel process!

Make an event player touch, have that event "Turn Local Switch A ON"

On the next page(page2) make the precondition: "Local Switch a is on", make this event parallel process. Make it turn on the switch needed to display the map and location, then set wait 100-200 frames then "Turn Local Switch A OFF".


This will make it so when the player walks over the event the Script will show for around 5-10 seconds then disappear. It will also be re-usable.


__________________________
Click here! Beware, once you click it you have to post no matter what! Mwahaha!



Looking for an intelligent debate? A challenger appears! Looking to exchange grandiloquent gibberish? A challenger disappears!
Go to the top of the page
 
+Quote Post
   
Taiine
post Oct 17 2009, 12:03 AM
Post #10


Level 17
Group Icon

Group: Revolutionary
Posts: 333
Type: Mapper
RM Skill: Advanced




I'm afraid that is the very thing I tried first time around when experimenting with this to see if I can trigger it when you walk over the event and have it show just for a few then vanish.

Sadly doing that it will not trigger. I even added in a 'change screen tone' as a sign to be sure that yes, the trigger was indeed turning on and off as it should (and it did just fine). However the location window will not show.

It will only show if it is in an parallel process event with just Control Switches: [###: whatev] = ON and have it going just as that on the start with no switches or any such tacked to it. If it is a process event on event page 2 controled by a self switch it wont show. If there is any kind of switch in any order it wont show. Any poping in self switches, switches in gen, variables then the location no longer shows.

And it still regardless of what variable you set to display whatever 'world' you want for the map it will only show whatever you have in $WORLD[0] = "bla" and wont show any of the others.

Oh well... it was worth a shot.
I did come across this however http://www.atelier-rgss.com/RGSS/System/XP_SYS06.html and it's the only location script I've found that don't require the hub to be on screen all the time (it shows, waits so many secs then fades off) or only shown in the status screen. It just sadly still only works by the map name only and only when you first enter a map. Blarg, oh well. Guess it's time to suck it up and redo some maps to cut them into smaller maps so I can have my key locations.

This post has been edited by Taiine: Oct 17 2009, 12:06 AM


__________________________

an RMXP Game utilizing Blizz-ABS


Concept Projects: DASH! The Masters Game | Finny Adventures (temp title)
My first RMXP Script: Taiine's Solo Player Custom Menu System v0.6 (UPDATED 13th of Nov 10)

Go to the top of the page
 
+Quote Post
   
Pandemikk
post Oct 17 2009, 12:44 PM
Post #11


Level 19
Group Icon

Group: Revolutionary
Posts: 394
Type: Writer
RM Skill: Advanced




I'm testing it right now.

EDIT: Tested it on a brand new file. the World var works. You most likely are using the wrong switch in that instance. Match your World_Var = * with the same switch number you use in the variable.

However, the method I've told you about does not work. OP should probably get to fixing that. I tried numerous methods but only a parallel process on the first page without any switches will work.


Also OP, fix your script. I had to edit it twice before it would work on a new file. That's probably why the above doesn't work. (Removed extra === and removed an end)


__________________________
Click here! Beware, once you click it you have to post no matter what! Mwahaha!



Looking for an intelligent debate? A challenger appears! Looking to exchange grandiloquent gibberish? A challenger disappears!
Go to the top of the page
 
+Quote Post
   
Taiine
post Oct 17 2009, 05:31 PM
Post #12


Level 17
Group Icon

Group: Revolutionary
Posts: 333
Type: Mapper
RM Skill: Advanced




The var is set to 1, and my control var is set to 1 and yada yada.

Yeah I had to edit out the extra ==='s as well and the end.

If I can just get a converter for http://www.atelier-rgss.com/RGSS/System/XP_SYS06.html so ti can use something like this for the location names or even better something that you can add in a comment for the name and have it read that and put the text in it would be <3


__________________________

an RMXP Game utilizing Blizz-ABS


Concept Projects: DASH! The Masters Game | Finny Adventures (temp title)
My first RMXP Script: Taiine's Solo Player Custom Menu System v0.6 (UPDATED 13th of Nov 10)

Go to the top of the page
 
+Quote Post
   

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Lo-Fi Version Time is now: 21st May 2013 - 12:38 PM
RPG RPG Revolution is an Privacy Policy and Legal
eXTReMe Tracker