Voiceup Powerups

Post your example zscripts/ACS scripts/etc here.

Voiceup Powerups

Postby Hey Doomer » Tue Nov 23, 2021 6:03 pm

The idea here is dead marines spawn a suit powerup that scans the area for different things and announces them. There are two class sets, one for spawned items (it's just same Qcode with a transformation to take up less space) and one for the powerups. The powerups use a ThinkerIterator to scan actors for any that are found in a dynamic array. This is a bare bones approach that works and for me, anyway, is easy to understand. The hook is that you have to stand still for them to work. My thought is that if you're standing still you're probably around a corner and may need the information. Doom's stuff is scattered around levels, of course, and often hidden from sight. Maybe this helps.

Health powerup example:
Code: Select allExpand view
class vuObjHealth: vuObject // blue
{
   Default
   {
      Powerup.Type "vuHealth";
      Powerup.Color "#0000ff", 0.5;
      Translation "0:0=195:195";
   }
}
// health
class vuHealth : Voiceup
{   
   void init()
   {
      vuActors.Push("Medikit");
      vuActors.Push("Stimpack");

      vuSingle = "health";
      vuPlural = "health";

      setDefaults();
   }
   override void DoEffect()
   {
      if (!vuDelay)
      {
         init();
      }
      else
      {
         doScan();
      }
   }
}


init() initializes variables and the activation announcement. doScan() does the lifting of speaking or scanning. Speaking is done by splitting a sentence to an array, adding "vu" to the front, and playing that sound. Nothing fancy and gets the job done. Here's that bit:

Code: Select allExpand view
   void setSentence(string sentence)
   {
      Array<string> words;
      sentence.Split(words, " ");
      for (int i = 0; i < words.Size(); i++)
      {
         vuVoice.Push(words[i].Format("vu%s", words[i]));
      }
   }
   void speakNextWord()
   {
      string s = vuVoice[0];
      vuVoice.Delete(0);
      vuDelay = vuVoice.Size() == 0 ? 5 : 0.5;
      Owner.A_StartSound(s, CHAN_VOICE, CHANF_NOSTOP);
   }


Too bad classes don't have constructors, but this is pretty cool nonetheless. Maybe there's an easier way. This makes it easy to add new powerup scanners and messages, such as scanner specific for bosses, for example. Just an idea.
You do not have the required permissions to view the files attached to this post.
Hey Doomer
 
Joined: 25 Sep 2021
Operating System: Windows 11
OS Test Version: No (Using Stable Public Version)
Graphics Processor: ATI/AMD with Vulkan Support

Return to Script Library

Who is online

Users browsing this forum: No registered users and 0 guests