Aller au contenu

Photo

Objects refuse to be destroyed


  • Veuillez vous connecter pour répondre
4 réponses à ce sujet

#1
El Condoro

El Condoro
  • Members
  • 148 messages
Can someone tell me why the tents won't get destroyed please? The goblins behave but the 3 tents and the axe stay put. I have spent too long on this and my brain is fried. Cheers.


// All goblins will leave the camp
// Tents will be destroyed
void main()
{
 object oWP = GetObjectByTag("wp_goblin_end");
 
 object oObject = GetFirstObjectInArea();
 while (oObject != OBJECT_INVALID)
 {
  string sTag = GetTag(oObject);
  string sLeft = GetStringLeft(sTag,8);
  
  if (sLeft == "c_goblin")
  {
   AssignCommand(oObject,ClearAllActions());
   DelayCommand(2.0,AssignCommand(oObject,ActionMoveToObject(oWP)));
   DestroyObject(oObject,20.0);
  }
  oObject = GetNextObjectInArea();
 }
 
 object oTent1 = GetObjectByTag("plc_camp1");
 object oTent2 = GetObjectByTag("plc_camp2");
 object oTent3 = GetObjectByTag("plc_camp3");
 object oAxe1 = GetObjectByTag("plc_axe1");
 
 DestroyObject(oTent1);
 DestroyObject(oTent2);
 DestroyObject(oTent3);
 DestroyObject(oAxe1);
}

#2
SkywingvL

SkywingvL
  • Members
  • 351 messages
Are you sure that GetObjectByTag is returning the correct object? For example, if you had multiple objects with those tags, you might be looking at the wrong one to delete here.

#3
El Condoro

El Condoro
  • Members
  • 148 messages
I originally wanted to have all the objects to be deleted to have the same tag but that didn't work, so I changed the tags to what's shown. They are unique tags.

#4
Lugaid of the Red Stripes

Lugaid of the Red Stripes
  • Members
  • 955 messages
The tents and axe need to placeables and set to non-static.

I once was stuck for a day on an placeable that wouldn't destroy. Then I realized that I had bugged up the on-enter script that spawned-in the placeable to begin with, so I had dozens of identical placeables, all on the exact same spot. The destroy script worked, it just didn't destroy them all. The point is, once you've tried all the logical approaches, start thinking of the illogical.

#5
El Condoro

El Condoro
  • Members
  • 148 messages
Man! I knew it was a simple fix. You're a legend - thanks. It's all good now. Cheers