1
Programming Questions / Re: Make object be destroyed if the player has any amount of secrets less than 8?
« on: July 12, 2016, 09:36:10 AM »
Thank you, Nogard, it worked. I forget that codes can have more details than I think.
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
Since you haven't provided any code, I can only speculate that the problems is being caused by the indexes used for most secrets starting at 0, and your count starting at 1. You should really provide code when asking a question like this though.This is the code I tried, and as I said I want it to make the object be destroyed if the amount of true secrets is less than 8, but the object is being destroyed only when the amount is exactly 7 true secrets. I didn't find some way to count variables like we can count instances using "instance_number".
if global.secretItem[1] = true
if global.secretItem[2] = true
if global.secretItem[3] = true
if global.secretItem[4] = true
if global.secretItem[5] = true
if global.secretItem[6] = true
if global.secretItem[7] = true
if global.secretItem[8] = true{
//nothing happens
}
else{
instance_destroy()}
You could make the object itself persistent I guess? Just be sure to check if one exists before making more so you don't overload everything.The object is actually already persistent.