Example #1
0
        public void DoVoice(VoiceCmd cmd, bool shout = false)
        {
            var strm = BaseInst.GetScriptVobStream();

            strm.Write((byte)(shout ? ScriptVobMessageIDs.VoiceShout : ScriptVobMessageIDs.Voice));
            strm.Write((byte)cmd);
            BaseInst.SendScriptVobStream(strm);
        }
Example #2
0
        public void Voice(NPCInst npc, VoiceCmd cmd)
        {
            var stream = npc.BaseInst.GetScriptCommandStream();

            stream.Write((byte)RequestMessageIDs.Voice);
            stream.Write((byte)cmd);
            NPC.SendScriptCommand(stream, NetPriority.Low);
        }
Example #3
0
        public void DoVoice(VoiceCmd cmd, float range = 3000, float volume = 0.7f)
        {
            if (this.CustomVoice <= 0)
            {
                return;
            }

            string str = string.Format("SVM_{0}_{1}.WAV", (int)this.CustomVoice, cmd);

            if (!cachedVoices.TryGetValue(str, out SoundDefinition scream))
            {
                scream = new SoundDefinition(str);
                cachedVoices.Add(str, scream);
            }
            SoundHandler.PlaySound3D(scream, this.BaseInst, range, volume);
        }
Example #4
0
        public void TryVoice(VoiceCmd cmd)
        {
            if (Host.IsDead || Host.CustomVoice == 0)
            {
                return;
            }

            bool shout;

            switch (cmd)
            {
            case VoiceCmd.HELP:
                shout = true;
                break;

            default:
                shout = false;
                break;
            }

            this.Host.DoVoice(cmd, shout);
        }