Ruby/RGSSx questions that don't deserve their own thread

Acezon

Om Nom Nom
Veteran
Joined
Apr 22, 2012
Messages
131
Reaction score
25
First Language
English
Primarily Uses
N/A
I don't know if this was already asked. I just want to know how to create a next line when the text reaches the width of the window. Here's the script



Code:
def draw_objective(x, y)
	change_color(system_color)
	draw_text(x, y + line_height * 0, contents.width, line_height, "Current objective:")
	change_color(normal_color)
	draw_text(x, y + line_height * 1, contents.width, line_height, $goal)
end
The $goal here is the objective itself.

Thanks for helping!
 

Bird Eater

Boredom is just another thing you want to avoid
Veteran
Joined
Mar 22, 2012
Messages
272
Reaction score
27
First Language
Dutch
Primarily Uses
How does one check if an SE (sound effect) is playing?

I need the script call for it, but perhaps it doesn't exist...

Oh and it's RGSS3, forgot to mention that.
 
Last edited by a moderator:

Zio

Weekend Warrior
Member
Joined
May 19, 2012
Messages
24
Reaction score
3
First Language
English
Primarily Uses
Working on a game that may or may not go commercial, was wondering what a script writer would charge for creating some scripts for my game. My personal email is Nadaskayart@gmail.com if you want your answers to be confidential.
 

Mihel

Veteran
Veteran
Joined
Mar 13, 2012
Messages
382
Reaction score
42
Primarily Uses
What is the corresponding RGSS3 term for RGSS2's active_battler?
 

Hendrik

Villager
Member
Joined
Mar 14, 2012
Messages
38
Reaction score
1
First Language
German
I want to create a window which display stuff.

In the code below it shows the text but just for 1 frame.

How i can make it persistent?

Thats my code



Code:
class MyWin < Window_Base
  def initialize
    super 0,0,640,480
    self.windowskin = Bitmap.new(1,1)
    update
  end

  def update
    self.contents = Bitmap.new(640,480)
    self.contents.draw_text(0,0,300,400, "text")
    super
  end
end
 

mobychan

CodeMaster
Veteran
Joined
Mar 23, 2012
Messages
297
Reaction score
45
First Language
German
Primarily Uses
just put the super as the first thing in the method ^^

It calls the update method of the super class which, I assume, clears the contents again ^^
 

Hendrik

Villager
Member
Joined
Mar 14, 2012
Messages
38
Reaction score
1
First Language
German
Putting it in the first line of the method didnt work.

Do i have to do more than just creating an instance of it for displaying it?
 

mobychan

CodeMaster
Veteran
Joined
Mar 23, 2012
Messages
297
Reaction score
45
First Language
German
Primarily Uses
Did you set it as an instance variable in a Scene (eg Scene_Map)?
 

Hendrik

Villager
Member
Joined
Mar 14, 2012
Messages
38
Reaction score
1
First Language
German
no i really just did MyWin.new in a npc script.

Can you give me an example how to do it within in a scene till scene creation?
 

mobychan

CodeMaster
Veteran
Joined
Mar 23, 2012
Messages
297
Reaction score
45
First Language
German
Primarily Uses
I usually just add it to Scene_Map just put a line that looks like this:



Code:
@my_window = MyWin.new
below everything else in Scene_Maps initialize method, or use this in your script:



Code:
class Scene_Map < Scene_Base
  alias map_init initialize unless $@
  def initialize
    map_init
    @my_window = MyWin.new
  end
end
It does basically the same but is easier to delete afterwards ^^
 

Hendrik

Villager
Member
Joined
Mar 14, 2012
Messages
38
Reaction score
1
First Language
German
But what to do if i want to get it working by creating an instance?

I tried something like this, but as expected didnt work. Again just one frame.



Code:
class Test < Scene_Map
    def start
	  super
	  @myWin = MyWin.new
    end

    def terminate
	  super
    end
end
 

mobychan

CodeMaster
Veteran
Joined
Mar 23, 2012
Messages
297
Reaction score
45
First Language
German
Primarily Uses
Did you call that scene?

try this:



