Hello. In my game there is an enemy who you can fight multiple times (it never truly gets destroyed). If you defeat it, it disappears temporarily until you rest. Then it reappears. This has been controlled using switches.
When you first fight the enemy, there is absolutely no problem with the running of the game. But when you rest and then fight a second time or third time, the game often closes.
This is inconsistent. Often it closes, sometimes it doesn't. When it does, it loads the battle, displays the enemy and then shuts down before the windows are displayed. There is no error code and going into the script editor to find the offending line does not yield a consistent result (once it looked like it was a problem with displaying the sprite, once it looked like a problem drawing the window, today nothing.)
I have tried reducing the amount of eventing attached to the game object by moving some of it into common events that are called. I have also tried making the sprite transparent and 'throughable' rather than switching on and off. This has never happened on any of my other projects before, although I've never created an enemy that can be fought multiple times like this before. I am happy to supply any further detail but if someone can at least shine a light on what is going wrong, I would really appreciate it!
there are only two ways to close the game without an error message:
1) if it is closed by an external program like an antivirus
2) if you give the script command to close the game
you need to give us screenshots of the enemy event(s) if you want help with checking the second option.
the first option is on your computer but outside the project, you need to check the logs of all your protection and security programs (there are more than just your official antivirus)
Many thanks my friend. I have taken the object events as well as the troop events. I can share the common events too, if needed, but I haven't because the game is closing before any of them are called.
Yes, I know that the object eventing is convoluted but it's because I was trying to fix this error.
I can't see anything out of the ordinary so if you can then muchos muchos gracias.
So you are turning switches on. Where or what do those switches affect?
44 and 27.
There is a common events called what do they do?
Gotcha. Thanks.
Can I at least assume that the problem will NOT be with the default scripts, but rather with the ones I have imported?
Also, will it be a case of simply checking the configuration modules of those scripts, or will I have to go through the entirety of each one, coding sections and all?
Okay, I've done that. I went through and did searches for "switch" and "variable" on all imported scripts. I only looked at the modules and recorded the ones where a switch >0 was bound to a function. Yes, there are indeed some which are incorrectly bound (screenshot attached) but none that I can that are active at this point in the project and none that (as far as I can see) would order the game to close.
My next step is going to be to remove the scripts one at a time and try to replicate the problem to isolate which one is causing the error.
One thing that is interesting, though: the fault is inconsistent. It never occurs on the first time the enemy is fought on any particular session (i.e. if the game is saved and loaded, the fault never occurs, even if the enemy has been defeated once already.) It is always on at least the second time fighting the enemy in any particular session. And the game closes at the same point. i.e. just before the command window displays.
However, the occurance is inconsistent. I just tried to replicate it and the first time it crashed on the 4th battle, then the 2nd, and then not even after 7. If you have any thoughts on this, I would be very grateful to hear them.
there is another thing you should do before disabling all the scripts one after another:
compare how many lines each script has in the editor to the number of lines it has in its original download.
one of the possible causes for a close without an error message is if the function iterations went wrong due to a missing close of one script - and it is easy to miss on copy&paste if you made a mistake and missed the last end on the last line or something like that, especially since most scripts have multiple end lines.
and comparing the number of lines is the quickest way to find out if there was such a copy&paste error.
I've seen the RGSS3-player being kicked by Windows into nirvana without any hint what has happened so many times I could never count.
My guess I can tell from experience with this frustrating behaviour is that at least one of the added scripts in the game maybe has a few edge-cases where it's accessing object-instances that get killed too early while their code still hangs somewhere like e.g. in the callstack.
I can't say for sure, but on my end, this problem occurs way less often since I carefully reordered many of my own processes that involve terminating and disposing objects. If the custom-code in your project is not your own, it may be an even worse task to solve this (if it even was what has helped).
~炬燵あ