joket

Veteran
Veteran
Joined
Apr 24, 2021
Messages
163
Reaction score
39
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
734
Reaction score
242
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
44,109
Reaction score
15,524
First Language
English
Primarily Uses
RMMV
Why are you using script calls?

PartyMemberIDtoVariable.png
 

Piyan Glupak

Veteran
Veteran
Joined
Nov 14, 2016
Messages
125
Reaction score
63
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
163
Reaction score
39
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
34,286
Reaction score
8,738
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
163
Reaction score
39
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
734
Reaction score
242
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
163
Reaction score
39
First Language
English
Primarily Uses
RMMV

Shaz

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

joket

Veteran
Veteran
Joined
Apr 24, 2021
Messages
163
Reaction score
39
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 Profile Posts

When can we get this?
RPG Maker MZ Saturn.png
Saturn port when?
I'm new to rpgmaker mv, link me some good stuff to learn.
Finally, I have graduated from college and now I can put a lot more work into my game, after having not worked on it for the better part of a year.
post so i can change my profile picture ^^
Creating Some art for a fighter game.

Forum statistics

Threads
117,068
Messages
1,104,273
Members
153,046
Latest member
peady
Top