My SPAWN ZONE -object has a boolean object variable called “Player_Inside_This_Zone”. It’s FALSE by default. When the player gets into collision with a ZONE, it’s variable gets changed to TRUE. When the player leaves a ZONE, the variable gets changed to FALSE again.
I have enemy spawners all over my map. They spawn one set of enemies whenever the “Player_Inside_This_Zone” variable is set to TRUE in the zone instance they occupy. This works. The enemies are currently spawning as hoped.
The problem I have relates to the deletion of spawned enemies. I want my enemies to get deleted when I exit the ZONE they occupy. You can almost say that I want my enemies to get deleted when they are in collision with a ZONE which has “Player_Inside_This_Zone” set to FALSE. Something like this:
But this doesn’t quite work. These events delete too much. Consider the enemies which spawn in places where 2 ZONES overlap. As long as an enemy is in collision with one ZONE with “Player_Inside_This_Zone” set to FALSE, it will get deleted, even if that same enemy is also colliding with another ZONE with “Player_Inside_This_Zone” set to TRUE. I need to save these enemies from deletion.
What I want in a nut shell: Enemy must be deleted if they are in collision with a SPAWN ZONE which has it’s “Player_Inside_This_Zone” set to false UNLESS the enemy is also in collision with another SPAWN ZONE with “Player_Inside_This_Zone” set to true.
I’ve something similar in my game…(cos performances matter)
imo zones should not overlap…enable the grid on scene editor and place them with snap without overlap…then u may have a better clue on waz going on…
Wait wait wait
I am not sure where and IF you need repeat for each
So test each scenarios
GTFO with variable
And leave only opacity change
Now you only need set opacity to 100 when spawnzone IS NOT in collision with player
And to 255 if it is in collision with player
And now IN SEPARATE EVENT
Enemy is in collision with spawn zone
Spawn zone opacity is 100
Delete enemy
So basically you have only 2 events
And either both of them need for reach or none or one of them
BUT if any of them need then 1st event needs for each for spawn zones
2nd needs for each for enemies
Wait i just realized what i wrote above did run full circle cause if enemy is in collision with zone that opacity is 100 while being in collision with zone that opacity is 255 then enemy would still get deleted
Look your issue is due you checking 2 different things for same type of object while these objects overlap
So if you check if player is not in collision with spawn zone
then even if enemy is in collision with spawn zone which overlaps one with which player is in collision
You will delete enemy cause one of zones is NOT in collision with player
So only solution would be to delete enemies if they are not in collision with spawnzone with which player collides
Right. I’m familiar with it.
I’m just not sure how I should use it in this particular scenario.
I’ll try what you suggested:
Before I do so, I want to make sure you didn’t misspell anything. Did you really mean “Spawnzone opacity = 255”? Shouldn’t it be “Spawnzone opacity = 100”? Or did you mean to put the “Spawnzone opacity = 255” under NOT? I’m asking because it seems wrong to me.
Doesn’t work. Enemies spawn and get deleted correctly when the player enters the SPAWN ZONE from nothing and goes back to nothing. But if the player moves from a SPAWN ZONE to a new ZONE (exiting the previous one), none of the enemies from the previous one get deleted. In fact, new enemies are sometimes made, which confuses me. I don’t get it. One thing is for certain: this isn’t it.
Doesn’t work. Enemies spawn and get deleted correctly when the player enters the SPAWN ZONE from nothing and goes back to nothing. If the player moves from a SPAWN ZONE to a new ZONE (exiting the previous one), none of the enemies from the previous one get deleted. Spawners that aren’t on overlapping ground spawn one new set enemies. Spawners that are on overlapping ground spawn infinite enemies.