Skip to content

Delete Multiple Objects

ZephiriusZephirius Member Posts: 411
edited January 2022 in Builders - Scripting
How would you delete multiple object simultaneously - in this case 26 placeable objects. There has to be a more effecient way to to this than using DeleteObject 26 times...?
void DestroyAll(object oObject, int nAmount)
{
//Not sure what to do
}

Comments

  • ProlericProleric Member Posts: 1,281
    I think you mean DestroyObject(). Just do it 26 times. If the objects have the same tag,
    void   DestroyAll(string sTag)
    {
      object oObject      = GetObjectByTag(sTag, 0);
      int    n          = 0;
    
      while (GetIsObjectValid(oObject))
        {
          SetPlotFlag(oObject, FALSE);
          DestroyObject(oObject);
    
          oObject = GetObjectByTag(sTag, ++n);
        }
    }
    
  • ZephiriusZephirius Member Posts: 411
    Proleric thank you. I think you know what I need before I do, Ha! Yeah, I've have them all with the same tag "LETTER"
    Will give this a try - ;)
Sign In or Register to comment.