Jump to content


Photo

instance_number() issues?

gm:studio solved

Best Answer flyingsaucerinvasion, 29 March 2016 - 12:12 AM

deleting every instance of a certain object is as simple as this

 

with (object_type) { instance_destroy(); }

 

they must be active, so if any are deactivated, reactivate all of them first before destroying them.

 

instance_activate_object (object_type);

with (object_type) { instance_destroy(); }

Go to the full post


  • Please log in to reply
2 replies to this topic

#1 Starbladek

Starbladek

    GMC Member

  • New Member
  • 4 posts
  • Version:GM:Studio

Posted 29 March 2016 - 12:05 AM

I'm trying to delete all instances of a given object. Here is the script I am using to achieve this:

 

02d5ab288ea90492269d72ccb74d571d.png

 

It's supposed to get the number of instances of a given object, use a for loop to find each one, and delete them with instance_destroy(), with the show_debug_messages showing its progress.

However, here is the result:

 

1207cf2ae2f82767c119f18671d8dd20.png

 

Am I doing something wrong here? Shouldn't it have deleted all of the instances? Is there a better way to go about what I want to do?


Edited by Starbladek, 29 March 2016 - 12:34 AM.

  • 0

#2 flyingsaucerinvasion

flyingsaucerinvasion

    GMC Member

  • GMC Member
  • 720 posts
  • Version:GM:Studio

Posted 29 March 2016 - 12:12 AM   Best Answer

deleting every instance of a certain object is as simple as this

 

with (object_type) { instance_destroy(); }

 

they must be active, so if any are deactivated, reactivate all of them first before destroying them.

 

instance_activate_object (object_type);

with (object_type) { instance_destroy(); }


Edited by flyingsaucerinvasion, 29 March 2016 - 12:14 AM.

  • 0

#3 Starbladek

Starbladek

    GMC Member

  • New Member
  • 4 posts
  • Version:GM:Studio

Posted 29 March 2016 - 12:33 AM

Oh lol thanks


  • 0





Also tagged with one or more of these keywords: gm:studio, solved