Change event image based on current party members

jayholden

Veteran
Veteran
Joined
May 30, 2015
Messages
35
Reaction score
3
First Language
English
Primarily Uses
Hello, I'm trying to make a cutscene in my game; during the scene, any combination of 4 out of a possible 8 characters could be in the party. To be brief, I need to make sure the images used for events in the scene correspond to the characters that are in the current party.

I searched around and found this thread and it looks like gstv87 was giving relevant information, but for the life of me I can't understand what exactly I'm supposed to do with the information he/she provided. Right now I have a set move route: script: set_graphic($game_actors[2].character_name, $game_actors[2].character_index) in a certain event (based on TheoAllen's advice), but nothing is happening and I suspect this wouldn't solve the problem since I don't know whether actor2 will be in the party.

I'd appreciate any advice. Thanks in advance!
 

BlackGoldSaw

Veteran
Veteran
Joined
Oct 10, 2017
Messages
61
Reaction score
32
First Language
English
Primarily Uses
RMMV
The simple method would be to create 8 events on the map using each character's sprite and set each event's condition to require that same character.

The other method can be done using just 3 events if you set a variable for each event to the ID of the party member in each slot. Then on each event create 8 pages with the condition for each being the assigned variable ascending from 1 to 8. On each of those pages place each of the 8 characters sprites.

Maybe it's just me, but that sounds confusing to read. If you need a visual let me know and I'll put something together.
 

Ebanyle

açspasl~d~dfflass
Veteran
Joined
Sep 2, 2016
Messages
338
Reaction score
200
First Language
Portuguese
Primarily Uses
RMVXA
That code probably isn't working because it's for RGSS3, not Javascript D:
 

gstv87

Veteran
Veteran
Joined
Oct 20, 2015
Messages
2,248
Reaction score
1,250
First Language
Spanish
Primarily Uses
RMVXA
not
Code:
set_graphic($game_actors[ID])
but
Code:
set_graphic($game_party.members[index])

equals to this:
Code:
obj = $game_actors
index = ID
chrN = obj[index].character_name
chrID = obj[index].character_index

set_graphic(chrN, chrID)
the party object is comprised of actor objects.
if you were to change $game_actors to $game_party.members, the rest of the code would still work.
in one case you're pulling the Nth entry of the library Actors, and in another you're pulling the Nth member of the party, which itself is an actor.

please clarify if this is for MV or Ace (the core logic is the same, tho... only the code is different)
 

jayholden

Veteran
Veteran
Joined
May 30, 2015
Messages
35
Reaction score
3
First Language
English
Primarily Uses
not
Code:
set_graphic($game_actors[ID])
but
Code:
set_graphic($game_party.members[index])

equals to this:
Code:
obj = $game_actors
index = ID
chrN = obj[index].character_name
chrID = obj[index].character_index

set_graphic(chrN, chrID)
the party object is comprised of actor objects.
if you were to change $game_actors to $game_party.members, the rest of the code would still work.
in one case you're pulling the Nth entry of the library Actors, and in another you're pulling the Nth member of the party, which itself is an actor.

please clarify if this is for MV or Ace (the core logic is the same, tho... only the code is different)
Thanks for responding! It's for MV
 

jayholden

Veteran
Veteran
Joined
May 30, 2015
Messages
35
Reaction score
3
First Language
English
Primarily Uses
The simple method would be to create 8 events on the map using each character's sprite and set each event's condition to require that same character.

The other method can be done using just 3 events if you set a variable for each event to the ID of the party member in each slot. Then on each event create 8 pages with the condition for each being the assigned variable ascending from 1 to 8. On each of those pages place each of the 8 characters sprites.

Maybe it's just me, but that sounds confusing to read. If you need a visual let me know and I'll put something together.
Just thinking through your first solution - if I want party member 1 in X, Y map position (doesn't matter which character) and party member 2 in X, Y+1 map position, how would I accomplish that? I can make the events only display the images of the members currently in the party, but without knowing which members are there, I don't know which event to put where.
 

Silva

Scoobityboo
Veteran
Joined
Nov 5, 2018
Messages
399
Reaction score
221
First Language
English
Primarily Uses
RMMV
Like has already been said, the issue here is that you're using RGSS in MV. You need to be using JS.

If you want to set an events image to a specific party members run a script like this:

Code:
var event = $gameMap.event(id)
var char = $gameParty.members()[pos]._characterName
var index = $gameParty.members()[pos]._characterIndex
event.setImage(char, index)
Replace id with the event you're changing's id, and replace pos with the actors position in the party (Where 0 is the leader)
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,365
Reaction score
7,674
First Language
German
Primarily Uses
RMMV
I can make the events only display the images of the members currently in the party, but without knowing which members are there, I don't know which event to put where
I think you partially misunderstood the solution that you commented here on.

There is an event condition "actor exists" that will only be true if the actor is in the party.
The original solution doesn't do what you want because it assumed the actor position didn't matter and told you to give one event for each possible party member with that condition. If you had a party of 4 actors out of 20 possibilities, then you would have needed 20 events but the condition would only activate four of them - the four that were in your party. but the 20 events would have twenty different positions.

What you want with party member #1 and #2 at specific positions can be done as well, but is a bit more complex to do with events.

basically you would have to use control variable command to get the ID of the two actors in party position #1 and #2 and then use conditional branches and either move the correct events to the positions or give two placeholder on that positions the required change graphic command.
your original script code (after being converted to javascript instead of rgss2) would be the second option and would have to be placed in the correct conditional (if position 2 holds actor 2 set graphics of event to actor 2 graphics) - I would probably go with the first option and have the conditions move the correct event (if position 2 holds actor 2 then set location 2 for event that pretends to be actor 2)

But that also depends on what exactly you want to do - for a short cutscene the second option might be easier, but for a large number of interactions the other variant would be better (imho).
 

jayholden

Veteran
Veteran
Joined
May 30, 2015
Messages
35
Reaction score
3
First Language
English
Primarily Uses
Like has already been said, the issue here is that you're using RGSS in MV. You need to be using JS.

If you want to set an events image to a specific party members run a script like this:

Code:
var event = $gameMap.event(id)
var char = $gameParty.members()[pos]._characterName
var index = $gameParty.members()[pos]._characterIndex
event.setImage(char, index)
Replace id with the event you're changing's id, and replace pos with the actors position in the party (Where 0 is the leader)
Thanks very much for your help!

I think you partially misunderstood the solution that you commented here on.

There is an event condition "actor exists" that will only be true if the actor is in the party.
The original solution doesn't do what you want because it assumed the actor position didn't matter and told you to give one event for each possible party member with that condition. If you had a party of 4 actors out of 20 possibilities, then you would have needed 20 events but the condition would only activate four of them - the four that were in your party. but the 20 events would have twenty different positions.

What you want with party member #1 and #2 at specific positions can be done as well, but is a bit more complex to do with events.

basically you would have to use control variable command to get the ID of the two actors in party position #1 and #2 and then use conditional branches and either move the correct events to the positions or give two placeholder on that positions the required change graphic command.
your original script code (after being converted to javascript instead of rgss2) would be the second option and would have to be placed in the correct conditional (if position 2 holds actor 2 set graphics of event to actor 2 graphics) - I would probably go with the first option and have the conditions move the correct event (if position 2 holds actor 2 then set location 2 for event that pretends to be actor 2)

But that also depends on what exactly you want to do - for a short cutscene the second option might be easier, but for a large number of interactions the other variant would be better (imho).
To elaborate, I'm making a campfire scene as follows:
1) The 4 active party members sit around a campfire; the first member just north of the campfire, the second party member east of the campfire, and so on clockwise.
2) The dialogue will change based on which members are present. If she's present, actor 2 will bring up a certain topic; actor 3, if he's present, will react in a certain way while actor 5 (if present) will react a different way.
3) The dialogue will also change based on variables. I'm using affection levels, where I keep track of who has supported whom during battle, and how often (for an oversimplified example, if party member 2 uses a potion on party member 3, then party member 3 will thank party member 2 during this scene).
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,365
Reaction score
7,674
First Language
German
Primarily Uses
RMMV
@jayholden in that case I see no reason to have specific positions for the actors.

I would suggest making a circle of all the possible party members around the fire (that would allow 8 events on distance 0 and 16 events at distance 1 between fire and event).

Or you could use the controlling event that will check for all possible conversations to also change the four event sprites according to which conversation will be displayed.

It is EXTREMELY important that your point 2 is handled by one single controlling event checking all variables.
You MUST NEVER split code for a cutscene or a conversation between several events, because that will cause timing problems sooner or later.
 

jayholden

Veteran
Veteran
Joined
May 30, 2015
Messages
35
Reaction score
3
First Language
English
Primarily Uses
@jayholden in that case I see no reason to have specific positions for the actors.

I would suggest making a circle of all the possible party members around the fire (that would allow 8 events on distance 0 and 16 events at distance 1 between fire and event).

Or you could use the controlling event that will check for all possible conversations to also change the four event sprites according to which conversation will be displayed.

It is EXTREMELY important that your point 2 is handled by one single controlling event checking all variables.
You MUST NEVER split code for a cutscene or a conversation between several events, because that will cause timing problems sooner or later.
Thanks for your help!
 

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

Latest Threads

Latest Profile Posts

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.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??

Forum statistics

Threads
105,859
Messages
1,017,030
Members
137,566
Latest member
Fl0shVS
Top