[RMVX ACE] IS THERE A WAY TO CHANGE CHARACTER GRAPHIC BASED ON STATUS EFFECT?

Posts

Pages: 1
So basically, I have monsters that can shrink your party members, greatly reducing their stats. It is kinda like "mini" in Final Fantasy but on steroids. I have already took the actor sprite sheets and shrank each individual character sprites to 1/3 of their usual size. Basically taking them down from 32x32px each and making them roughly 12x12px and centering them in the 32x32 squares. I want this other sheet with the 12x12 characters to be applied every time a party member gets the "shrunken" state.

I tried to figure it out on my own and tried a few methods. However, I ran into problems every time.

The first being is that you cannot assign a common event to a state in the database. So, that heavily limits me.

So instead, I applied a common event to the "shrink" move that changes the sprite sheet. However, if this debuff is removed in any way other than the user buying a potion that returns a character to normal size, and this also includes death, the character no longer has the shrunken debuff but his sprite remains shrunken.

So, I tried playing around with conditional branches but quickly learned that I would need to use the same conditional branch for literally everything that can change their state. This gets to be a real hassle—especially due to that fact that there are so many things that can happen in an RPG, it would be really hard to ensure that every variable is covered.

There MUST be a MUCH simpler way to automatically apply a different sprite sheet to actors when they get certain status ailments and return it back to the default sprite sheet when the debuff is removed.

Is there a simpler way to do this?

If there is, this would be a game changer. I could make sprite sheets for more than just the shrunken debuff
Marrend
Guardian of the Description Thread
21781
So, in Game_BattlerBase, there is...

class Game_BattlerBase
  #--------------------------------------------------------------------------
  # * Check State
  #--------------------------------------------------------------------------
  def state?(state_id)
    @states.include?(state_id)
  end
end

...this function that checks if a state with a given ID is present on the enemy, or party member. The other function to note would be...

class Game_Actor < Game_Battler
  #--------------------------------------------------------------------------
  # * Change Graphics
  #--------------------------------------------------------------------------
  def set_graphic(character_name, character_index, face_name, face_index)
    @character_name = character_name
    @character_index = character_index
    @face_name = face_name
    @face_index = face_index
  end
end

...this function, in Game_Actor, which changes various graphical settings for the player party. So, if you excuse the lack of information regarding the specific settings in your game, I think you could do something like...

class Game_Actor < Game_Battler
  def refresh
    release_unequippable_items
    super
    if state?(state_id)
      # "Mini" state applied.
      # Replace 'state_id' with whatever state ID the "mini" state actually is!
      case id
        when 1
          # Actor in database position 1.
          #set_graphic(character_name, character_index, face_name, face_index)
        when 2
          # Actor in database position 2.
          #set_graphic(character_name, character_index, face_name, face_index)
        # and so on.
      end
    else
      # "Mini" state (or other state that would not change graphic) not applied.
      # Reset graphics.
      case id
      when 1
        # Actor in database position 1.
        #set_graphic(character_name, character_index, face_name, face_index)
      when 2
        # Actor in database position 2.
        #set_graphic(character_name, character_index, face_name, face_index)
      # and so on.
      end
    end
  end
end

...this? This idea is largely theoretical on my part, so I highly, highly advise using a separate code-block for testing it out!

*Edit: Putting those functions into a `refresh` method might mean that the code runs once per frame, rather than once when the state is applied, and once when the state is removed. So, there's a non-zero possibility doing it this way might slow things down. Or maybe not.
Mine is very different than what you are showing

There is not even a
def state?(state_id)
@states.include?(state_id)
end
end"
anywhere in Game_BattlerBase.

And I have no clue where to put the other code. Not enough information was given


Edit: Also that code appears to do nothing. Everything that seems to define things are followed by hashtags which most code programs ignore everything past those.
So I had my programmer friend debunk your code. He says the code is BS. We spent two hours trying to make heads or tails of this and he has done coding for years. He's written many python scripts, he's even written me programs for my table top stuff and my fantasy games, yet he says the code you have me makes no sense.

I even copied my entire code from both Game_BattleBase and Game_Actor so he could see how RPG Msker code works. He said that some of the things that you are telling me to add are already in the code.

He also pointed out that the code is dealing with face graphics. I NEVER said face graphics. I SAID character sprites.

If someone can give me an answer that works, I would appreciate it.
I think I figured out something that works. But it does require more testing. However, it did automatically remove the shrunken sprite when the character died. I have yet to be able to test it when the shrunken debuff is applied since I have yet to win another battle with a character shrunken (they die before the fight is over).

I used this guide as a base: Automatic parallel process
and I created a common event with the parallel process set up. I just set some conditional branches in the common event that checks if the shrunken debuff is applied to characters. If so, apply shrunken sprite sheet. If not, apply normal size sprite sheet.
Marrend
Guardian of the Description Thread
21781
I'll grant that I didn't test anything myself, and being called out for BSing you is a little disheartening. However, since your friend didn't bother giving you a workible solution, despite their experience, here's a thing that can work, given a follow-up of a script-call to `$game_player.refresh`.

class Game_Player < Game_Character
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  alias gameplayer_refresh refresh
  def refresh
    gameplayer_refresh
    if actor.state?(state_id)
      # "Mini" state applied.
      # Replace 'state_id' with whatever state ID the "mini" state actually is!
      case actor.id
        when 1
          # Actor in database position 1.
          @character_name = "Actor1" #...or whatever graphic file it is.
        when 2
          # Actor in database position 2.
          @character_name = "Actor1" #...or whatever graphic file it is.
        # ...and so on.
      end
    end
  end
  
  def clear_states
    super
    @character_name = $data_actors[actor.id]
  end
end

class Game_Follower < Game_Character
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  alias gamefollower_refresh refresh
  def refresh
    gamefollower_refresh
    if actor
      if actor.state?(state_id)
        # "Mini" state applied.
        # Replace 'state_id' with whatever state ID the "mini" state actually is!
        case actor.id
          when 1
            # Actor in database position 1.
            @character_name = "Actor1" #...or whatever graphic file it is.
          when 2
            # Actor in database position 2.
            @character_name = "Actor1" #...or whatever graphic file it is.
          # ...and so on.
        end
      end
    end
  end
end

*Edit: ...Or, do it through a Common Event. Whatever. Next time I see a help-thread from you, I'm going to ignore it.
Pages: 1