MECHDRAGON777 wrote: ↑
Mon Jul 13, 2020 5:56 pm
I will look into this over the coming week. Might be a good way to have a friend teach me how to make NPCs properly.
Edit: Since this exact NPC was used in my MaGLX3 entry, I would recommend waiting for that only in that I believe the team for the episode is fixing stuff as well. If they have fixed it, then it might be better to release that as an update when it is time.
This particular warning, saying "Improperly calling NPC.get before onStart" happens if NPC.get is called onStart. Just like all other warnings, it only appears in the editor and doesn't have a bearing on the functionality of the lua script. However, what it does point out is something that's either deprecated or code that may explain why certain things don't work as the writer of the code intended.
In this case, it's the latter. Calling NPC.get() or other functions that access SMBX objects (like players) before onStart never worked, since the level is still being loaded by then.
The solution is to not do that, but instead to use onStart for whatever you needed that NPC.get() call for, or to refactor the code in such a way that that NPC.get isn't necessary (which might already be the case if the NPC has previously worked with the faulty NPC.get in place, in which case you just have to remove the lines. Shouldn't make a difference.).