The RPG Maker Resource Kit

RMRK RPG Maker Creation => XP => XP Scripts Database => Topic started by: Tsunokiette on September 09, 2006, 06:19:26 PM

Title: Floating Locaiton Window
Post by: Tsunokiette on September 09, 2006, 06:19:26 PM
Credits go to Zeriab and me.

Code: [Select]
class Floating_Location < Window_Base

   def initialize
      @map_name = get_name
      @size = Win_Size.new(@map_name)
      width = @size[0]
      height = @size[1]
      super(0, 0, width+32, height+32)
      self.contents = Bitmap.new(width, height)
      self.opacity = 240
      self.back_opacity = 240
      self.contents_opacity = 240
      @frame_wait = Graphics.frame_count + 60
      refresh
   end

   def refresh
      self.contents.font.color = Color.new(217,87,0,255)
      self.contents.draw_text(0, 0, @size[0], @size[1], @map_name)
   end

   def update
      if get_name != @map_name
         self.dispose
         return
      end
      if @frame_wait <= Graphics.frame_count
         if self.opacity > 0
            self.opacity -= 20
            self.back_opacity -= 20
            self.contents_opacity -= 20
         else
            self.dispose
            return
         end
      end
   end

   def get_name
      data = load_data("Data/MapInfos.rxdata")
      data[$game_map.map_id].name
   end

end

class Win_Size < Window_Base
   
   def initialize(text)
      super(0, 0, 640, 480)
      self.contents = Bitmap.new(640 - 32, 480 - 32)
      @w = contents.text_size(text).width
      @h = contents.text_size(text).height
      self.dispose
    end
   
   def [](value)
     if value == 0
       return @w
     else
       return @h
     end
   end

end
 
class Scene_Map

   alias   :main_orig   :main
   alias   :update_orig   :update
   alias   :transfer_player_orig  :transfer_player

   def main
      @floating_location.dispose unless @floating_location.nil?
      @floating_location = Floating_Location.new
      main_orig
      @floating_location.dispose unless (@floating_location.disposed? or
                                         @floating_location.nil?)
   end

   def update
      @floating_location.update unless (@floating_location.disposed? or
                                        @floating_location.nil?)
      update_orig
   end
   
   def transfer_player
      transfer_player_orig
      @floating_location.dispose unless (@floating_location.disposed? or
                                        @floating_location.nil?)
      @floating_location = Floating_Location.new
   end
end
Title: Re: Floating Locaiton Window
Post by: Zeriab on September 09, 2006, 08:03:40 PM
There are some problems with it.

There's no 'def' for the draw_name function
You do not create a new object in the Scene_Map
Forgot the '.new' at the end.

Well... Actually there are more stuff wrong...
I'll try to fix it.
Title: Re: Floating Locaiton Window
Post by: Tsunokiette on September 09, 2006, 08:10:50 PM
There are some problems with it.

There's no 'def' for the draw_name function
You do not create a new object in the Scene_Map
Forgot the '.new' at the end.

Well... Actually there are more stuff wrong...
I'll try to fix it.

You're right about the 'def', but I left the .new off for a reason.

Read the update method and you'll see why.

EDIT : Actually I'm kind of confused about how to go with the whole thing. I tried to make it so it can resize based on the Map Name, but that's where I get confused.
EDIT 2 : Figured it out, will update script.
EDIT 3 : *updated*
Title: Re: Floating Locaiton Window
Post by: Zeriab on September 09, 2006, 10:50:40 PM
This works. I have tried to keep your style.

class Floating_Location < Window_Base

   def initialize
      @map_name = get_name
      @size = Win_Size.new(@map_name)
      width = @size[0]
      height = @size[1]
      super(0, 0, width+32, height+32)
      self.contents = Bitmap.new(width, height)
      self.opacity = 240
      self.back_opacity = 240
      self.contents_opacity = 240
      @frame_wait = Graphics.frame_count + 60
      refresh
   end

   def refresh
      self.contents.font.color = Color.new(217,87,0,255)
      self.contents.draw_text(0, 0, @size[0]+32, @size[1], @map_name)
   end

   def update
      if get_name != @map_name
         self.dispose
         return
      end
      if @frame_wait <= Graphics.frame_count
         if self.opacity > 0
            self.opacity -= 20
            self.back_opacity -= 20
            self.contents_opacity -= 20
         else
            self.dispose
            return
         end
      end
   end

   def get_name
      data = load_data("Data/MapInfos.rxdata")
      data[$game_map.map_id].name
   end

end

class Win_Size < Window_Base
   
   def initialize(text)
      super(0, 0, 640, 480)
      self.contents = Bitmap.new(640 - 32, 480 - 32)
      @w = contents.text_size(text).width
      @h = contents.text_size(text).height
      self.dispose
    end
   
   def [](value)
     if value == 0
       return @w
     else
       return @h
     end
   end

end
 
class Scene_Map

   alias   :main_orig   :main
   alias   :update_orig   :update
   alias   :transfer_player_orig  :transfer_player

   def main
      @floating_location.dispose unless @floating_location.nil?
      @floating_location = Floating_Location.new
      main_orig
      @floating_location.dispose unless (@floating_location.disposed? or
                                         @floating_location.nil?)
   end

   def update
      @floating_location.update unless (@floating_location.disposed? or
                                        @floating_location.nil?)
      update_orig
   end
   
   def transfer_player
      transfer_player_orig
      @floating_location.dispose unless (@floating_location.disposed? or
                                        @floating_location.nil?)
      @floating_location = Floating_Location.new
   end
