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

I have no idea how it works and I think opening a thread would be better. =P
 
If I'm not mistaking:

##    pretty much the same way as the battler gfx tags. The only difference is##    that the number behind the name changes the index (from 0-7).It changes the part of the sprite ~ A sprite sheet can have 8 different sprites, so perhaps that's what it is, or I can be totally mistaking.

I kinda got confused, can you give more examples how that looks and what you did?

~ This script is kinda difficult to understand. =P
Yea I think I will open a new thread, that's not the issue.


The issue is that there doesn't seem to be a way to assign a sprite file to an Actor in the game and another sprite file to a different actor.


They all share the same, and that's just senseless.
If you have a script and you need help with it, PLEASE start a new thread. Doesn't matter if it's just a simple question that turns out to be easily fixed. That's better than having something that looks simple on the surface but turns into War and Peace hogging this thread.
If you have a script and you need help with it, PLEASE start a new thread. Doesn't matter if it's just a simple question that turns out to be easily fixed. That's better than having something that looks simple on the surface but turns into War and Peace hogging this thread.
Yes, I saw it was getting annoying here so I decided to make a new thread, and while I was writing the problem, I found the solution. I couldn't believe it.

I had to add actor at the start of the tag and the Id of the actor at the end, like this: "actor character gfx["name" 1 2]"

It doesn't say you can do that with Characters in the script commented section, but I tried and it worked, it just wasn't added there.
Now I'm sure (I hope xD) this question doesn't deserve its own thread, so...

Is it possible to reverse draw_gauge to make the bar fill to the left instead to the right?
Is there a better way of detecting when someone is dead in your party aside from recursion such as this?

Code:
$game_party.battle_members.each do |member|  if member.alive?    #some stuff here  else      #some stuff here  endend
@Rikifive

You can't reverse the gauge, but I think you can reverse the colors, right?

@Milena

That code is not a recursion, unless I'm missing something.

Recursion is a process of splitting one problem to smaller problems until the problem becomes an absurd to solve, usually by constantly calling

the same function again and again. Very similar, but better approach is dynamical programming.

But none of the code above has anything to do with dynamical programming nor recursion.

If you want to check if somebody is dead, you can do it like this, also :

if $game_party.members.size == $game_party.alive_members.size  # do stuffelse  # do more stuffendIt does not make the code faster. It just makes it more... readable.
$game_party/troops.dead_members
How do you tell a window to draw text and then draw commands starting in the next line? I have a custom window (copy of Window_GameEnd) with this:

Spoiler
def make_text draw_text(0, 0, width, line_height, "Choose follower to remove") end def make_command_list if $game_party.members.include?($game_actors[10]) #If actor 10 is in party, show command add_command("Bontest", :rmbontest) end if $game_party.members.include?($game_actors[9]) #If actor 9 is in party, show command add_command("Berrytest", :rmberrytest) end endend
But the commands are drawn in the same line as the text.

Thanks in advance.
Is there a way to change encounters list of a map without using any custom scripts?
@Xypher

Yes, or using the dead_members property :

if $game_party.dead_members.size > 0  # do stuffelse  # do more stuffendThanks for pointing that out.

@Torqus

def refresh  super  draw_text_ex(0, 0, "Your text")enddef item_rect(index)  rect = super(index)  rect.x += 36  rectend@sokita

You mean change what enemies encounter on a map?

Why do you need it?
@Rikifive

You can't reverse the gauge, but I think you can reverse the colors, right?
Yup, but what I need is to have the gauge fill to the left. I have a bar on the right side of the screen and it would look better if that would fill to the left...

But okay, I understand, that's what I wanted to know, thanks.
Thanks for the fast reply. But I think I did something wrong. The commands still appear in the same line as the text.



#==============================================================================# ** Window_Party#------------------------------------------------------------------------------# This is the custom window that detects if the actor is in the party.#==============================================================================class Window_Party < Window_Command def alignment return 1 end #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- def initialize super(0, 0) update_placement self.openness = 0 open end #-------------------------------------------------------------------------- # * Get Window Width #-------------------------------------------------------------------------- def window_width return 160 end def window_height return 280 end #-------------------------------------------------------------------------- # * Update Window Position #-------------------------------------------------------------------------- def update_placement self.x = (Graphics.width - width) / 2 self.y = (Graphics.height - height) / 2 end #-------------------------------------------------------------------------- # * Create Command List #-------------------------------------------------------------------------- def refresh super draw_text_ex(0, 0, "Select Character to remove:") end def item_rect(index) rect = super(index) rect.x += 36 rect end def make_command_list if $game_party.members.include?($game_actors[10]) #If actor 10 is in party, show command add_command("Bontest", :rmbontest) end if $game_party.members.include?($game_actors[9]) #If actor 9 is in party, show command add_command("Berrytest", :rmberrytest) end endend

