Legendracula's Recent Forum Activity

  • That won't be an issue. On any of the six levels you can't kill a Baddie before 5 seconds.

    I think I have found the exact issue, but don't know how to resolve it. It is as you suspected.

    The line "Heroes on Destroyed" -> Local Storage -> set "baddiecount" to BaddieCount doesn't save until the following play through. Something is stopping the newest data from saving. I have tested many times and it always saves the score from the previous playthrough, not the one I just finished.

    For reference, this is what happens to end the layout. The first event "destroy heroes" is what triggers save event, but it's a separate event entirely. This Life event is below the saving event in the list of code. Not sure if that matters.

    Also, I have a few of these saves happening, one for all monsters, one for a specific monster and one for a Boss monster (defeat boss 5 times to unlock). Could they be interfering with each other?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Okay,I can fix the second part with a condition.

    Does the rest of the code look okay though? If things did work instantly, would you expect this code to do what I want it to do? For whatever reason, I have a lot of trouble making sense of Local Storage events.

    I'm trying to figure out the timing and where the critical point is. I have so much trouble making sense of this though.

  • I have a clunky save system in my game that only works at a certain time.

    This is what I want to happen:

    -Each time an enemy gets destroyed, Add 1 to Baddie Count.

    -When the hero dies, save the storage item as the current BaddieCount.

    -On loading a new layout(the Main Menu), set BaddieCount to the saved item.

    -Continue this loop for each play-through, so that BaddieCount will keep adding, even after the game is closed.

    Once BaddieCount reaches 500, a new character will be unlocked.

    What is happening:

    Everything works as expected, but the LocalStorage doesn't save until I complete a second playthrough.

    For example when playing through de-bugmode:

    Round 1, I kill 20 enemies, BaddieCount sets to 20. I close game. Baddie count is back to 0.

    Open again. Round 1, I kill 20 enemies, BaddieCount sets to 20. Round 2, I kill 10 more enemies, BaddieCount sets to 30. Now If I close the game and open, the BaddieCount will be set to 20, not 30.

    It's as if my data is saving one play-through too late. Any ideas on how I can fix this? I have included an image of the relevant code.

    Thanks

  • You do not have permission to view this post

Legendracula's avatar

Legendracula

Member since 6 Mar, 2021

None one is following Legendracula yet!

Trophy Case

  • 3-Year Club
  • RTFM Read the fabulous manual
  • Email Verified

Progress

5/44
How to earn trophies