end
Title: Re: Floating Locaiton Window
Post by: Tsunokiette on September 10, 2006, 04:31:02 PM
*does a happy dance*

Thanks.
Title: Re: Floating Locaiton Window
Post by: Nightwolf on September 13, 2006, 03:12:54 PM
this is supposed to make something float huh>
Title: Re: Floating Locaiton Window
Post by: Tsunokiette on September 13, 2006, 08:59:42 PM
this is supposed to make something float huh>


Just place it above main and you'll see what it does.
Title: Re: Floating Locaiton Window
Post by: Nightwolf on September 14, 2006, 09:30:30 AM
they say Rgss error
failed to create bitmap
Title: Re: Floating Location Window
Post by: Ericmor on September 15, 2006, 04:40:48 PM
What would be the "turn on/off" script calls for it? Because there are certain maps where this shouldn't appear (cutscenes, intros, etc).
 I tryied to insert one myself, but i suck SO MUCH on script :( I bet it is probably something simple...
Title: Re: Floating Locaiton Window
Post by: Tsunokiette on September 15, 2006, 07:40:46 PM
What would be the "turn on/off" script calls for it? Because there are certain maps where this shouldn't appear (cutscenes, intros, etc).
 I tryied to insert one myself, but i suck SO MUCH on script :( I bet it is probably something simple...

Replace the script with the following -

Code: [Select]
class Game_Party
      attr_accessor :floating_location
      alias :init_orig :initialize
      def initialize
            init_orig
            @floating_location = true
      end

      def enable_location
            @floating_location  = true
      end

      def disable_location
            @floating_location = false
      end

end

class Floating_Location < Window_Base

   def initialize
      @map_name = get_name
      @size = Win_Size.new(@map_name)
      width = @size[0]
      height = @size[1]
      super(0, 0, width+32, height+32)
      self.contents = Bitmap.new(width, height)
      self.opacity = 240
      self.back_opacity = 240
      self.contents_opacity = 240
      @frame_wait = Graphics.frame_count + 60
      refresh
   end

   def refresh
      self.contents.font.color = Color.new(217,87,0,255)
      self.contents.draw_text(0, 0, @size[0], @size[1], @map_name)
   end

   def update
      if $game_party.floating_location == false
            self.dispose
            return
      end
      if get_name != @map_name
         self.dispose
         return
      end
      if @frame_wait <= Graphics.frame_count
         if self.opacity > 0
            self.opacity -= 20
            self.back_opacity -= 20
            self.contents_opacity -= 20
         else
            self.dispose
            return
         end
      end
   end

   def get_name
      data = load_data("Data/MapInfos.rxdata")
      data[$game_map.map_id].name
   end

end

class Win_Size < Window_Base
   
   def initialize(text)
      super(0, 0, 640, 480)
      self.contents = Bitmap.new(640 - 32, 480 - 32)
      @w = contents.text_size(text).width
      @h = contents.text_size(text).height
      self.dispose
    end
   
   def [](value)
     if value == 0
       return @w
     else
       return @h
     end
   end

end
 
class Scene_Map

   alias   :main_orig   :main
   alias   :update_orig   :update
   alias   :transfer_player_orig  :transfer_player

   def main
      @floating_location.dispose unless @floating_location.nil?
      @floating_location = Floating_Location.new
      main_orig
      @floating_location.dispose unless (@floating_location.disposed? or
                                         @floating_location.nil?)
   end

   def update
      @floating_location.update unless (@floating_location.disposed? or
                                        @floating_location.nil?)
      update_orig
   end
   
   def transfer_player
      transfer_player_orig
      @floating_location.dispose unless (@floating_location.disposed? or
                                        @floating_location.nil?)
      @floating_location = Floating_Location.new
   end
end

Just use

$game_party.enable_location

and

$game_party.disable_location

It works theoreticly.
Title: Re: Floating Locaiton Window
Post by: Arrow on September 15, 2006, 09:47:52 PM
they say Rgss error
failed to create bitmap

Help us?
Title: Re: Floating Locaiton Window
Post by: Ericmor on September 16, 2006, 01:04:21 AM
Thanks Tsunokiette, but it doesn't work. Openning scene freezes if i place the instruction...
 Looks like it will be there on all sequences, for now...  :'(

 Arrowone, this "failed to create bitmap" error come from lack of correct bitmap or RTS resource pack... i think. Did you try it on a brand new project, to see if it work?
 
Title: Re: Floating Locaiton Window
Post by: Cody on September 16, 2006, 01:25:27 AM
It looks all nice and scripty.... but they're right, it doesn't work.

And... you spelled location wrong.

-I'm probably going to be beaten with a bag of pickles for that...-
Title: Re: Floating Locaiton Window
Post by: Arrow on September 16, 2006, 01:33:47 AM
...No, that I did not do. I will attempt to do so later.
Title: Re: Floating Locaiton Window
Post by: Tsunokiette on September 16, 2006, 03:19:18 PM
And... you spelled location wrong.

I know that, I'm too lazy to edit it lol.

@Ericmor - I don't know where that error would come from, all it does is check if a value is false and disposes of the window if it is, it works the same way when you change maps, except it's checking for true/false and not comparing map names.

EDIT : Perhaps this would work?

Code: [Select]
class Floating_Location < Window_Base

   def initialize
      @map_name = get_name
      if @map_name == ""
            @size = [32,32]
      else
            @size = Win_Size.new(@map_name)
      end
      width = @size[0]
      height = @size[1]
      super(0, 0, width+32, height+32)
      self.contents = Bitmap.new(width, height)
      self.opacity = 240
      self.back_opacity = 240
      self.contents_opacity = 240
      @frame_wait = Graphics.frame_count + 60
      refresh
   end

   def refresh
      self.contents.font.color = Color.new(217,87,0,255)
      self.contents.draw_text(0, 0, @size[0], @size[1], @map_name)
   end

   def update
      if @map_name == ""
         self.dispose
         return
      end
      if get_name != @map_name
         self.dispose
         return
      end
      if @frame_wait <= Graphics.frame_count
         if self.opacity > 0
            self.opacity -= 20
            self.back_opacity -= 20
            self.contents_opacity -= 20
         else
            self.dispose
            return
         end
      end
   end

   def get_name
      data = load_data("Data/MapInfos.rxdata")
      data[$game_map.map_id].name
   end

end

class Win_Size < Window_Base
   
   def initialize(text)
      super(0, 0, 640, 480)
      self.contents = Bitmap.new(640 - 32, 480 - 32)
      @w = contents.text_size(text).width
      @h = contents.text_size(text).height
      self.dispose
    end
   
   def [](value)
     if value == 0
       return @w
     else
       return @h
     end
   end

end
 
class Scene_Map

   alias   :main_orig   :main
   alias   :update_orig   :update
   alias   :transfer_player_orig  :transfer_player

   def main
      @floating_location.dispose unless @floating_location.nil?
      @floating_location = Floating_Location.new
      main_orig
      @floating_location.dispose unless (@floating_location.disposed? or
                                         @floating_location.nil?)
   end

   def update
      @floating_location.update unless (@floating_location.disposed? or
                                        @floating_location.nil?)
      update_orig
   end
   
   def transfer_player
      transfer_player_orig
      @floating_location.dispose unless (@floating_location.disposed? or
                                        @floating_location.nil?)
      @floating_location = Floating_Location.new
   end
end

Now I'm just jumping at theories, but try this and make the map have no name, no spaces either.
Title: Re: Floating Locaiton Window
Post by: Ericmor on September 16, 2006, 07:10:42 PM
Mmmm... nope, crash window changed, Tsunokiette. No difference if the map has a blank name, either.
 The message is:
  " NoMethod error ocurred while running script"
  " undefined method 'disable location' for "
  " #<Game_Party:0x1c40a80> "

... is just me, or somebody else has got the same error? Maybe is a conflict with another script? Not unusual, i myself had to delete WorlMap script from Nearfantastica because of conflicts with the caterpillar system.
Well... anyway, good work, thanks.
Title: Re: Floating Locaiton Window
Post by: Tsunokiette on September 16, 2006, 09:45:55 PM
Mmmm... nope, crash window changed, Tsunokiette. No difference if the map has a blank name, either.
 The message is:
 " NoMethod error ocurred while running script"
 " undefined method 'disable location' for "
 " #<Game_Party:0x1c40a80> "

... is just me, or somebody else has got the same error? Maybe is a conflict with another script? Not unusual, i myself had to delete WorlMap script from Nearfantastica because of conflicts with the caterpillar system.
Well... anyway, good work, thanks.

That's because you didn't remove those commands from your events, they don't exist anymore in this version.
Title: Re: Floating Locaiton Window
Post by: Ericmor on September 16, 2006, 11:19:09 PM
Oh, i got it! You forgot to tell that this version work without instructions... Ok.
 So, scenarios where we don't want the names showing up... must just have a blank name. Cool.
 In addition: even being blank, the windows still show up in corner for a brief moment... i changed the 'empty' window size in code to 1x1 instead of 32x32 , it is less noticeable this way (i did try 0x0, but script crashes).
 Again, good work!  ;D
Title: Re: Floating Locaiton Window
Post by: Tsunokiette on September 17, 2006, 04:14:39 PM
Oh, i got it! You forgot to tell that this version work without instructions... Ok.
 So, scenarios where we don't want the names showing up... must just have a blank name. Cool.
 In addition: even being blank, the windows still show up in corner for a brief moment... i changed the 'empty' window size in code to 1x1 instead of 32x32 , it is less noticeable this way (i did try 0x0, but script crashes).
 Again, good work! ;D

Just for fun and for touch ups, replace the initialize with this -

Code: [Select]
   def initialize
      @map_name = get_name
      if @map_name == ""
            @size = [32,32]
      else
            @size = Win_Size.new(@map_name)
      end
      width = @size[0]
      height = @size[1]
      super(0, 0, width+32, height+32)
      self.contents = Bitmap.new(width, height)
      if @map_name == ""
            self.visible = false
      else     
            self.opacity = 240
            self.back_opacity = 240
            self.contents_opacity = 240
      end
      @frame_wait = Graphics.frame_count + 60
      refresh
   end
Title: Re: Floating Locaiton Window
Post by: Arrow on September 17, 2006, 07:34:26 PM
Hey, Tsuno? How do I make a floating MESSAGE window appear in the bottom/center of the screen? The window would need to be sort of transparent, and but text would still be solid.
Title: Re: Floating Locaiton Window
Post by: Ericmor on September 17, 2006, 08:44:30 PM
Hey, no blinking window in empty map names now! Good work, Tsunokiette!  ;D

Arrowone:
 inside the script, on lines 24 approximately, there's a instructin called 'super':
 
Code: [Select]
...
 super(0, 0, width+32, height+32)
...
 

 plain simple: just swap the first two zeros by the coordinates where you want the screen
 to appear. like:
 
Code: [Select]
...
 super(width+32,height+208, width+32, height+32)
...
 
That would make the windows appear right on the middle of the screen.
 For bottom screen:
 
Code: [Select]
...
 super(width+32,height+400, width+32, height+32)
...
 
You can place decimal values like "320" or "240", but 'Width' and 'height' added or subtractcted by the values give precise screen coordinates that changes depending the size in letters of the maps name. Course, maybe Tsuno release a next version with script call to change the place of the windows, but...  :P

----EDIT: Ops... wrong values in the first post :P
Title: Re: Floating Locaiton Window
Post by: Arrow on September 17, 2006, 09:12:27 PM
Thanks man, I really appreciate this.
Title: Re: Floating Locaiton Window
Post by: Zeriab on September 17, 2006, 09:53:11 PM
@Ericmor: Good try, but you're not quite there. (Except the first)

Here's an 'enhanced' script while we wait for Tsuno to make a proper one. (Yes I am lazy)
You can change the alignment of the window rather easily here. Script:
Code: [Select]
class Floating_Location < Window_Base
   #--------------------------------------------------------------------------
   # The position of the window
   # [x,y]
   #
   # x = 1 => left
   # x = 2 => center
   # x = 3 => right
   #
   # y = 1 => top
   # y = 2 => center
   # y = 3 => bottom
   #--------------------------------------------------------------------------
   POSITION = [2,3]
   def initialize
      @map_name = get_name
      if @map_name == ""
            @size = [32,32]
      else
            @size = Win_Size.new(@map_name)
      end
      width = @size[0]
      height = @size[1]
     
      case POSITION[0]
      when 1
        ox = 0
      when 2
        ox = 640-(width+32)
        ox = ox/2
      when 3
        ox = 640-(width+32)
      end
     
      case POSITION[1]
      when 1
        oy = 0
      when 2
        oy = 480-(height+32)
        oy = oy/2
      when 3
        oy = 480-(height+32)
      end
     
      super(ox, oy, width+32, height+32)
      self.contents = Bitmap.new(width, height)
      if @map_name == ""
            self.visible = false
      else     
            self.opacity = 240
            self.back_opacity = 240
            self.contents_opacity = 240
      end
      @frame_wait = Graphics.frame_count + 60
      refresh
   end

   def refresh
      self.contents.font.color = Color.new(217,87,0,255)
      self.contents.draw_text(0, 0, @size[0], @size[1], @map_name)
   end

   def update
      if @map_name == ""
         self.dispose
         return
      end
      if get_name != @map_name
         self.dispose
         return
      end
      if @frame_wait <= Graphics.frame_count
         if self.opacity > 0
            self.opacity -= 20
            self.back_opacity -= 20
            self.contents_opacity -= 20
         else
            self.dispose
            return
         end
      end
   end

   def get_name
      data = load_data("Data/MapInfos.rxdata")
      data[$game_map.map_id].name
   end

end

class Win_Size < Window_Base
   
   def initialize(text)
      super(0, 0, 640, 480)
      self.contents = Bitmap.new(640 - 32, 480 - 32)
      @w = contents.text_size(text).width
      @h = contents.text_size(text).height
      self.dispose
    end
   
   def [](value)
     if value == 0
       return @w
     else
       return @h
     end
   end

end
 
class Scene_Map

   alias   :main_orig   :main
   alias   :update_orig   :update
   alias   :transfer_player_orig  :transfer_player

   def main
      @floating_location.dispose unless @floating_location.nil?
      @floating_location = Floating_Location.new
      main_orig
      @floating_location.dispose unless (@floating_location.disposed? or
                                         @floating_location.nil?)
   end

   def update
      @floating_location.update unless (@floating_location.disposed? or
                                        @floating_location.nil?)
      update_orig
   end
   
   def transfer_player
      transfer_player_orig
      @floating_location.dispose unless (@floating_location.disposed? or
                                        @floating_location.nil?)
      @floating_location = Floating_Location.new
   end
end
Just change the values in 'POSITION = [2,3]'
Change the 2 and 3 to whatever value you feel like.

For the first value:
1 => left
2 => center
3 => right

For the second value
1 => top
2 => center
3 => bottom

So in this case the window will be placed in the center on the bottom of the screen.


I know this is rather sucky, but then again... I only used 10 minutes on this.
Title: Re: Floating Locaiton Window
Post by: Arrow on September 17, 2006, 09:55:27 PM
Thanks a bunch man!
Title: Re: Floating Locaiton Window
Post by: Ericmor on September 18, 2006, 12:30:52 PM
Nice work, Zeriab! I didn't noticed that those variables of mine didn't quite work until i changed maps this morning... Heh...  :-[
 They only work on the FIRST map you try, that's why i didn't notice... when you change  to another scenario, the coordinates change. Your code fixes that.
 I may be ahead of myself, but here are things that people may want to control with script calls:
 - Transparency control of text/window (set to 0% to make it disappear!)
 - Color control
 - Size control
 - Typewriter effect

 He!he!... sorry, couldn't restrain myself ;D
Title: Re: Floating Locaiton Window
Post by: Nightwolf on September 19, 2006, 03:36:46 AM
they still say failed to create bitmap
AND
the error is always on the line 13
(Bitmap.new one)
or 46 in Zeriabs (same bitmap one)
Title: Re: Floating Locaiton Window
Post by: Zeriab on September 19, 2006, 04:18:51 AM
Try to insert this right above 'self.contents = Bitmap.new(width, height)'

Code: [Select]
p width, height

If you get a popup with 2 nils that is the reason of the failure.
Title: Re: Floating Locaiton Window
Post by: Blizzard on September 19, 2006, 09:04:47 AM
Or two zeros or one zero. Believe me, I tried it.
Title: Re: Floating Locaiton Window
Post by: Nightwolf on September 21, 2006, 06:27:48 AM
i get 2 0's
and the same error
AGAIn
Title: Re: Floating Locaiton Window
Post by: Tsunokiette on September 21, 2006, 10:44:54 AM
I wouldn't know what's going on, unless you have Map with no name, except you have spaces in it.
That's all I can think of.
Title: Re: Floating Locaiton Window
Post by: Nightwolf on September 21, 2006, 01:45:25 PM
all of my maps have a one word name
Title: Re: Floating Locaiton Window
Post by: Tsunokiette on September 21, 2006, 07:24:07 PM
Then I can't help you, sadly.

What line gives the error? (I think it would be obvious, but you never know)
Title: Re: Floating Locaiton Window
Post by: Nightwolf on September 22, 2006, 08:19:48 AM
the same bitmap one i spose
Title: Re: Floating Locaiton Window
Post by: Tsunokiette on October 10, 2006, 03:16:28 AM
Try replacing the Win_Size class with the following -

Code: [Select]
class Win_Size < Window_Base
   
   def initialize(text)
      super(0, 0, 640, 480)
      self.contents = Bitmap.new(640 - 32, 480 - 32)
      @w = contents.text_size(text).width
      @h = contents.text_size(text).height
      if @w == 0
         @w = 200
      elsif @h == 0
         @h = 80
      end
      self.dispose
   end
   
   def [](value)
     if value == 0
       return @w
     else
       return @h
     end
   end

end

This way it should return 200 * 80 if the values are zero.

But I don't know how'd they would get that way in the first place.
Title: Re: Floating Locaiton Window
Post by: Mirak on October 10, 2006, 03:23:37 AM
The script doesn't work, says something about syntax error
Title: Re: Floating Locaiton Window
Post by: Tsunokiette on October 10, 2006, 03:27:41 AM
This is the newest version -

Code: [Select]
class Floating_Location < Window_Base

      def initialize
      @map_name = get_name
      if @map_name == ""
            @size = [32,32]
      else
            @size = Win_Size.new(@map_name)
      end
      width = @size[0]
      height = @size[1]
      super(0, 0, width+32, height+32)
      self.contents = Bitmap.new(width, height)
      if @map_name == ""
            self.visible = false
      else     
            self.opacity = 240
            self.back_opacity = 240
            self.contents_opacity = 240
      end
      @frame_wait = Graphics.frame_count + 100
      refresh
   end

   def refresh
      self.contents.font.color = Color.new(217,87,0,255)
      self.contents.draw_text(0, 0, @size[0], @size[1], @map_name)
   end

   def update
      if @map_name == ""
         self.dispose
         return
      end
      if get_name != @map_name
         self.dispose
         return
      end
      if @frame_wait <= Graphics.frame_count
         if self.opacity > 0
            self.opacity -= 10
            self.back_opacity -= 10
            self.contents_opacity -=10
         else
            self.dispose
            return
         end
      end
   end

   def get_name
      data = load_data("Data/MapInfos.rxdata")
      data[$game_map.map_id].name
   end

end

class Win_Size < Window_Base
   
   def initialize(text)
      super(0, 0, 640, 480)
      self.contents = Bitmap.new(640 - 32, 480 - 32)
      @w = contents.text_size(text).width
      @h = contents.text_size(text).height
      if @w == 0
         @w = 200
      elsif @h == 0
         @h = 80
      end
      self.dispose
   end
   
   def [](value)
     if value == 0
       return @w
     else
       return @h
     end
   end

end
 
class Scene_Map

   alias   :main_orig   :main
   alias   :update_orig   :update
   alias   :transfer_player_orig  :transfer_player

   def main
      @floating_location.dispose unless @floating_location.nil?
      @floating_location = Floating_Location.new
      main_orig
      @floating_location.dispose unless (@floating_location.disposed? or
                                         @floating_location.nil?)
   end

   def update
      @floating_location.update unless (@floating_location.disposed? or
                                        @floating_location.nil?)
      update_orig
   end
   
   def transfer_player
      transfer_player_orig
      @floating_location.dispose unless (@floating_location.disposed? or
                                        @floating_location.nil?)
      @floating_location = Floating_Location.new
   end
end

And to disable the window on a map, just make the map have no name, no spaces either.
Title: Re: Floating Locaiton Window
Post by: Mirak on October 10, 2006, 03:51:08 AM
Man, the same old error:
Code: [Select]
line 18 RGSS error, failed to create bitmap
Title: Re: Floating Locaiton Window
Post by: Tsunokiette on October 10, 2006, 03:57:39 AM
Well, something weird is going on here, because this is line 18 =

Code: [Select]
self.back_opacity = 240

And the bitmap is created way before that...

Did you paste the entire script I supplied above main in one slot?
Title: Re: Floating Locaiton Window
Post by: Mirak on October 10, 2006, 04:00:41 AM
Meh sorry, it says 'line 13'
Title: Re: Floating Locaiton Window
Post by: Starrodkirby86 on October 19, 2006, 11:39:36 PM
Oooo...interesting script. I like it.

---

So far i'm not getting any errors.
Title: Re: Floating Locaiton Window
Post by: xeros on May 10, 2007, 08:35:38 AM
wow!, this script is awesome, very nice script!  ;8
Title: Re: Floating Locaiton Window
Post by: Zeriab on May 10, 2007, 04:11:20 PM
Here's a version where you can specify which maps you want the feature disabled for:
Also... I fixed a small issue where the code checks if the @floating_location is disposed before it checks for nil. Should be the other way around as the nil class don't have the disposed? method.

Code: [Select]
class Floating_Location < Window_Base
   #--------------------------------------------------------------------------
   # The position of the window
   # [x,y]
   #
   # x = 1 => left
   # x = 2 => center
   # x = 3 => right
   #
   # y = 1 => top
   # y = 2 => center
   # y = 3 => bottom
   #--------------------------------------------------------------------------
   POSITION = [2,3]
   def initialize
      @map_name = get_name
      if @map_name == ""
            @size = [32,32]
      else
            @size = Win_Size.new(@map_name)
      end
      width = @size[0]
      height = @size[1]
     
      case POSITION[0]
      when 1
        ox = 0
      when 2
        ox = 640-(width+32)
        ox = ox/2
      when 3
        ox = 640-(width+32)
      end
     
      case POSITION[1]
      when 1
        oy = 0
      when 2
        oy = 480-(height+32)
        oy = oy/2
      when 3
        oy = 480-(height+32)
      end
     
      super(ox, oy, width+32, height+32)
      self.contents = Bitmap.new(width, height)
      if @map_name == ""
            self.visible = false
      else     
            self.opacity = 240
            self.back_opacity = 240
            self.contents_opacity = 240
      end
      @frame_wait = Graphics.frame_count + 60
      refresh
   end

   def refresh
      self.contents.font.color = Color.new(217,87,0,255)
      self.contents.draw_text(0, 0, @size[0], @size[1], @map_name)
   end

   def update
      if @map_name == ""
         self.dispose
         return
      end
      if get_name != @map_name
         self.dispose
         return
      end
      if @frame_wait <= Graphics.frame_count
         if self.opacity > 0
            self.opacity -= 20
            self.back_opacity -= 20
            self.contents_opacity -= 20
         else
            self.dispose
            return
         end
      end
   end

   def get_name
      data = load_data("Data/MapInfos.rxdata")
      data[$game_map.map_id].name
   end

end

class Win_Size < Window_Base
   
   def initialize(text)
      super(0, 0, 640, 480)
      self.contents = Bitmap.new(640 - 32, 480 - 32)
      @w = contents.text_size(text).width
      @h = contents.text_size(text).height
      self.dispose
    end
   
   def [](value)
     if value == 0
       return @w
     else
       return @h
     end
   end

end
 
class Scene_Map
   DISABLED_MAP_IDS = [2,3] # Change this to the map IDs of the map you don't want the feature for.

   alias   :main_orig   :main
   alias   :update_orig   :update
   alias   :transfer_player_orig  :transfer_player

   def main
      @floating_location.dispose unless @floating_location.nil?
      unless DISABLED_MAP_IDS.include?($game_map.map_id)
        @floating_location = Floating_Location.new
      end
      main_orig
      @floating_location.dispose unless (@floating_location.nil? or
                                         @floating_location.disposed?)
   end

   def update
      @floating_location.update unless (@floating_location.nil? or
                                        @floating_location.disposed?)
      update_orig
   end
   
   def transfer_player
      transfer_player_orig
      @floating_location.dispose unless (@floating_location.nil? or
                                        @floating_location.disposed?)
      unless DISABLED_MAP_IDS.include?($game_map.map_id)
        @floating_location = Floating_Location.new
      end
   end
end
Title: Re: Floating Locaiton Window
Post by: Isith88 on May 10, 2007, 10:25:50 PM
Here's a version where you can specify which maps you want the feature disabled for:
Also... I fixed a small issue where the code checks if the @floating_location is disposed before it checks for nil. Should be the other way around as the nil class don't have the disposed? method.

Good script, I've got it working for the most part.  There's a problem though whenever I'm in an area where the Floating Location Window is active.  When I access the menu and then exit it, the FLW shows up again.  It only needs to show up when the player enters the area from an outside location.  Any idea how to fix this?
Title: Re: Floating Locaiton Window
Post by: Zeriab on May 11, 2007, 08:47:02 AM
Here:
Just turn the switch specified at line 113 on and off.
If the switch is ON the message will be displayed, though only if it is on an allowed map.
If the switch is OFF the message will never be displayed.

Code: [Select]
class Floating_Location < Window_Base
   #--------------------------------------------------------------------------
   # The position of the window
   # [x,y]
   #
   # x = 1 => left
   # x = 2 => center
   # x = 3 => right
   #
   # y = 1 => top
   # y = 2 => center
   # y = 3 => bottom
   #--------------------------------------------------------------------------
   POSITION = [2,3]
   def initialize
      @map_name = get_name
      if @map_name == ""
            @size = [32,32]
      else
            @size = Win_Size.new(@map_name)
      end
      width = @size[0]
      height = @size[1]
     
      case POSITION[0]
      when 1
        ox = 0
      when 2
        ox = 640-(width+32)
        ox = ox/2
      when 3
        ox = 640-(width+32)
      end
     
      case POSITION[1]
      when 1
        oy = 0
      when 2
        oy = 480-(height+32)
        oy = oy/2
      when 3
        oy = 480-(height+32)
      end
     
      super(ox, oy, width+32, height+32)
      self.contents = Bitmap.new(width, height)
      if @map_name == ""
            self.visible = false
      else     
            self.opacity = 240
            self.back_opacity = 240
            self.contents_opacity = 240
      end
      @frame_wait = Graphics.frame_count + 60
      refresh
   end

   def refresh
      self.contents.font.color = Color.new(217,87,0,255)
      self.contents.draw_text(0, 0, @size[0], @size[1], @map_name)
   end

   def update
      if @map_name == ""
         self.dispose
         return
      end
      if get_name != @map_name
         self.dispose
         return
      end
      if @frame_wait <= Graphics.frame_count
         if self.opacity > 0
            self.opacity -= 20
            self.back_opacity -= 20
            self.contents_opacity -= 20
         else
            self.dispose
            return
         end
      end
   end

   def get_name
      data = load_data("Data/MapInfos.rxdata")
      data[$game_map.map_id].name
   end

end

class Win_Size < Window_Base
   
   def initialize(text)
      super(0, 0, 640, 480)
      self.contents = Bitmap.new(640 - 32, 480 - 32)
      @w = contents.text_size(text).width
      @h = contents.text_size(text).height
      self.dispose
    end
   
   def [](value)
     if value == 0
       return @w
     else
       return @h
     end
   end

end
 
class Scene_Map
   DISABLED_NUMBERS = [2,3] # Change this to the map IDs of the map you don't want the feature for.
   ENABLED_SWITCH = 5 # The Switch Number

   alias   :main_orig   :main
   alias   :update_orig   :update
   alias   :transfer_player_orig  :transfer_player

   def main
      @floating_location.dispose unless @floating_location.nil?
      unless !$game_switches[ENABLED_SWITCH] or
              DISABLED_NUMBERS.include?($game_map.map_id)
        @floating_location = Floating_Location.new
      end
      main_orig
      @floating_location.dispose unless (@floating_location.nil? or
                                         @floating_location.disposed?)
   end

   def update
      @floating_location.update unless (@floating_location.nil? or
                                        @floating_location.disposed?)
      update_orig
   end
   
   def transfer_player
      transfer_player_orig
      @floating_location.dispose unless (@floating_location.nil? or
                                        @floating_location.disposed?)
      unless !$game_switches[ENABLED_SWITCH] or
              DISABLED_NUMBERS.include?($game_map.map_id)
        @floating_location = Floating_Location.new
      end
   end
end
Title: Re: Floating Locaiton Window
Post by: Isith88 on May 11, 2007, 03:59:07 PM
Here:
Just turn the switch specified at line 113 on and off.
If the switch is ON the message will be displayed, though only if it is on an allowed map.
If the switch is OFF the message will never be displayed.
Thanks!  I appreciate the help.
Title: Re: Floating Locaiton Window
Post by: DarkLordX on June 12, 2007, 09:59:38 PM
... is there any way I can completely disable the script and then call it up again later? I'm trying to stop the map names from popping up during cutscenes.

Any help would be greatly appreciated.


Note: I'm looking for something to actually disable the script... the maps the cutscenes interchange on are both enormous and widely used.
Title: Re: Floating Locaiton Window
Post by: Zeriab on June 14, 2007, 06:01:35 PM
Here:
Just turn the switch specified at line 113 on and off.
If the switch is ON the message will be displayed, though only if it is on an allowed map.
If the switch is OFF the message will never be displayed.

If you have just copied and pasted the script then you have
Code: [Select]
ENABLED_SWITCH = 5 # The Switch Number
Just turn switch 5 off during cutscenes and on again afterwards.
Title: Re: Floating Locaiton Window
Post by: DarkLordX on June 14, 2007, 09:54:01 PM
Ah... thanks Zeriab. I'd thought that was referring only to the map allowed/disallowed function... my bad.

Btw... sent you an email due to the fact that Brewmeister hasn't been on in a good while.
Title: Re: Floating Locaiton Window
Post by: diablosbud on December 13, 2007, 01:47:03 AM
I'm sorry, just wondering since I have Blizz's ABS script with HUD enable it overlaps the loaction window  :-\. Could someone please explain to me how to change the coordinents (not sure how to spell that  :-[) of the window?
Title: Re: Floating Locaiton Window
Post by: modern algebra on December 13, 2007, 04:13:18 AM
@Ericmor: Good try, but you're not quite there. (Except the first)

Here's an 'enhanced' script while we wait for Tsuno to make a proper one. (Yes I am lazy)
You can change the alignment of the window rather easily here. Script:
Code: [Select]
class Floating_Location < Window_Base
   #--------------------------------------------------------------------------
   # The position of the window
   # [x,y]
   #
   # x = 1 => left
   # x = 2 => center
   # x = 3 => right
   #
   # y = 1 => top
   # y = 2 => center
   # y = 3 => bottom
   #--------------------------------------------------------------------------
   POSITION = [2,3]
   def initialize
      @map_name = get_name
      if @map_name == ""
            @size = [32,32]
      else
            @size = Win_Size.new(@map_name)
      end
      width = @size[0]
      height = @size[1]
     
      case POSITION[0]
      when 1
        ox = 0
      when 2
        ox = 640-(width+32)
        ox = ox/2
      when 3
        ox = 640-(width+32)
      end
     
      case POSITION[1]
      when 1
        oy = 0
      when 2
        oy = 480-(height+32)
        oy = oy/2
      when 3
        oy = 480-(height+32)
      end
     
      super(ox, oy, width+32, height+32)
      self.contents = Bitmap.new(width, height)
      if @map_name == ""
            self.visible = false
      else     
            self.opacity = 240
            self.back_opacity = 240
            self.contents_opacity = 240
      end
      @frame_wait = Graphics.frame_count + 60
      refresh
   end

   def refresh
      self.contents.font.color = Color.new(217,87,0,255)
      self.contents.draw_text(0, 0, @size[0], @size[1], @map_name)
   end

   def update
      if @map_name == ""
         self.dispose
         return
      end
      if get_name != @map_name
         self.dispose
         return
      end
      if @frame_wait <= Graphics.frame_count
         if self.opacity > 0
            self.opacity -= 20
            self.back_opacity -= 20
            self.contents_opacity -= 20
         else
            self.dispose
            return
         end
      end
   end

   def get_name
      data = load_data("Data/MapInfos.rxdata")
      data[$game_map.map_id].name
   end

end

class Win_Size < Window_Base
   
   def initialize(text)
      super(0, 0, 640, 480)
      self.contents = Bitmap.new(640 - 32, 480 - 32)
      @w = contents.text_size(text).width
      @h = contents.text_size(text).height
      self.dispose
    end
   
   def [](value)
     if value == 0
       return @w
     else
       return @h
     end
   end

end
 
class Scene_Map

   alias   :main_orig   :main
   alias   :update_orig   :update
   alias   :transfer_player_orig  :transfer_player

   def main
      @floating_location.dispose unless @floating_location.nil?
      @floating_location = Floating_Location.new
      main_orig
      @floating_location.dispose unless (@floating_location.disposed? or
                                         @floating_location.nil?)
   end

   def update
      @floating_location.update unless (@floating_location.disposed? or
                                        @floating_location.nil?)
      update_orig
   end
   
   def transfer_player
      transfer_player_orig
      @floating_location.dispose unless (@floating_location.disposed? or
                                        @floating_location.nil?)
      @floating_location = Floating_Location.new
   end
end
Just change the values in 'POSITION = [2,3]'
Change the 2 and 3 to whatever value you feel like.

For the first value:
1 => left
2 => center
3 => right

For the second value
1 => top
2 => center
3 => bottom

So in this case the window will be placed in the center on the bottom of the screen.


I know this is rather sucky, but then again... I only used 10 minutes on this.
Title: Re: Floating Locaiton Window
Post by: diablosbud on December 13, 2007, 12:04:04 PM
Thank you very much again Modern Algebra your a great help to this forum  ;)...
Title: Re: Floating Locaiton Window
Post by: modern algebra on December 13, 2007, 03:32:38 PM
Don't thank me. All I did was quote Zeriab :P
Title: Re: Floating Locaiton Window
Post by: Lavoakah on February 07, 2008, 09:31:02 PM
Oh wow!  :o
This is so useful! Thanks! You guys rule!  :D
Title: Re: Floating Locaiton Window
Post by: Tsunokiette on February 14, 2008, 02:35:34 AM
Hmm, I just got an idea. I'll be back at about midnight with an update.
Title: Cautions: common, adversity convulsions hardly talking, neurosteroids.
Post by: ixeyikapojec on August 22, 2019, 08:57:04 PM
Now nti.exal.rmrk.net.cch.va amputations bitterness, cialis.com (http://ivapelocal.com/cialis-20-mg/) amoxicillin buy (http://gaiaenergysystems.com/amoxicillin/) cheap desyrel (http://theatreghost.com/desyrel/) plaquenil (http://dallasmarketingservices.com/plaquenil/) online plaquenil isoniazid without a prescription (http://huekymigia.com/isoniazid/) openly <a href="http://ivapelocal.com/cialis-20-mg/">cialis 20mg</a> <a href="http://gaiaenergysystems.com/amoxicillin/">amoxil 500 mg</a> <a href="http://theatreghost.com/desyrel/">desyrel pills</a> <a href="http://dallasmarketingservices.com/plaquenil/">plaquenil without dr prescription</a> <a href="http://huekymigia.com/isoniazid/">isoniazid for sale</a> ethmoidal, knife heal, http://ivapelocal.com/cialis-20-mg/ generic cialis lowest price generic cialis lowest price http://gaiaenergysystems.com/amoxicillin/ 500 mg amoxicillin dosage amoxicillin http://theatreghost.com/desyrel/ desyrel http://dallasmarketingservices.com/plaquenil/ plaquenil http://huekymigia.com/isoniazid/ generic isoniazid guanethidine quality abortion saccule.
Title: Advise supra-sellar risen ingredient murmurs.
Post by: amiviwefuaq on August 23, 2019, 06:36:49 PM
Trusts yor.rlbs.rmrk.net.rjv.gl withdraw distasteful twice-weekly buy cialis online (http://ivapelocal.com/generic-cialis/) cialis 5 mg noroxin (http://innatorchardheights.com/noroxin/) rogaine 5 without a prescription (http://cgodirek.com/rogaine-5/) rogaine 5 for sale toprol xl (http://cgodirek.com/toprol-xl/) buy risperdal (http://dallasmarketingservices.com/risperdal/) physiologically <a href="http://ivapelocal.com/generic-cialis/">generic cialis</a> <a href="http://innatorchardheights.com/noroxin/">noroxin</a> <a href="http://cgodirek.com/rogaine-5/">rogaine 5 without dr prescription</a> online rogaine 5 <a href="http://cgodirek.com/toprol-xl/">online toprol xl</a> <a href="http://dallasmarketingservices.com/risperdal/">risperdal online</a> risperdal pills obvious, routes pace http://ivapelocal.com/generic-cialis/ tadalafil 20mg http://innatorchardheights.com/noroxin/ online noroxin http://cgodirek.com/rogaine-5/ rogaine 5 http://cgodirek.com/toprol-xl/ price of toprol xl http://dallasmarketingservices.com/risperdal/ risperdal low-tension lids predisposed prominent.