How to require sound downloading.

Author Topic: How to require sound downloading.  (Read 523 times)

You could do the same thing with textures (I assume) with <bitmap> and a center print, if anyone wants to have a go at that.
Music can be done in a similar fashion.

If you use this, please change the filename and datablock name.

I decided against posting this in the Addons forum as this does require modification to achieve its purpose. Think of it as a library.

Code: [Select]
$ServerSoundRequirementMsg = "I have heard this audio clip.";

function normalizeString(%str) {
return strLwr(stripChars(%str, "!@#$%^&*()_+-=[]{}\\|;':\",./<>?”“–"));
}

datablock AudioProfile(UniqueSound6iJu4)
{
filename = "./unique_sound_6iJu4.wav";
description = AudioClosest3d;
preload = true;
};

function GameConnection::loopSoundRequirementMessage(%this) {
cancel(%this.LSRMSched);
if(!%this.hasDownloadedSounds) {
%this.LSRMSched = %this.schedule(6000, loopSoundRequirementMessage);
}

%this.play2D(UniqueSound6iJu4);
}

package requireSoundsPackage {
function GameConnection::spawnPlayer(%this) {
if(!%this.hasDownloadedSounds) {
%this.loopSoundRequirementMessage();
return;
}

return parent::spawnPlayer(%this);
}

function serverCmdMessageSent(%this, %msg) {
if(!%this.hasDownloadedSounds) {
%normalized["req"] = normalizeString($ServerSoundRequirementMsg);
%normalized["msg"] = normalizeString(%msg);

if(%normalized["req"] $= %normalized["msg"]) {
%this.hasDownloadedSounds = 1;
%this.spawnPlayer();
cancel(%this.LSRMSched);
return;
}
}
return parent::serverCmdMessageSent(%this, %msg);
}
};
activatePackage(requireSoundsPackage);

https://www.youtube.com/watch?v=vMdq1o-AkkY&t=0m27s
https://www.dropbox.com/s/g2coa2ldffecpcy/Server_RequireSounds.zip?dl=1

I can add more onto it if need be, this is moreso a proof of concept.

So what's stopping people from telling others what to say? I can't see this working.

So what's stopping people from telling others what to say? I can't see this working.
if it's something absolutely requiring sound, and someone is clearly showing signs of not downloading
A) they'll always be with a disadvantage
B) they'll be oblivious to events that might require sound
C) in-game experience will be bad
D) they'll be kicked/banned by admins until they get the message if it's hindering a game

so really it's their loss if they can't type a simple message

I don't usually have audio enabled at all when I play, so when I eventually encounter a server using this I'm just going to assume my download/load is getting stuck and keep rejoining lol

yeah i'm just going to lock it never mind