Page 1 of 1

ACS Randomizing

PostPosted: Mon Mar 22, 2021 12:45 pm
by Mav3r1ck
I'm having a bit of trouble with the script below.

Code: Select allExpand view
script 19 (void)
{
   if (lineTrig2 == 0)
   {
       lineTrig2 = 1;

      Ceiling_RaiseByValue(416, 64, 96);
       Delay(12);

      Thing_FadeSpawn(424, 30, 432);
   }
}

script 20 (void)
{
   Thing_FadeOut(432, 1);

   rifleLocation = Random(448, 504);
   Delay(1);

   Floor_LowerByValue(440, 32, 64);
   Delay(16);
   ChangeFloor(440, "FLAT4");

    TeleportOther(432, rifleLocation, 0);
   Delay(35);

   Thing_FadeIn(432);

   if (rifleLocation == 448) Thing_FadeSpawn(448, 30, 0);
   else if (rifleLocation == 456) Thing_FadeSpawn(456, 30, 0);
   else if (rifleLocation == 464) Thing_FadeSpawn(464, 30, 0);
   else if (rifleLocation == 472) Thing_FadeSpawn(472, 30, 0);
   else if (rifleLocation == 480) Thing_FadeSpawn(480, 30, 0);
   else if (rifleLocation == 488) Thing_FadeSpawn(488, 30, 0);
   else if (rifleLocation == 496) Thing_FadeSpawn(496, 30, 0);
   else if (rifleLocation == 504) Thing_FadeSpawn(504, 30, 0);

   SetLineSpecial(512, ACS_Execute, 21);
   SetLineSpecial(520, ACS_Execute, 22);
   SetLineSpecial(528, ACS_Execute, 23);
   SetLineSpecial(536, ACS_Execute, 24);
   SetLineSpecial(544, ACS_Execute, 25);
   SetLineSpecial(552, ACS_Execute, 26);
   SetLineSpecial(560, ACS_Execute, 27);
   SetLineSpecial(568, ACS_Execute, 28);

    SetLineTexture(512, SIDE_FRONT, TEXTURE_BOTTOM, "SW1TEK");
   SetLineTexture(520, SIDE_FRONT, TEXTURE_BOTTOM, "SW1TEK");
   SetLineTexture(528, SIDE_FRONT, TEXTURE_BOTTOM, "SW1TEK");
   SetLineTexture(536, SIDE_FRONT, TEXTURE_BOTTOM, "SW1TEK");
   SetLineTexture(544, SIDE_FRONT, TEXTURE_BOTTOM, "SW1TEK");
   SetLineTexture(552, SIDE_FRONT, TEXTURE_BOTTOM, "SW1TEK");
   SetLineTexture(560, SIDE_FRONT, TEXTURE_BOTTOM, "SW1TEK");
   SetLineTexture(568, SIDE_FRONT, TEXTURE_BOTTOM, "SW1TEK");
}

script 21 (void)
{
   if (attNum <= 3)
   {
      attNum = attNum + 1;

      SetLineSpecial(512, 0);
      Floor_LowerByValue(576, 16, 128);
   }
}

script 22 (void)
{
   if (attNum <= 3)
   {
      attNum = attNum + 1;

      SetLineSpecial(520, 0);
      Floor_LowerByValue(584, 16, 128);
   }
}

script 23 (void)
{
   if (attNum <= 3)
   {
      attNum = attNum + 1;

      SetLineSpecial(528, 0);
      Floor_LowerByValue(592, 16, 128);
   }
}

script 24 (void)
{
   if (attNum <= 3)
   {
   attNum = attNum + 1;

      SetLineSpecial(536, 0);
      Floor_LowerByValue(600, 16, 128);
   }
}

script 25 (void)
{
   if (attNum <= 3)
   {
      attNum = attNum + 1;

      SetLineSpecial(544, 0);
      Floor_LowerByValue(608, 16, 128);
   }
}

script 26 (void)
{
   if (attNum <= 3)
   {
      attNum = attNum + 1;

      SetLineSpecial(552, 0);
      Floor_LowerByValue(616, 16, 128);
   }
}

script 27 (void)
{
   if (attNum <= 3)
   {
      attNum = attNum + 1;

      SetLineSpecial(560, 0);
      Floor_LowerByValue(624, 16, 128);
   }
}

script 28 (void)
{
   if (attNum <= 3)
   {
      attNum = attNum + 1;

      SetLineSpecial(568, 0);
      Floor_LowerByValue(632, 16, 128);
   }
}


Above is a an effect that replicates the Plasma Rifle randomizing effect in D64's Final Outpost level.

I'm having a problem with where the Rifle is suppose to randomly spawn. The problem is that it's spawning in it's inital spawn location as one of the random spawn points for some reason and I can't figure out why, though I'm sure it's pretty simple.

Script 19 raises a wall and spawns the Plasma Rifle while changing it's tag number. Script 20 fades out the Plasma Rifle (makes it invisible but doesn't remove it) and moves it (suppose to) to the spawn points within 448 - 504 range which are one of eight pillars but can sometimes spawn back to it's initial spawn point, which isn't what it's suppose to do.

Can someone help me figure out what I'm doing wrong?