joket

Veteran
Veteran
Joined
Apr 24, 2021
Messages
129
Reaction score
21
First Language
English
Primarily Uses
RMMZ
Hello, I'd need the script code to set variable values of variables 1, 2, 3, 4 equal to the number ID of party actor.

$gameVariables.setValue(1, a.actorId())
This line works, but I need to mod it to make:

set variable 1 = ID actor position party 1
set variable 2 = ID actor position party 2
set variable 3 = ID actor position party 3
set variable 4 = ID actor position party 4
set variable 5 = ID actor position party 5

Can you help me?
 

JamesRyan

Game Designer
Veteran
Joined
Sep 13, 2014
Messages
730
Reaction score
237
First Language
Vietnamese
Primarily Uses
RMMV
I have something that you can try. Just put it into a script call and call it somewhere:
Code:
var partysize = $gameParty.allMembers().length;

var actorID = 0;

for (i = 0; i < partysize; i++){

actorID = $gameParty.allMembers()[i].actorId();

$gameVariables.setValue(i+1, actorID);}
 

Shaz

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
43,720
Reaction score
15,304
First Language
English
Primarily Uses
RMMV
Why are you using script calls?

PartyMemberIDtoVariable.png
 

Piyan Glupak

Veteran
Veteran
Joined
Nov 14, 2016
Messages
104
Reaction score
48
First Language
English
JamesRyan's script call looks well worth trying, because it would deal with some of the expected actors being absent from the party.

Doing it through the editor, as Shaz suggests, is easier to maintain when you come to try and work out what you are doing in 3 months time.

In case neither of those are what you want, you could try putting each of these in the script portion of separate "Control Variable" editor command:

$gameParty.allMembers()[0].actorId();
$gameParty.allMembers()[1].actorId();
$gameParty.allMembers()[2].actorId();
$gameParty.allMembers()[3].actorId();
$gameParty.allMembers()[4].actorId();

or, if you want to do it as one script call:
$gameVariables.setValue(var1, $gameParty.allMembers()[0].actorId());
$gameVariables.setValue(var2, $gameParty.allMembers()[1].actorId());
$gameVariables.setValue(var3, $gameParty.allMembers()[2].actorId());
$gameVariables.setValue(var4, $gameParty.allMembers()[3].actorId());
$gameVariables.setValue(var5, $gameParty.allMembers()[4].actorId());

Remember that if you do it via script, the party leader is in '0' position.
 

joket

Veteran
Veteran
Joined
Apr 24, 2021
Messages
129
Reaction score
21
First Language
English
Primarily Uses
RMMZ
The Event Conditional Branch works. I was used to use Rpg maker Xp back in the times and due to my localized translated rpg maker mv version, couldn't find the command.


JamesRyan's script call looks well worth trying, because it would deal with some of the expected actors being absent from the party.

Doing it through the editor, as Shaz suggests, is easier to maintain when you come to try and work out what you are doing in 3 months time.

In case neither of those are what you want, you could try putting each of these in the script portion of separate "Control Variable" editor command:

$gameParty.allMembers()[0].actorId();
$gameParty.allMembers()[1].actorId();
$gameParty.allMembers()[2].actorId();
$gameParty.allMembers()[3].actorId();
$gameParty.allMembers()[4].actorId();

or, if you want to do it as one script call:
$gameVariables.setValue(var1, $gameParty.allMembers()[0].actorId());
$gameVariables.setValue(var2, $gameParty.allMembers()[1].actorId());
$gameVariables.setValue(var3, $gameParty.allMembers()[2].actorId());
$gameVariables.setValue(var4, $gameParty.allMembers()[3].actorId());
$gameVariables.setValue(var5, $gameParty.allMembers()[4].actorId());

Remember that if you do it via script, the party leader is in '0' position.

Anyway this doesn't work:

1632569570070.png

Still shows 0, 0, 0, 0 (i have Actor id 10, id 2, id 4 and id 5 in my party)

I managed to make that as set variable as standard
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
33,928
Reaction score
8,607
First Language
German
Primarily Uses
RMMV
@joket have you read Shaz' post above?
why are you using script calls at all, because the use of the control variable command with the game data section would be much easier in an event.

EDIT:
and it didn't work because you never gave the variable IDs correctly. The ID's are 4, 5, 6, 7 and NOT var4 etc
 

joket

Veteran
Veteran
Joined
Apr 24, 2021
Messages
129
Reaction score
21
First Language
English
Primarily Uses
RMMZ
@joket have you read Shaz' post above?
why are you using script calls at all, because the use of the control variable command with the game data section would be much easier in an event.

EDIT:
and it didn't work because you never gave the variable IDs correctly. The ID's are 4, 5, 6, 7 and NOT var4 etc
"The Event Conditional Branch works. I was used to use Rpg maker Xp back in the times and due to my localized translated rpg maker mv version, couldn't find the command."

Already replied to Shaz.

Yeah Script failed for that mistake in the var and ID sequence numbers, sorry.
 

JamesRyan

Game Designer
Veteran
Joined
Sep 13, 2014
Messages
730
Reaction score
237
First Language
Vietnamese
Primarily Uses
RMMV
Anyway this doesn't work:

View attachment 202330

Still shows 0, 0, 0, 0 (i have Actor id 10, id 2, id 4 and id 5 in my party)

I managed to make that as set variable as standard
This does not work because what you set(var4, var5, etc) is not variable IDs. Try again with just 4, 5, 6, etc.
 

joket

Veteran
Veteran
Joined
Apr 24, 2021
Messages
129
Reaction score
21
First Language
English
Primarily Uses
RMMZ

Shaz

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
43,720
Reaction score
15,304
First Language
English
Primarily Uses
RMMV
I didn't say anything about conditional branches though.
 

joket

Veteran
Veteran
Joined
Apr 24, 2021
Messages
129
Reaction score
21
First Language
English
Primarily Uses
RMMZ
I didn't say anything about conditional branches though.
Yeah sorry, my event needed, I mean "with standard RPG maker interface withouth scripts"
 

Latest Threads

Latest Profile Posts

does anyone feel like explaining to me the difference between simulation and emulation? you have my full permission to be as pedantic as you want.
About the Deer, I had to cut some piece of video due the *swearing* Youtube copyrights issues...
A caveman pokes his head in...
I was listening to songs by Chuck E Cheese's voice actor (Jaret Reddick from Bowling for Soup) when the meds I was taking for my stomach virus apparently stopped working. I can't take my next dose until morning, but it's no use anyway. I'm officially sick again. Of course, I'll definitely take the next dose either way, but it's useless now.
New profile picture! This time, it's representative of my current project.

Forum statistics

Threads
116,004
Messages
1,094,826
Members
151,306
Latest member
rpgLord69
Top