RMRK is retiring.
Registration is disabled. The site will remain online, but eventually become a read-only archive. More information.
Floating Locaiton Window

0 Members and 1 Guest are viewing this topic.

*
Full Metal Mod - He will pillage your women!
Rep:
Level 93
The RGSS Dude
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
« Last Edit: September 13, 2006, 08:59:05 PM by Tsunokiette »
"The wonderful thing about Tiggers
Is Tiggers are wonderful things
Their tops are made out of rubber
Their bottoms are made out of springs

They’re bouncy, trouncy, flouncy, pouncy
Fun, fun, fun, fun, fun!
But the most wonderful thing about Tiggers
Is I’m the only one, I’m the only one."

*
? ? ? ? ? ? ? ? ? The nice kind of alien~
Rep:
Level 92
Martian - Occasionally kind
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.

*
Full Metal Mod - He will pillage your women!
Rep:
Level 93
The RGSS Dude
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*
« Last Edit: September 09, 2006, 08:32:23 PM by Tsunokiette »
"The wonderful thing about Tiggers
Is Tiggers are wonderful things
Their tops are made out of rubber
Their bottoms are made out of springs

They’re bouncy, trouncy, flouncy, pouncy
Fun, fun, fun, fun, fun!
But the most wonderful thing about Tiggers
Is I’m the only one, I’m the only one."

*
? ? ? ? ? ? ? ? ? The nice kind of alien~
Rep:
Level 92
Martian - Occasionally kind
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

*
Full Metal Mod - He will pillage your women!
Rep:
Level 93
The RGSS Dude
*does a happy dance*

Thanks.
"The wonderful thing about Tiggers
Is Tiggers are wonderful things
Their tops are made out of rubber
Their bottoms are made out of springs

They’re bouncy, trouncy, flouncy, pouncy
Fun, fun, fun, fun, fun!
But the most wonderful thing about Tiggers
Is I’m the only one, I’m the only one."

*
I love Firerain
Rep:
Level 97
=D
this is supposed to make something float huh>
Arlen is hot.

*
Full Metal Mod - He will pillage your women!
Rep:
Level 93
The RGSS Dude
this is supposed to make something float huh>


Just place it above main and you'll see what it does.
"The wonderful thing about Tiggers
Is Tiggers are wonderful things
Their tops are made out of rubber
Their bottoms are made out of springs

They’re bouncy, trouncy, flouncy, pouncy
Fun, fun, fun, fun, fun!
But the most wonderful thing about Tiggers
Is I’m the only one, I’m the only one."

*
I love Firerain
Rep:
Level 97
=D
they say Rgss error
failed to create bitmap
Arlen is hot.

***
Rep:
Level 88
I hate to hate things.
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...
I need some real WORKING AVI script in RMXP!
3D ANIMATIONS:
http://www.youtube.com/profile?user=Ericmor
3D and 2D anime ART:
http://ericmor.deviantart.com/gallery/

*
Full Metal Mod - He will pillage your women!
Rep:
Level 93
The RGSS Dude
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.
"The wonderful thing about Tiggers
Is Tiggers are wonderful things
Their tops are made out of rubber
Their bottoms are made out of springs

They’re bouncy, trouncy, flouncy, pouncy
Fun, fun, fun, fun, fun!
But the most wonderful thing about Tiggers
Is I’m the only one, I’m the only one."

********
Rep:
Level 96
2011 Most Missed Member2010 Zero To Hero
they say Rgss error
failed to create bitmap

Help us?

***
Rep:
Level 88
I hate to hate things.
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?
 
I need some real WORKING AVI script in RMXP!
3D ANIMATIONS:
http://www.youtube.com/profile?user=Ericmor
3D and 2D anime ART:
http://ericmor.deviantart.com/gallery/

**
Rep:
Level 88
What a drag...
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...-
Cap'n Jack Sparrow: Mr. Gibbs, you may throw my hat if you'd like.
Gibbs: Hooray! *throws hat*
Cap'n Jack Sparrow: Now go and get it.

********
Rep:
Level 96
2011 Most Missed Member2010 Zero To Hero
...No, that I did not do. I will attempt to do so later.

*
Full Metal Mod - He will pillage your women!
Rep:
Level 93
The RGSS Dude
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.
« Last Edit: September 16, 2006, 03:31:05 PM by Tsunokiette »
"The wonderful thing about Tiggers
Is Tiggers are wonderful things
Their tops are made out of rubber
Their bottoms are made out of springs

They’re bouncy, trouncy, flouncy, pouncy
Fun, fun, fun, fun, fun!
But the most wonderful thing about Tiggers
Is I’m the only one, I’m the only one."

***
Rep:
Level 88
I hate to hate things.
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.
I need some real WORKING AVI script in RMXP!
3D ANIMATIONS:
http://www.youtube.com/profile?user=Ericmor
3D and 2D anime ART:
http://ericmor.deviantart.com/gallery/

*
Full Metal Mod - He will pillage your women!
Rep:
Level 93
The RGSS Dude
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.
"The wonderful thing about Tiggers
Is Tiggers are wonderful things
Their tops are made out of rubber
Their bottoms are made out of springs

They’re bouncy, trouncy, flouncy, pouncy
Fun, fun, fun, fun, fun!
But the most wonderful thing about Tiggers
Is I’m the only one, I’m the only one."

***
Rep:
Level 88
I hate to hate things.
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
« Last Edit: September 16, 2006, 11:20:51 PM by Ericmor »
I need some real WORKING AVI script in RMXP!
3D ANIMATIONS:
http://www.youtube.com/profile?user=Ericmor
3D and 2D anime ART:
http://ericmor.deviantart.com/gallery/

*
Full Metal Mod - He will pillage your women!
Rep:
Level 93
The RGSS Dude
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
"The wonderful thing about Tiggers
Is Tiggers are wonderful things
Their tops are made out of rubber
Their bottoms are made out of springs

They’re bouncy, trouncy, flouncy, pouncy
Fun, fun, fun, fun, fun!
But the most wonderful thing about Tiggers
Is I’m the only one, I’m the only one."

********
Rep:
Level 96
2011 Most Missed Member2010 Zero To Hero
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.

***
Rep:
Level 88
I hate to hate things.
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
« Last Edit: September 17, 2006, 09:18:26 PM by Ericmor »
I need some real WORKING AVI script in RMXP!
3D ANIMATIONS:
http://www.youtube.com/profile?user=Ericmor
3D and 2D anime ART:
http://ericmor.deviantart.com/gallery/

********
Rep:
Level 96
2011 Most Missed Member2010 Zero To Hero
Thanks man, I really appreciate this.

*
? ? ? ? ? ? ? ? ? The nice kind of alien~
Rep:
Level 92
Martian - Occasionally kind
@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.
« Last Edit: September 17, 2006, 10:38:17 PM by Zeriab »

********
Rep:
Level 96
2011 Most Missed Member2010 Zero To Hero
Thanks a bunch man!

***
Rep:
Level 88
I hate to hate things.
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
I need some real WORKING AVI script in RMXP!
3D ANIMATIONS:
http://www.youtube.com/profile?user=Ericmor
3D and 2D anime ART:
http://ericmor.deviantart.com/gallery/