On [OBJECT] Created no longer running as it used to

0 favourites
  • 8 posts
From the Asset Store
This is a single chapter from the "Construct Starter Kit Collection". It is the Student Workbook for its Workshop.
  • I am currently coming across a sudden issue and need help on it. I have been working on this project for over a few years as of now and this issue has suddenly sprung up on me. I have encountered multiple issues through my development and have made workarounds but this one I am struggling to understand. I had implemented this within the first year of development and never came across any issues until now. When an object is created, it is given properties among other things. I have begun to notice that this event runs when playing the game but it eventually stops running, making the objects no longer obtain the properties that are necessary for the gameplay. One such property that is a dead give-away that it isn't running is a simple cosmetic property I have applied to it. It no longer switches to the cosmetic that has been saved into the code and doesn't change. I've been stuck on it for only a few days but it has made me worry more as I cannot seem to find a solution to it.

    Subscribe to Construct videos now

    Tagged:

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Have you tried using an older version of C3 to see if the problem still persists?

    If the problem goes away in an older version, try to pinpoint the version it happened check the changelog for anything that might be related. Then you can narrow down the issue and file a bug report to get it fixed.

    If it still happens in an older version, it's more likely that it was due to a change you made recently in your code.

  • I decided to take a look at your suggestion since I didn't even know I could do that and now I have done multiple things to see if it is construct that is causing the issue or if it is just my code and from all of the tests it seems to be my code, although I am still so confused on when, why, and how it had become an issue.

    - I downgraded construct 3 and my project to see if the version is an issue and the bug resumed.

    - I also decided to load up an older version of my project to see if the recent versions just seem to have this bug, and the bug did not appear in the older version as far as I have seen.

    I'm going to see if moving around my code does anything but before I do that I'll be downgrading one more version just to be certain. I do not see any errors in my code to cause this issue to happen which that one line of code seems to be the only piece of code not currently running but only after a certain amount of time. I'm curious if it's possibly a loading issue of some sorts where I am just having it do too much at once yet I feel as though I am overthinking that aspect, anyways, I'll be reporting back if I somehow find a fix.

    - On another note though, I tried doing a work-around changing the "On Created" event into a "for each" event which still produced a similar result where the "for each" just didn't run after a while, although I feel as though it would have done that regardless.

  • If it's a code issue, you are probably your own best bet at identifying what went wrong, especially for a project years in the making.

    It's great that you had an older version of your project to check and compare against.

  • I think the must frustrating part is that it would work and then it suddenly would stop working. I've noticed a pattern, after one full run through the game then going back into it after being defeated is when this bug begins to occur. Although there aren't any variables or events that prevent this line from running, besides if the object were not to spawn. I had a similar issue earlier but did a workaround rather than figuring it out, where a particle effect would have a timer on creation which would help trigger the boss. This new bug though cannot be worked around just as the other could have. I'm more than likely going to come back to this in the next day but thank you for your assistance and suggestions. It narrowed down my scope of what this issue could be, from possibly an engine issue to being just my code. I'll need to thoroughly go through the code to hopefully see a solution. Yet if there is an way you or others can help, I'll leave the code available here for a bit. Here is what is supposed to happen when running.

    - Beehives spawn in on the map and have a timer made to spawn bees

    - On this timer, the beehives make a specified bee according to their instance variable

    - This then prompts an "On Created" event to play out which will apply a power-up drop if available, find a specified path to a random position, add to a total count of enemies, and apply a cosmetic if necessary.

    As I have mentioned, this project is years old and was more of my breaking point into using Construct 3, which means some bits are old and messy while others are a lot more modern on my knowledge over the few years. If someone can find a fix before me I'd greatly appreciate it, although it may take some time since, well, there is a LOT of code.

    https://drive.google.com/file/d/1XG6xq-thjkRZlxMk4sHlxvpWDMeD_vWs/view?usp=sharing

  • I took a peek at your project - Just a guess from a quick look, but, I think perhaps LocalStorage is being used incorrectly.

    Usually you would use a "Get Wardrobe4" action within your "On Created" event (You can then use "Wait until previous actions" and then set the bee animation, all in 1 event, no need for triggers!)

    Currently, the only "Get Wardrobe4" event is placed within a LocalStorage trigger event. Trigger's will never run unless an action elsewhere prompts the trigger to run

    If you have Discord, I am happy to try and help out, and there is also the community Discord where you might find some assistance too.

    EDIT: On more thinking, if you did use "Wait until previous actions", then that wouldn't take into account "On Exists" failing - Perhaps it's worth setting a default value for LocalStorage at the start of layout, so it will always have a value and will never need to check "On Exists".

  • I do have discord, it's the same username I use here. When it comes to the wardrobe, all values are set when starting the project from the beginning, which is when you open it from the main title screen, 00, it should be found in Loading Functions in the Loading Event sheet Group, which uses functions to load stuff in bulk. Although I will take a look on my own when it comes to it. I do not believe that to be the case, but I could be wrong. The issue is that I notice the one event not running, which it used to ran and then suddenly stopped running after a certain amount of time in the game. The cosmetic within the 'On Created' event has helped me to see that there is an issue, since values within the event also tie into limiting the amount of bees created and possibly giving power-ups by chance. I'm gonna take a full look into this soon, just to see what I have done wrong compared to my older renditions (more than likely going to see the version where it stopped working)

    On your 'EDIT' statement, I try not to use the 'On Exists' function unless I know how I would use it, because I'm still trying to figure that one out.

  • I have officially found the issue in my code and it is quite embarrassing on what it was. Somewhere in the code I disable the whole group related to how the Bees spawn, which then never gets reenabled, for some reason I never noticed this till recently which confuses me since I never came across this problem before. Thank you guys for your help on this matter, I have been struggling and only recently tried the forums to see if anyone can see an issue in my own code which, in the end, I figured out since doing some narrowing down on when the bug occurred. Again, thank you all and I hope everyone has a good day, happy creating!!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)