Voiceup Powerups

Post your example zscripts/ACS scripts/etc here.
Forum rules
The Projects forums are only for projects. If you are asking questions about a project, either find that project's thread, or start a thread in the General section instead.

Got a cool project idea but nothing else? Put it in the project ideas thread instead!

Projects for any Doom-based engine (especially 3DGE) are perfectly acceptable here too.

Please read the full rules for more details.
Hey Doomer
Posts: 283
Joined: Sat Sep 25, 2021 3:38 am

Voiceup Powerups

Post by Hey Doomer »

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 all

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 all

	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.

Return to “Script Library”