MV Help with YEP_MessageCore TypeError

Hello, I have been starting to learn JS for RPG MAKER MV so I do not know much about this...

First, let me show you the code:
JavaScript:
var nombre = [];

for (let i = 0; i < $gameParty.members().length; i++) {
    var actualActor = $gameParty.members().actorId();
    
    if ($gameActors.actor(actualActor).isDead()) {
        nombre.push($gameActors.actor(actualActor).name);
    }
}

nombre.push("Nobody");

$gameMessage.setChoices(nombre, 0, nombre.length - 1);

var opcion;

$gameMessage.setChoiceCallback(function(opcion) {
console.log((typeof opcion)+" "+opcion);
    switch (opcion) {
        case $gameActors.actor(1).name:
            $gameMessage.add("Your hunting services are still required!");
            break;
        case $gameActors.actor(2).name:
            $gameMessage.add("Rise, my fellow " + gameActors.actor(2).currentClass().name + "!");
            break;
        case $gameActors.actor(3).name:
            $gameMessage.add("Scholarly aberration, your job is not done yet!");
            break;
        case $gameActors.actor(4).name:
            $gameMessage.add("Ugh! This pestilence! You are not one of us!");
            break;
        default:
            $gameMessage.add("Then, please, leave so others can be attended.");
            break;
    }
});

Now here is the error:
rpg_managers.js:1949 TypeError: text.match is not a function
at Window_ChoiceList.Window_Base.setWordWrap (YEP_MessageCore.js:715)
at Window_ChoiceList.Window_Base.convertEscapeCharacters (YEP_MessageCore.js:707)
at Window_ChoiceList.Window_Base.drawTextEx (rpg_windows.js:266)
at Window_ChoiceList.textWidthEx (rpg_windows.js:3908)
at Window_ChoiceList.maxChoiceWidth (rpg_windows.js:3899)
at Window_ChoiceList.windowWidth (rpg_windows.js:3875)
at Window_ChoiceList.updatePlacement (rpg_windows.js:3849)
at Window_ChoiceList.updatePlacement (YEP_MessageCore.js:987)
at Window_ChoiceList.start (rpg_windows.js:3834)
at Window_Message.startInput (rpg_windows.js:4441)
SceneManager.catchException @ rpg_managers.js:1949
SceneManager.update @ rpg_managers.js:1910

What is the problem and how do I solve it? Thank you for reading and sorry for bothering.
Please put your code inside of CODE tags (the </> on the edit bar). Otherwise, [i] is the BBCode for italics and we lose indentation.

Then please explain how you're using this code. Is it in a plugin and you're calling it someplace? Are you stuffing all of this into a Script command?
Right, sorry, I edited it to follow the format. All of this is going inside a Script Command block, I am not calling any plugin but I believe somehow it is clashing with YEP_MessageCore. The script, as for what I am trying to do now, is to first check which Actors inside the party are dead and put them on an array which makes them an option to be selected in a choice. Then takes the chosen option by the player and shows a text message depending on the actor chosen through the choice.
Logically, you can condense that entire beginning part - MV provides a deadMembers() function. So all you have to do is
Code:
let nombre = [];
$gameParty.deadMembers().forEach(actor => nombre.push(actor.name());

Syntactically, Game_Actors don't have a name property, so when you do $gameActors.actor(actualActor).name) that's pushing undefined into your array.

name() is a getter method, as I demonstrated in my code above.

That's why you're getting "text.match() is not a function," because you're not providing an array of strings, you're providing an array of undefined
Just an additional note:
for (let i = 0; i < $gameParty.members().length; i++) { var actualActor = $gameParty.members().actorId(); if ($gameActors.actor(actualActor).isDead()) { nombre.push($gameActors.actor(actualActor).name); } }
wouldnt do anything. actualActor isnt given a value here and cannot be used. $gameParty.members() returns an array and actorId() is not an array function. you'd want to use i to specify the current actor's index within the member array.
$gameParty.members() returns an array and actorId() is not an array function. you'd want to use i to specify the current actor's index within the member array.
Good call - I didn't even notice that, I figured the [i] had been eaten by the forum.
So, it worked. I have no longer an error, I just now need the message to show to the player, which is to learn the functions needed for that to happen. Thank you for pointing out the [ i ]. I had it before but I must have deleted it by mistake while trying to fix things previous to resorting to the forum's help. Thank you for everything.

Original thread: https://forums.rpgmakerweb.com/threads/help-with-yep_messagecore-typeerror.166585/