Items changing party faces

AboutDegree9

Villager
Member
Joined
Nov 21, 2019
Messages
5
Reaction score
1
First Language
English
Primarily Uses
RMVXA
Hello,

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

Thank you very much.
 

Heirukichi

Veteran
Veteran
Joined
Sep 24, 2015
Messages
1,421
Reaction score
596
First Language
Italian
Primarily Uses
RMVXA
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).
 
Last edited:

slimmmeiske2

Little Red Riding Hood
Global Mod
Joined
Sep 6, 2012
Messages
7,867
Reaction score
5,240
First Language
Dutch
Primarily Uses
RMXP
Since it's possible without a script, I'm moving it to VXAce Support. :)
 

AboutDegree9

Villager
Member
Joined
Nov 21, 2019
Messages
5
Reaction score
1
First Language
English
Primarily Uses
RMVXA
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.
 

Heirukichi

Veteran
Veteran
Joined
Sep 24, 2015
Messages
1,421
Reaction score
596
First Language
Italian
Primarily Uses
RMVXA
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.
 

AboutDegree9

Villager
Member
Joined
Nov 21, 2019
Messages
5
Reaction score
1
First Language
English
Primarily Uses
RMVXA
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:

# 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.
 

Heirukichi

Veteran
Veteran
Joined
Sep 24, 2015
Messages
1,421
Reaction score
596
First Language
Italian
Primarily Uses
RMVXA
@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.
 
Last edited:

AboutDegree9

Villager
Member
Joined
Nov 21, 2019
Messages
5
Reaction score
1
First Language
English
Primarily Uses
RMVXA
@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:

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:



Did I make a mistake with the script? Thank you.
 

Heirukichi

Veteran
Veteran
Joined
Sep 24, 2015
Messages
1,421
Reaction score
596
First Language
Italian
Primarily Uses
RMVXA
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).
 

AboutDegree9

Villager
Member
Joined
Nov 21, 2019
Messages
5
Reaction score
1
First Language
English
Primarily Uses
RMVXA
It worked! I also learned some things I could apply in other situations.

Thank you so much.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Profile Posts

Our latest feature is an interview with... me?!

People4_2 (Capelet off and on) added!

Just beat the last of us 2 last night and starting jedi: fallen order right now, both use unreal engine & when I say i knew 80% of jedi's buttons right away because they were the same buttons as TLOU2 its ridiculous, even the same narrow hallway crawl and barely-made-it jump they do. Unreal Engine is just big budget RPG Maker the way they make games nearly identical at its core lol.
Can someone recommend some fun story-heavy RPGs to me? Coming up with good gameplay is a nightmare! I was thinking of making some gameplay platforming-based, but that doesn't work well in RPG form*. I also was thinking of removing battles, but that would be too much like OneShot. I don't even know how to make good puzzles!
one bad plugin combo later and one of my followers is moonwalking off the screen on his own... I didn't even more yet on the new map lol.

Forum statistics

Threads
106,035
Messages
1,018,454
Members
137,821
Latest member
Capterson
Top