Enemies die again after save loads?

Get help using Construct 2

Post » Mon Sep 22, 2014 12:41 am

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!
B
4
Posts: 78
Reputation: 606

Post » Mon Sep 22, 2014 12:45 am

prevent the enemy from saving by addming a behavior No save to the enemies
B
12
S
6
Posts: 118
Reputation: 1,466

Post » Mon Sep 22, 2014 1:13 am

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!
B
4
Posts: 78
Reputation: 606

Post » Mon Sep 22, 2014 1:17 am

Hexxiss wrote: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 :)
B
12
S
6
Posts: 118
Reputation: 1,466

Post » Mon Sep 22, 2014 8:10 am

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.
B
7
Posts: 61
Reputation: 417

Post » Sat Sep 27, 2014 7:35 pm

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?
B
4
Posts: 78
Reputation: 606

Post » Sun Nov 09, 2014 12:53 pm

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.
The moderators are corrupt and ban for no reason, especially that condescending neckbeard asshole Kyatric. The forums are filled with fanboys.
Banned User
B
22
S
7
G
1
Posts: 558
Reputation: 2,925


Return to How do I....?

Who is online

Users browsing this forum: tarek2, wenwen11212016, Yahoo [Bot] and 11 guests