Code:
class MyWin < Window_Base
  def initialize
    super(0,0,640,480)
    self.windowskin = Bitmap.new(1,1)
  end

  def update
    super
    self.contents.clear
    self.contents.draw_text(0,0,300,400, "text")
  end
end

class My_Scene < Scene_Base
  def initialize
    super
    @myWin = MyWin.new
  end
end
Then make an event and call this in a Script:



Code:
SceneManager.call(My_Scene)
 

Hendrik

Villager
Member
Joined
Mar 14, 2012
Messages
38
Reaction score
1
First Language
German
Thank you, that works pretty well!

I might bug you with all my questions, but what if i want to display it on the current scene?
 

mobychan

CodeMaster
Veteran
Joined
Mar 23, 2012
Messages
297
Reaction score
45
First Language
German
Primarily Uses
Then you should put the



Code:
@myWin = MyWin.new
line inside that Scenes initialize method like I showed earlier.

You always need to tell a Scene what windows it should have, what could work (didn't test it yet, but it should) to "add" the window later is this:



Code:
class Sceen_Map < Scene_Base
  def create_my_window
	@myWin = MyWin.new
  end
  def remove_my_window
	@myWin.dispose
	@myWin = nil
  end
end
now you can call this in a Script call in an event to show your window:



Code:
SceneManager.scene.create_my_window if SceneManager.scene_is?(Scene_Map)
And don't worry about asking so much ^^

if you want we can continue this via PM and in German ;)

EDIT:

forgot this:

removing the window should work like this:



Code:
SceneManager.scene.remove_my_window if SceneManager.scene_is?(Scene_Map)
 
Last edited by a moderator:

.notsafety

Veteran
Veteran
Joined
May 18, 2012
Messages
37
Reaction score
3
First Language
English
Primarily Uses
hi, I don't want to open up a topic for this so I'm just going to ask here qq

with VX, I'm using KGC's Overdrive w/ custom gauges and I'm also using Star's BattleStatus HUD. the Overdrive bars show and all, but they do not appear to be active and are hung at 0%.

after doing a bunch of compatibility checks and moving x amount of scripts around, I discovered that Star's BattleStatus is causing the Overdrive script to not work during battles. if I remove Star's HUD, the OD gauges work exactly as they are supposed to.

is there perhaps a patch or some other method that may solve the problem? I don't want to remove the BattleStatus HUD but I kinda want an OD-esque system too D:
 

Kaelan

Veteran
Veteran
Joined
May 14, 2012
Messages
797
Reaction score
537
First Language
Portuguese
Primarily Uses
RMMV
Where do I go to change the default system font?

I know I can change an individual window's font by doing:



Code:
contents.font.name = "Arial"
How do I do that for the whole game at once?
 

Yato

(aka Racheal)
Veteran
Joined
Mar 17, 2012
Messages
825
Reaction score
346
Primarily Uses
In main before rgss_main, use:



Code:
Font.default_name = ["imafontname", "optionalsecondfont"]
 

Raythalos

Just a regular Alicef@g~
Veteran
Joined
Jun 3, 2012
Messages
54
Reaction score
0
First Language
Indonesian
Primarily Uses
RGSS3 user here. Can I ask some questions?

1. How do I add a pause or a wait before a battle ends? Or to be more precise, to add a wait function in BattleManager?

2. How do I code an Instant Death state? (I'm using Yanfly Lunatic states to help me with this..)

Applying the Death state instantly seems to break the game often, so I had this idea to call a state that reduces the target's HP instantly to 0 instead once applied.

Though I'm not sure what to put in there since <apply effect: self.hp = 0> doesn't work.

EDIT: Never mind, got it to work after messing with the script files while writing this, so...

2. Can I make a state stack through help of a certain script (or Yanfly Lunatic States)?

Help would be appreciated.
 
Last edited by a moderator:

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

People3_5 and People3_8 added!

so hopefully tomorrow i get to go home from the hospital i've been here for 5 days already and it's driving me mad. I miss my family like crazy but at least I get to use my own toiletries and my own clothes. My mom is coming to visit soon i can't wait to see her cause i miss her the most. :kaojoy:
Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.

Forum statistics

Threads
105,868
Messages
1,017,090
Members
137,586
Latest member
Usagiis
Top