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

TDS

- T D S -
Veteran
Joined
Mar 5, 2012
Messages
361
Reaction score
130
First Language
English
Primarily Uses
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.
 

Raythalos

Just a regular Alicef@g~
Veteran
Joined
Jun 3, 2012
Messages
54
Reaction score
0
First Language
Indonesian
Primarily Uses
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*
 
Last edited by a moderator:

Kaelan

Veteran
Veteran
Joined
May 14, 2012
Messages
797
Reaction score
537
First Language
Portuguese
Primarily Uses
RMMV
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?
 
Last edited by a moderator:

kingmakerspider

That little devil...
Veteran
Joined
May 3, 2012
Messages
309
Reaction score
30
First Language
English
Primarily Uses
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?
 

Yato

(aka Racheal)
Veteran
Joined
Mar 17, 2012
Messages
825
Reaction score
346
Primarily Uses
@Kaelan: There is not a variant by default, but it's easy enough to make.

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.
 
Last edited by a moderator:

Drakath

Kuro no Kishin
Veteran
Joined
Mar 18, 2012
Messages
32
Reaction score
3
First Language
Turkish
Primarily Uses
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?
 

mobychan

CodeMaster
Veteran
Joined
Mar 23, 2012
Messages
297
Reaction score
45
First Language
German
Primarily Uses
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] ^^
 

Drakath

Kuro no Kishin
Veteran
Joined
Mar 18, 2012
Messages
32
Reaction score
3
First Language
Turkish
Primarily Uses
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.
 

Mr. Bubble

Makes stuff.
Member
Joined
Mar 1, 2012
Messages
853
Reaction score
163
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.
 

Death10

;D
Member
Joined
Jul 18, 2012
Messages
29
Reaction score
5
First Language
Vietnamese
Primarily Uses
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:



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 ?
 
Last edited by a moderator:

Dr.Yami

。◕‿◕。
Developer
Joined
Mar 5, 2012
Messages
1,003
Reaction score
757
First Language
Vietnamese
Primarily Uses
Other
@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"
 

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,564
Reaction score
3,846
First Language
English
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:



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.
 
Last edited by a moderator:

Jet

Flying in a sky near you
Veteran
Joined
Mar 19, 2012
Messages
172
Reaction score
103
First Language
English
Primarily Uses
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
 

Firgof

Artist / Designer
Veteran
Joined
Jul 29, 2012
Messages
236
Reaction score
214
First Language
English
Primarily Uses
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.
 
Last edited by a moderator:

DemonLamma

Villager
Member
Joined
Aug 12, 2012
Messages
29
Reaction score
1
First Language
English
Primarily Uses
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
 
Last edited by a moderator:

mobychan

CodeMaster
Veteran
Joined
Mar 23, 2012
Messages
297
Reaction score
45
First Language
German
Primarily Uses
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
 

DemonLamma

Villager
Member
Joined
Aug 12, 2012
Messages
29
Reaction score
1
First Language
English
Primarily Uses
thanks, I've got it how I want it now.
 

AkwardPain

Warper
Member
Joined
Sep 2, 2012
Messages
1
Reaction score
0
First Language
English
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!
 

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