Items changing party faces

Hello,

How could I make consumable items change the face of a party member?

Thank you very much.
Have the item apply a state and use a common event to change the actor face of the actor affected by the said state (the item should call the common event).
Since it's possible without a script, I'm moving it to VXAce Support. 🙂
Have the item apply a state and use a common event to change che actor face of the actor affected by the said state (the item should call the common event).
Thank you for responding.

Why should the item apply a state if the item is calling the common event? What does the state do? I want the face change to be permanent.

The game has 4 actors.

How does the game check which actor the item was used on, and change that actor’s face?

I tried using “Change Actor Graphic” in a common event, but it asked me to choose a specific actor.
use a common event to change the actor face of the actor affected by the said state (the item should call the common event).
This the purpose of the state. Without it you have no way to identify the actor that should be affected by the item as the common event does not know who the target is. Other than serving the purpose of being a target marker, it does nothing and can be removed as soon as you find your target.

You have to do it using a script call. You can find the one you need at the end of this post.
This the purpose of the state. Without it you have no way to identify the actor that should be affected by the item as the common event does not know who the target is. Other than serving the purpose of being a target marker, it does nothing and can be removed as soon as you find your target.

You have to do it using a script call. You can find the one you need at the end of this post.
Thank you for the reply.

I assume you're referring to this:

Spoiler
# Actor Change Graphic
# ----------------------------------------------
hero = $game_actors[ID]
hero.set_graphic("characterset_filename", character_index, "Faceset_filename", faceset_index)
$game_player.refresh
# ID = Actor Index
# character_index = Starts from 0 (Top Left), 1, 2, ...
# faceset_index = Starts from 0 (Top Left), 1, 2, ...

# Example:
hero = $game_actors[1]
hero.set_graphic("Actor1", 1, "Actor4", 1)
$game_player.refresh

What I'm having a hard time with is defining which actor has the state. How do I do that?

Going back to the script, I want "hero" to be the actor with the state you told me to apply.

Could you walk me through this, please? I'm new to RPG Maker. Thank you.
@AboutDegree9 I am talking exactly about that. What you need there is either to get the right actor as "hero" or the right "ID". A possible solution (not the only one, there are at least three other equivalent solutions) would be the following:
Spoiler: This code is wrong, the correct version can be found in the next post
Code:
hero = $game_actors[1]
$game_actors.each do |actor|
  if actor.state?(your_dummy_state_id)
    hero = actor
    hero.remove_state(your_state_id) # This line might be unnecessary but I recommend using it
  end
end
After that you can simply use the same script call you have added to your post. Even the variable name (hero) is the same so you only have to change file name and face index according to the new face you want to show.
@AboutDegree9 I am talking exactly about that. What you need there is either to get the right actor as "hero" or the right "ID". A possible solution (not the only one, there are at least three other equivalent solutions) would be the following:
Code:
hero = $game_actors[1]
$game_actors.each do |actor|
  if actor.state?(your_dummy_state_id)
    hero = actor
    hero.remove_state(your_state_id) # This line might be unnecessary but I recommend using it
  end
end
After that you can simply use the same script call you have added to your post. Even the variable name (hero) is the same so you only have to change file name and face index according to the new face you want to show.
I copied the script into my common event and changed "your_dummy_state_id" to my state's ID.

The common event calls a script that looks like this:

Spoiler
hero = $game_actors[1]
$game_actors.each do |actor|
if actor.state?(26)
hero = actor
hero.set_graphic("Actor1", 1, "Actor4", 1)
hero.remove_state(26)
$game_player.refresh
end
end

This is what happened when I tried to use the item on a party member:

QBAh7U2.png


Did I make a mistake with the script? Thank you.
No, you didn't, I am the one who made a mistake. You should get the target from the party array.
Code:
hero = $game_party.members[0]
$game_party.members.each do |actor|
  if actor.state?(26)
    hero = actor
    hero.remove_state(26)
  end
end
Since I declared the hero variable outside the each loop, you can use "set_graphic" outside of it, there is no need to place it there. If you want to place it there, there is no need to declare the hero variable outside the loop.
Code:
$game_party.members.each do |hero|
  if hero.state?(26)
    hero.set_graphic("Actor1", 1, "Actor4", 1)
    hero.remove_state(26)
  end
end
$game_player.refresh

One more thing: when copy/pasting code in your post you can use [CODE] code here [/CODE]. It will show everything without executing other codes in it (such as smiles and other BB codes).
It worked! I also learned some things I could apply in other situations.

Thank you so much.

Original thread: https://forums.rpgmakerweb.com/threads/items-changing-party-faces.115460/