joket

Veteran
Veteran
Joined
Apr 24, 2021
Messages
176
Reaction score
43
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
735
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,178
Reaction score
15,543
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
176
Reaction score
43
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,341
Reaction score
8,762
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
176
Reaction score
43
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
735
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
176
Reaction score
43
First Language
English
Primarily Uses
RMMV

Shaz

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

joket

Veteran
Veteran
Joined
Apr 24, 2021
Messages
176
Reaction score
43
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 new 49" monitor has been dispatched from the warehouse. Will it arrive tomorrow? The day after? I love that we can track packages now, even if it does only tell me when it's left that end and when it's arrived at the local centre. As long as it doesn't end up in Melbourne again, which has happened before ...
My friend's doing a surprise stream of my game Origin Hunt on Twitch here ! Feel free to stop by :yhappy:
Me, designing it a long time ago: Having an optional boss fight as a random chance to trigger when you fish in a certain spot with a certain type of bait is fun! Cool idea!
Me, trying to playtest everything again: oh god just let me see the boss, my bag is so full of fish!
both love and pain have no boundaries
Happy Saint Nicholas Day! May there nice stuff in your shoes when you wake up!

Forum statistics

Threads
117,218
Messages
1,105,582
Members
153,365
Latest member
jundoe
Top