joket

Veteran
Veteran
Joined
Apr 24, 2021
Messages
147
Reaction score
30
First Language
English
Primarily Uses
RMMV
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
731
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,728
Reaction score
15,308
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
147
Reaction score
30
First Language
English
Primarily Uses
RMMV
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,953
Reaction score
8,615
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
147
Reaction score
30
First Language
English
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
"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
731
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
147
Reaction score
30
First Language
English
Primarily Uses
RMMV

Shaz

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

joket

Veteran
Veteran
Joined
Apr 24, 2021
Messages
147
Reaction score
30
First Language
English
Primarily Uses
RMMV
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 Posts

Latest Profile Posts

My home state baseball team is going back to the World Series for the first time since 1999. I remember when they went in 1995 and won, that was like the best day of my life. (I'm a huge baseball fan and yes I'm talking about the Braves).
FL Studio is a huge step up from LMMS but I'm having such a tough time with it D:<
The new Dune movie reminds me of the game Dune 2 made by Westwood. A quality product on its own, but extremely disloyal to its source of inspiration.
Terrible Writing Advice, you've done it again.
1635026211997.png

Forum statistics

Threads
116,041
Messages
1,095,232
Members
151,386
Latest member
sheyzo
Top