Can I set multiple variables from a single script call result?

I have hit a roadblock in my level of understanding of scripts and how to achieve a result. I'm quite sure I can do it somehow, but I keep messing things up.

So I am setting a variable to an enemy id # using $gameParty.members()[n].enemyId() in event processing. The next step is setting more variables to the skill ids in that enemy id's section in enemies.json

this is where I get lost. I see the data in the enemies.json file but i don't know how to call that data up and place them to variables. None of my enemies have more than 10 skills, and I have 10 variables in numerical order set aside to accept the data (that I can't figure out how to call up and assign)

I know I can do this with a plugin, and I'm about ready to, but I swear my vague rusty old recollection about how javascript should work should allow me to set all the variables to match all the skill ids in one kinda long script (thanks to MZ accepting much longer lines of code than MV)

Its should work something like 'set var = [n] // enemy.skill.[N].id' where n is the assigned variable, and N is the various skills in the enemies.json file. I'm having issues with finding the exact script calls in the google spreadsheet of script calls (probably cause I'm asking the wrong questions)

I envision my next stumbling block being an attempt to call SP and Ex parameters from the same enemies.json file. Again I see the data I need, but if I cannot extract skill ids, what chance do I have at that?


----

So under the hood, what I'm doing is an idea for a take on a monster tamer ability and monster party members- I have blank actors with base parameters of 1 and a baseline growth rate. I have a skill to talk them into the group which i am working out now. So

Step 1: Collect enemy parameters and add them to blank monster actor. (Done)
Step 2: Collect enemy id to collect skill ids and add them to blank monster actor
Step 3(If possible) Collect enemy SP and EX parameters and add them to blank monster actor
Step 4 Rename monster actor so the next blank in the line (with the name 'Empty') is filled in by the next recruitment rather than overwrite the existing blank.

IF I can get this working right, I'll probably add plugins for a dynamic actor creation that uses this setup (because it shouldn't need a plug in if I understand it right).
enemies are battlers (same as actors), but in order to pull a skill from the enemy, you have to access that enemy's available actions (which specify WHAT skill to use WHEN), strip the WHEN from that assembly, retrieve the WHAT, and with that, pull the actual skill from the skill database.

read the documentation in the help files.
it should be all there.
The spreadsheet is incomplete unfortunately, a lot of the database stuff isn't there so you must use the official documentation (which, at least for MV, is not the most user friendly and a bit tricky to navigate)

In MV, if you already have the enemy ID, you can pull the skill ID like this:
$dataEnemies[enemyId].actions[index].skillId

Btw, no need for a long script. You just need a for loop:
for (let i = 0 ; i < $dataEnemies[enemyId].actions.length ; i++) {
$gameVariables.setValue(i, $dataEnemies[id].actions.skillId)}

(or whatever the MZ equivalents are)
@AmVa I like to use this site, which I think is really nicely laid out.


Note, AmVa has the right idea but there are some slight errors in his code - game variable 0 should not be used, as no in-editor event commands can access it. It's also missing the index after $dataEnemies[id].actions

Try this:
Code:
$dataEnemies[enemyId].forEach((action, index) => $gameVariables.setValue(index+50, action.skillId));

Replace the 50 with the variable ID you're starting at.
Yeah sorry, I wasn't sure if that code even applies to MZ so just laid out the concept in general without testing.

I do use RPGMakerMV Library occasionally. it's laid out very nicely if you know what you're looking at haha but for those with little to no JS knowledge who are just looking for that one script call, it's rather confusing compared to the spreadsheet imo.
I do use RPGMakerMV Library occasionally. it's laid out very nicely if you know what you're looking at haha but for those with little to no JS knowledge who are just looking for that one script call, it's rather confusing compared to the spreadshit imo.
The spread...what?! 😮

And I agree, I didn't recommend that instead of the script call list. But if you're looking for some database info that's not on the spreadsheet, it's easier to go to that site and click into, say, dataClasses, than to try to find anything in the weird official API page.


This is the MZ script call spreadsheet i was speaking of in case anyone is looking- I found it here on the forums its much more useful than the official documentation.

Thank you very much I think this script will do what I was looking for!

Original thread: https://forums.rpgmakerweb.com/threads/can-i-set-multiple-variables-from-a-single-script-call-result.162407/