Author Topic: Need help with adding sounds to an AI bot  (Read 861 times)

I need to edit the Mutalid's script to add sounds to it like the zombie tank.  It is for a special project I am working on, which I am not going to reveal yet.

Anyways, I look at the tank's script and look at other scripts within the mod, but I just couldn't figure it out.
I am fine with doing it myself, but will need a little help. If one of you want me to give you the sounds so you can do it yourself and PM the link to me when you are done that would be great too.

Off-topic

I also might need someone to host a server when the time comes, as my server has ping problems...I think.

Are you kidding me!
120+ views and not 1 comment!

EDIT:
Why do I have to be a noob, why can't I just be smart so I don't have to make these topics!
« Last Edit: July 16, 2011, 01:34:51 AM by ThElement »

I need to edit the Mutalid's script to add sounds to it like the zombie tank.  It is for a special project I am working on, which I am not going to reveal yet.

Anyways, I look at the tank's script and look at other scripts within the mod, but I just couldn't figure it out.
I am fine with doing it myself, but will need a little help. If one of you want me to give you the sounds so you can do it yourself and PM the link to me when you are done that would be great too.

Off-topic

I also might need someone to host a server when the time comes, as my server has ping problems...I think.
First of all, you'll need to define an audio datablock, unless what you're using already exists in another script.
Code: [Select]
datablock AudioProfile(SoundName1) //what do you want to name the audio?
{
   filename    = "./MutalidSoundFile.wav"; //what is the directory/name?
   description = AudioClose3d; //Most likely, you won't need to change this
   preload = true; //Do you want players to download it if they download sounds?
};
Then, you tell the code when to play it:
Code: [Select]
function MutalidAI::OnDamage(%this, %obj) //this function is called when the mutalid is damaged.
{
    serverPlay3D(SoundName1, %obj.getPosition());
}
now, serverPlay3D(SoundName1, %obj.getPosition()); is basically this, when explained:
Code: [Select]
serverPlay3D //tell the server to play a 3D sound--
SoundName1  //the audioprofile name you chose--
%obj.getPosition() //%obj is the mutalid that calls the function.
//%obj.getPosition() tells the console to get the position of the mutalid
So, that function basically tells the server to play a sound when the mutalid is damaged, from the mutalid's location.

First of all, you'll need to define an audio datablock, unless what you're using already exists in another script.
Code: [Select]
datablock AudioProfile(SoundName1) //what do you want to name the audio?
{
   filename    = "./MutalidSoundFile.wav"; //what is the directory/name?
   description = AudioClose3d; //Most likely, you won't need to change this
   preload = true; //Do you want players to download it if they download sounds?
};
Then, you tell the code when to play it:
Code: [Select]
function MutalidAI::OnDamage(%this, %obj) //this function is called when the mutalid is damaged.
{
    serverPlay3D(SoundName1, %obj.getPosition());
}
now, serverPlay3D(SoundName1, %obj.getPosition()); is basically this, when explained:
Code: [Select]
serverPlay3D //tell the server to play a 3D sound--
SoundName1  //the audioprofile name you chose--
%obj.getPosition() //%obj is the mutalid that calls the function.
//%obj.getPosition() tells the console to get the position of the mutalid
So, that function basically tells the server to play a sound when the mutalid is damaged, from the mutalid's location.

Wow, thanks!
I will try this, but I may have to ask some questions.