TypeError: Cannot read property 'y' of undefined

Well, it's officially gotten weird. If I could take a look at the project itself, I could explore. Without it I can only guess. Is the item guard attack skill run window a custom created one or just a default choice window?
here ya go, have fun with that, because i'm lost
Well, it's officially gotten weird. If I could take a look at the project itself, I could explore. Without it I can only guess. Is the item guard attack skill run window a custom created one or just a default choice window?
here you go, this is the project, you can find everything that i have been talking about in this thread there
Note* (this didn't go through the first time, i am sorry for ending up positing it twice.)
Well, I guess I found far from everything. I saw several significant changes in the project compared to the one you've been talking about, for example I did not find any BattleChoiceOn, BattleChoiceOff or BattleTextOn methods, due to lack of which I encountered several crashes on the first map. But most importantly I have also encountered crashes due to inappropriate graphics naming (our favorite %20 symbol substituting the space).
Nevertheless, after editing a couple of sprites, deleting a couple of lines of code related to missing code and delete of unimportant sprites I finally managed to get the code to run.
And guess what...
SceneManager._scene._messageWindow._choiceWindow.y = 30 moves the window upwards.
Screenshot_45.png


Just like it should.
So try it as a script command inside the event directly maybe wherever you need to move the window.
SceneManager._scene._messageWindow._choiceWindow.y = 30;
It is always best to NOT change the default scripts, but to make a plugin instead. If you make changes to the default scripts, you have to remember what you've done if you ever take an update and update your project, so you can redo the changes. And if you make a mistake and have to undo something, or try a different approach, you can find yourself in all sorts of hot water, making a complete mess of the scripts, with no idea how to get back to the original again without replacing the whole lot.
Well, I guess I found far from everything. I saw several significant changes in the project compared to the one you've been talking about, for example I did not find any BattleChoiceOn, BattleChoiceOff or BattleTextOn methods, due to lack of which I encountered several crashes on the first map. But most importantly I have also encountered crashes due to inappropriate graphics naming (our favorite %20 symbol substituting the space).
Nevertheless, after editing a couple of sprites, deleting a couple of lines of code related to missing code and delete of unimportant sprites I finally managed to get the code to run.
And guess what...
SceneManager._scene._messageWindow._choiceWindow.y = 30 moves the window upwards.
View attachment 103970

Just like it should.
So try it as a script command inside the event directly maybe wherever you need to move the window.
SceneManager._scene._messageWindow._choiceWindow.y = 30;
could you upload a copy of the project with the changes you made to it so i can see what you did?


It is always best to NOT change the default scripts, but to make a plugin instead. If you make changes to the default scripts, you have to remember what you've done if you ever take an update and update your project, so you can redo the changes. And if you make a mistake and have to undo something, or try a different approach, you can find yourself in all sorts of hot water, making a complete mess of the scripts, with no idea how to get back to the original again without replacing the whole lot.
that is true, but what i do not understand is why the thing i did worked in one case but not the other.

So the issue was that the common event wasn't doing two things: it either tried to run before there was the window up, or it was too fast and ran even before the window was created, i will have to mess around some more but lets see if i can get it to work.

Original thread: https://forums.rpgmakerweb.com/threads/typeerror-cannot-read-property-y-of-undefined.102969/