EDIT: Oh wait maybe I have to change the x for an y

Yep that was it. Thanks.
@Rikifive

Well, for example you earlier had a gauge filled with parameters :

draw_gauge(some_x, some_y, some_width, rate, color1, color2)Now you can set it up like :

draw_gauge(some_x, some_y, some_width, 1 - rate, color2, color1)@Torqus

Oops

Code:
def refresh  super  draw_text_ex(0, 0, "Your text")enddef item_rect(index)  rect = super(index)  rect.y += 36  rectend
I want to swap encounters list based on day and night. Yeah, I know I can do it by making two identical maps but with different encounters list. But, if there is a way to it via script call, it is better.
@sokita:

module KOCKA  module SNIPPET_ENCOUNTER    MAPS = {      1 => [      # On map with iD 1        [1],       # When the switch is ON those troops will encounter        [2],       # Otherwise, those.      ],    }    SWITCH = 1     # Switch indicating is it day or night  endend class Game_Map  include KOCKA::SNIPPET_ENCOUNTER  #--------------------------------------------------------------------------  # * Get Encounter List  #--------------------------------------------------------------------------  def encounter_list    MAPS.keys.include?($game_map.map_id) ? MAPS[$game_map.map_id][$game_switches[SWITCH] ? 0 : 1].collect{|t|@map.encounter_list[t - 1]} : @map.encounter_list  endendSo, if you have an encounter list with :

1. Slime - Day

2. Bat - Night

3. Wolf - Day

4. Sponge - Night

on the map iD 10 you would set up the MAPS array like:

MAPS = {  10 => [    [1, 3],    [2, 4],  ],}And, if the switch is ON that should signify the day.
@Rikifive

Well, for example you earlier had a gauge filled with parameters :

draw_gauge(some_x, some_y, some_width, rate, color1, color2)Now you can set it up like :

draw_gauge(some_x, some_y, some_width, 1 - rate, color2, color1)
I see how it works, but to make it look properly, then I should change "empty" color to these two colors and the "gauge" color change to "empty" one.

So it would look properly if I'd do

draw_gauge(some_x, some_y, some_width, 1 - rate, color19, color19) #that part is easyBut can I change "empty" color to two colors to make it gradient?
@Rikifive

Hmmm.. I see. You can use :

def draw_gauge_left(x, y, width, rate, color1, color2)  fill_w = (width * rate).to_i  gauge_y = y + line_height - 8  contents.fill_rect(x, gauge_y, width, 6, gauge_back_color)  contents.gradient_fill_rect(x+fill_w, gauge_y, fill_w, 6, color1, color2)endI think.

OMG, why is this topic so spammed with questions in the last hour?
OMG, why is this topic so spammed with questions in the last hour?
I don't know but you should change your title "Somewhat Support" to "Support King"
@Rikifive

Hmmm.. I see. You can use :

def draw_gauge_left(x, y, width, rate, color1, color2)  fill_w = (width * rate).to_i  gauge_y = y + line_height - 8  contents.fill_rect(x, gauge_y, width, 6, gauge_back_color)  contents.gradient_fill_rect(x+fill_w, gauge_y, fill_w, 6, color1, color2)endI think.
That ended up drawing the fill_w all over the place, but you pointed me into the right direction by suggesting creating a new draw_gauge method.

I made that method:

def draw_gauge_left(gx, gy, gw, rate, color1, color2) gw -= 2 fill_w = [(gw * rate).to_i, gw].min gh = 10 gauge_y = gy + line_height - 2 - gh outline_colour = Color.new(71, 103, 135) contents.fill_rect(gx, gauge_y-1, gw+2, gh+2, outline_colour) gx += 1 contents.gradient_fill_rect(gx, gauge_y, gw, gh, text_color(17), text_color(14)) contents.gradient_fill_rect(gx, gauge_y, fill_w, gh, color1, color2) # I left gradient here too, to not mess up something in future drawings and I'm filling that with two the same colors xDendand it works as I wanted, lol why I didn't though of making another method earlier...

Thank you for pointing me into the right way. (=

OMG, why is this topic so spammed with questions in the last hour?


I think that's why. (=

You should change your title to "King of the 'Ruby/RGSSx questions that don't deserve their own thread' thread". (=

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