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

You could add a wait method to battle manager by calling the one in Scene_Battle, like this:



Code:
#==============================================================================
# ** BattleManager
#------------------------------------------------------------------------------
#  This module manages battle progress.
#==============================================================================

module BattleManager
  #--------------------------------------------------------------------------
  # * Wait
  #     duration : wait duration
  #--------------------------------------------------------------------------
  def self.wait(duration)
    # Call Scene Battle Wait method If In Scene Battle
    SceneManager.scene.abs_wait(duration) if SceneManager.scene_is?(Scene_Battle)
  end
end
Just add wait(duration) where you want the pause to occur.

As for state stacking, I don't know what you mean.
You could add a wait method to battle manager by calling the one in Scene_Battle, like this:



Code:
#==============================================================================
# ** BattleManager
#------------------------------------------------------------------------------
#  This module manages battle progress.
#==============================================================================

module BattleManager
  #--------------------------------------------------------------------------
  # * Wait
  #	 duration : wait duration
  #--------------------------------------------------------------------------
  def self.wait(duration)
	# Call Scene Battle Wait method If In Scene Battle
	SceneManager.scene.abs_wait(duration) if SceneManager.scene_is?(Scene_Battle)
  end
end
Just add wait(duration) where you want the pause to occur.

As for state stacking, I don't know what you mean.
Thank you very much! Didn't think of that.

As for state-stacking, for example, a bleeding status effect can stack up to 10 times.

If the status is inflicted once, 50 damage is dealt per turn, but if it's inflicted twice, it deals 100 damage per turn, and so on and so forth.

I'll try tinkering with Yanfly Lunatic States first if I can make this work through variables.

EDIT: this is what I did:



Code:
when /BLEED APPLY/i
		if $game_variables[20] <= 5
		  $game_variables[20] += 1
		end

	  when /BLEED DAMAGE/i
		dmg = ($game_variables[20] * 50).to_i
		  if $imported["YEA-BattleEngine"] && dmg > 0
			text = sprintf(YEA::BATTLE::POPUP_SETTINGS[:hp_dmg], dmg.group)
			user.create_popup(text, "HP_DMG")
		  end
		user.perform_damage_effect
		user.hp = [user.hp - dmg, 1].max

	  when /BLEED RESET/i
		$game_variables[20] = 0
The damage and variable adding works, but the state doesn't reapply itself. (I checked, I set the state activation percentage to 100% for testing)

And thus it stays at 50 damage per turn.

I tried adding



Code:
	  if state_id == 27
		if $game_variables[20] <= 5
		  $game_variables[20] += 1
		end
	  end
in def add_state(state_id)

and it worked... but then I realised...

If someone else were to get the bleeding status effect, the damage will exactly be the same as the person who had the status at the same time.

EDIT: Never mind, I don't think this is going to be answered anytime soon.

Anyhow, the first former part of my request is enough, thanks again very much for that *bow*
How do you draw an actor's sprite facing a specific direction? What I usually use:



Code:
draw_actor_graphic(actor, x, y)
always draws them facing down by default. Is there a variant that lets you specify a direction?
I was wondering if there was a way to incorporate an "afterimage" effect on characters and events outside of combat... In the Tankentai version I have, I can turn afterimage on for particular skills, as the presets show... Is there a way I can make a script call to do this? Or maybe a small script to add-on for the sole purpose establishing this effect and making the script call?
@Kaelan: There is not a variant by default, but it's easy enough to make.

Spoiler
Code:
class Window_Base < Window
  #--------------------------------------------------------------------------
  # * Draw Character Graphic
  #--------------------------------------------------------------------------
  def draw_character(character_name, character_index, x, y, d = 0)
	return unless character_name
	bitmap = Cache.character(character_name)
	sign = character_name[/^[\!\$]./]
	if sign && sign.include?('$')
	  cw = bitmap.width / 3
	  ch = bitmap.height / 4
	else
	  cw = bitmap.width / 12
	  ch = bitmap.height / 8
	end
	n = character_index
	src_rect = Rect.new((n%4*3+1)*cw, (n/4*4+d)*ch, cw, ch)
	contents.blt(x - cw / 2, y - ch, bitmap, src_rect)
  end
  #--------------------------------------------------------------------------
  # * Draw Actor Walking Graphic
  #--------------------------------------------------------------------------
  def draw_actor_graphic(actor, x, y, direction = 0)
	draw_character(actor.character_name, actor.character_index, x, y, direction)
  end
end
Just use draw_actor_graphic(actor, x, y, dir) where dir is

0 - Down

1 - Left

2 - Right

3 - Up

You can leave out the dir if you want the sprite facing down
Now for a small question of my own. My assumption is this is somewhere in the hidden scripts as I was unable to find it in the editor. Is there a way to change the opacity of the auto shadow? If I knew where it was drawn and could see the code, I feel it would be simple.
Umm hello there! I want to ask something and hope this is the right place. And let me say this pre-hand: I'm using RGSS2.

Can anyone tell me how hashes(that's what they're calld right?) work? What I mean is:

If I do the following--->



