I have an issue with my menu : Cannot read property "param" of undefined

Hello, since a few days, I tried to create a plugin by myself but I had an issue that I didn't know how to resolve..

1550617159-capture1.png


1550617159-capture-2.png


1550617443-capture3.png


I understand that the problem comes from the line with TextManager.param(paramId) and _actor.param(paramId) but i don't know how to resolve it.

If anyone has a solution, I'm interested ^^'.
from the line with TextManager.param(paramId) and _actor.param(paramId)

The error is only coming from one line, not both. You can tell from the error message exactly which line number (we can't see your line numbers in the code screenshot).


I know it is the this._actor line based on the error message. "cannot read property param of undefined" is like trying to do this:
Code:
undefined.param
Obviously, that will cause an error because "undefined" doesn't have any properties.

So you can deduce that:
Code:
this._actor === undefined

  1. Do you expect "this._actor" to have a value?
    • If so, where does this value come from?
  2. The drawAttack function you wrote takes 2 parameters but you are passing 3. I don't know which one is right
Probably you need to receive actor as a parameter in drawAttack and use that instead of this._actor but that's just a guess.
Hello !

I resolve the problem this evening, like you said I added the missing parameter which was actor, and I initialized "this._actor" with actor.

1550690910-capture1.png


Thanks to you I understand the problem more easily, thank you for your answer ^^

Original thread: https://forums.rpgmakerweb.com/threads/i-have-an-issue-with-my-menu-cannot-read-property-param-of-undefined.105855/