Skip to content

Part of script wont fire

I'm perplexed. I'm simply trying to destroy oSloop, but it won't disappear. oSloop happens to be a placeable... I've no problem spawning in the new boat at the end of the script. It just won't destroy oSloop. Anyway, thanks for the responses ahead of time...
string sGroan;
string sGroans;

#include "nw_i0_2q4luskan"
void main()
{

   object oPC = GetPCSpeaker();
   if (!GetIsPC(oPC)) return;

   sGroan = "as_cv_woodwater1";
   sGroans = "as_cv_woodwater2";

   DelayCommand(0.5, AssignCommand(oPC, PlaySound(sGroan)));
   DelayCommand(2.5, AssignCommand(oPC, PlaySound(sGroans)));

   object oSloop = GetObjectByTag("SLOOP_01");
   DestroyObject(oSloop, 0.0);

   effect eQuake = EffectVisualEffect(VFX_FNF_SCREEN_SHAKE);
   ApplyEffectToObject(DURATION_TYPE_INSTANT, eQuake, oPC);

   location lLoc = GetLocation(GetWaypointByTag("SLOOP_RENEW"));
   DelayCommand(1.5, CreateObjectVoid(OBJECT_TYPE_PLACEABLE, "zep_ship002", lLoc));

}

Comments

  • ProlericProleric Member Posts: 1,282
    Just before DestroyObject,

    SendMessageToPC(oPC, GetTag(oSloop));

    will confirm whether an object with that tag exists.

    If not, the tag is wrong.

    Otherwise, perhaps you have more than one object with that tag?
  • TerrorbleTerrorble Member Posts: 169
    Proleric wrote: »

    Otherwise, perhaps you have more than one object with that tag?


    I've accidentally created multiple of the same placeable via script before and when I went to destroy it, it was still there. Rather, one of its multiple copies was still there.

  • ProlericProleric Member Posts: 1,282
    In which case, you need to delete them all.
       int n = -1;
       object oSloop = GetObjectByTag("SLOOP_01", ++n);
       while (GetIsObjectValid(oSloop))
         {
           DestroyObject(oSloop, 0.0);
           oSloop = GetObjectByTag("SLOOP_01", ++n);
         }
    
Sign In or Register to comment.