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,083
Reaction score
15,499
First Language
English
Primarily Uses
RMMV
Why are you using script calls?

PartyMemberIDtoVariable.png
 

Piyan Glupak

Veteran
Veteran
Joined
Nov 14, 2016
Messages
123
Reaction score
61
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,260
Reaction score
8,713
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,083
Reaction score
15,499
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 Posts

Latest Profile Posts

I've finished (most of) the sprites for two of my main characters, Ashlyn and Lizzabelle. And I've already drawn actual artwork of Lizzabelle and Suki months ago. I can't wait to show some of my stuff. I'm hesitant because their outfits aren't my own original design, which must be changed before I get too serious with this.
Heh, um. I've spent $1500~ so far for my game. Most of that went into purchasing some software I need, as well as some commissions. But still, I didn't realize I had spent so much since the beginning of October.

Do not trust me with money, lol.
Working on my first ideas for a tileset... I really don't know if anyone would like or even want my style.

k5a4BHk.png
Plus-size sprite continues! Front and back views done, or at least mostly there depending on if there's any more work you all think she needs. Once I get her done I can get working on her masculine counterpart:
PlusTest-03.gif
My game is basically turning into a 2 on 2 fighting game disguised as an rpg lol. here's eveyone doing their own intro in battle.

Forum statistics

Threads
116,987
Messages
1,103,551
Members
152,859
Latest member
phantom6780
Top