Code:
my_data = {
0 => ["This is 0" , 0],
1 => ["This is madness", 13],
2 => ["No this is patrick", 3]
}
How do I call "This is madness" or any other thing there?
with my_data[key] with key being 0, 1, 2 in your case(you can use strings or symbols here too ^^), you'll get the array you defined after the arrow.

I assume you know how get get data out of arrays?

so to get "This is madness" you'd use my_data[1][0] ^^
I thought it would be like this too. It gave errors with the thing I ws writing so I thought of asking here but after you say that I tried it in a simpler way and it worked. So I'm doing something wrong with the script I'm writing 🙂 . Thanks for explaining.
No problem ^^
What are some typical situations/examples of when to save arbitrary data to a save file? What would the code to save and load data to and from the save file look like? Are there situations where data needs to be specifically be stored in a save file whether or not that data exists within a default $game object?

I examined DataManager a little for answers, but I'm not sure what to take from it.
I have some lines about array:



Code:
$a = []
for i in 0...3
$a.push [i,0]
end
$a = [$a]*3
$a[0][1] = "HERE" #pos: above red line
msgbox  $a
Then I received this:

arr.PNG


I expected the text "HERE" only appear in the first pos (above red line), but then there are 2 more "HERE" appear (above blue lines)

Can anyone tell me how to fix it and how it work like that ?
@Death10: When you use [$a] * 3, it will make all values in new array have the same Object (if you check Object ID, it will be the same). So If you edit a value in new array, It will affect all others values in that new array.

You can try this:



Code:
$a[0] = $a[0].clone
$a[0][1] = "HERE"
What are some typical situations/examples of when to save arbitrary data to a save file? What would the code to save and load data to and from the save file look like? Are there situations where data needs to be specifically be stored in a save file whether or not that data exists within a default $game object?

I examined DataManager a little for answers, but I'm not sure what to take from it.
When you have ANY data in your game, and you're thinking "well this doesn't really belong in the database"

Game-specific data should probably go with game-specific files like the save file.

I have some lines about array:



Code:
$a = []
for i in 0...3
$a.push [i,0]
end
$a = [$a]*3
$a[0][1] = "HERE" #pos: above red line
msgbox  $a
Then I received this:

arr.PNG


I expected the text "HERE" only appear in the first pos (above red line), but then there are 2 more "HERE" appear (above blue lines)

Can anyone tell me how to fix it and how it work like that ?
Variables work with references to most objects, if not all.

Arrays, hashes, ...

Multiple variables can reference the same object.

$a in your case is a reference to a specific array with those elements.

Creating 3 copies of the variable just means you're creating 3 copies of the reference. Each reference still points to the same array, and so it doesn't matter which variable you use, they will all modify the same array.

Think of it like this: $a doesn't contain [[0,0], "here"], it contains a reference to somewhere that contains that.
What are some typical situations/examples of when to save arbitrary data to a save file? What would the code to save and load data to and from the save file look like? Are there situations where data needs to be specifically be stored in a save file whether or not that data exists within a default $game object?

I examined DataManager a little for answers, but I'm not sure what to take from it.


Code:
class << DataManager

  alias old_make_save_contents make_save_contents
  def make_save_contents
    contents = old_make_save_contents
    contents[:new_data] = $bubble_data
    contents
  end

  alias old_extract_save_contents extract_save_contents
  def extract_save_contents(contents)
    old_extract_save_contents(contents)
    $bubble_data = contents[:new_data]
  end
end
Thank Jet.
Was wondering how to stop the player from moving while still accepting inputs in RMVXA.

I was hoping to bind it to a switch.

The intent for this is to have an event that's moving around a map (simulating the player's party on the world map), but which can only move one tile at a time and which runs processing during and after every movement.

EDIT: Oh, d'oh. Simple way to do it: Run it in the map and have the event running it in a loop with Autorun set; that won't execute movement outside the movement I want.
I... think this is the right place to ask this.

I'm editing the text window size in Window_Message in ace. I've gotten the window how I like it except for the Y position. I assume the second number in

" super(165, 0, 465, 200)"

affects Y positioning but no matter what I change it to it has no effect on my text box.

[edit]this is for ace
The y positions is set depending on you choice i show text (top, middle, bottom)

try looking at this method:



Code:
#--------------------------------------------------------------------------
  # * Update Window Position
  #--------------------------------------------------------------------------
  def update_placement
    @position = $game_message.position
    self.y = @position * (Graphics.height - height) / 2
    @gold_window.y = y > 0 ? 0 : Graphics.height - @gold_window.height
  end
thanks, I've got it how I want it now.
Hey, sorry in advance, just picked up this program two days ago, so I'm not sure how everything works. But one thing that is really bugging me is that I cant see my sprites (hero sprites) in combat, I only have the bars with their health and status. I have seen people talking about battle packs and I thought that might be a solution, but I am unsure. Any help would be awesome. 🙂

PS I am looking for either FF3 style, or Lufia II (side or bottom does not matter to me) - Thanks again!

Original thread: https://forums.rpgmakerweb.com/threads/ruby-rgssx-questions-that-dont-deserve-their-own-thread.150/