Enemies die again after save loads?

0 favourites
  • 7 posts
From the Asset Store
Template for a generic save / load system, fully documented in comments and video
  • I have a problem with a game after you load it's save file.

    Currently my enemies are set to destroy when their health reaches 0, and drop a random item. Also, all of the enemies are preloaded into the layout.

    However, if you kill an enemy in the layout (or all the enemies for that matter) save your game, and then load it again, when the layout loads the save file - all of the enemies then die again, and drop another random item.

    I'm assuming it's because the save file loads the layout, says "the enemies health is supposed to be 0" which then causes them to die, and respawn the item.

    Is there anyway around this?

    Thanks!

  • prevent the enemy from saving by addming a behavior No save to the enemies

  • I am so thankful, that that was so easy to do. I'm still new to the whole save game thing, so I didn't realize there was a behavior I could use. Either way, thank you so much!

  • I am so thankful, that that was so easy to do. I'm still new to the whole save game thing, so I didn't realize there was a behavior I could use. Either way, thank you so much!

    you are very welcome

    here is a tips can be helpful to you in future : always check for C2 updates , don't forget to read the releases notes

    or each time you install an update don't forget to chak the objects box you might finde a new object , and chek beahviors there might be new ones, this way you will know all features in C2 and by the way check the plugins and beahvior in the forum there is very helpful stuffs will make you do what you think you can't do

  • If you want the game to remember the enemies are dead but not to die, you can use Web storage to make note of which are suppose to be dead, and get construct 2 to check if the two variables match up, if they don't then don't spawn the enemies, if they do then spawn them. However if you want all the enemies to re spawn if they quit and re load ( MMO Style ) Then Warville's solution is perfect.

  • So, strange thing, I thought it was working, but it doesn't seem to be now.

    I've given the enemies in the layout the "No Save" behavior. Yet, when I load the game they still all destroy themselves.

    They're simply set to destroy when their health reaches 0. Any ideas what would caused the enemies state to still be saved when the game is loaded even though they have the "No Save" behavior?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • It might be to do with their instance variables used for their health, if the game saved the variables as the amount needed for them to die then you might need to reset the variables.

    Just an idea, not sure it'll work.

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