PDA

View Full Version : A way to play a custom sound during a specific state?


Envid
October 19th, 2004, 10:38 PM
Just wondering If i could play a custom sound during a specific state or even a frame number from a model.

DaniJ
October 20th, 2004, 01:21 AM
From a state it's possible. Use Execute to call the console cmd playsound, then within a DED define the new sound you want to play, then include the DED and sound in a pk3 :)

Envid
October 20th, 2004, 06:09 PM
i dont see in the DED reference file about the execute command and how i would utilize it...
I already set the sound definition in the DED file for it's ID but evidently it doesnt work unless i substitute it with a different lump/id

Custom Sound DED file

Sound {
ID = "PISTOLRELOAD";
Lump = "PISGR";
Link pitch = -1;
Link volume = -1;
Priority = 78;
Max channels = 1;
File = "data/jdoom/NP/models/pers/pistol/pistol-reload.wav"
}

i used the command playsound pistolreload but nothing came up

Also an example on how to utilize the execute command within the pistolup stage.

As u can see setting my pistol model to lock a clip in as the pistolup stage.

Vermil
October 21st, 2004, 02:01 AM
With sounds in deds, Dday considers capitals and lower case as different characters. For instance if the ID of the sound is "PISTOLRELOAD" you also have to enter it in capitals in other deds.

Though I've never tested it with the playsound console command it may be the same.

Envid
October 21st, 2004, 02:51 AM
awesome vermil that was the problem....

Now to figure out how to use the execute command for playing a sound during a state or model frame.

Vermil
October 21st, 2004, 03:14 AM
Here's an example of how to use the execute command in a state. You can run any console command with execute.

State {
ID = "ANG_DIE1";
Sprite = "ANGE";
Frame = 32768;
Tics = 60;
Execute = "playsound angdth";
Next state = "ANG_DIE2";
}

Though I can't get the execute command to work for map definitions at the moment. Does anyone know the map def's equivalent?

Envid
October 21st, 2004, 03:22 AM
State
{
ID = "PISTOLUP"
Sprite = "PISG"
Frame = 0
Tics = 30
Action = "A_Raise"
Execute = "playsound PISTOLRELOAD";
Next state = "PISTOL"
}

yet if i type
playsound PISTOLRELOAD
in the command console it works....

Vermil
October 21st, 2004, 03:32 AM
I believe state and map execute functions only work in the main objects.ded and maps.ded.

When it was first introduced state execute commands didn't have to be (though map execute functions have always had to be), but at some point since this was accidentally removed, though Skyjake said he would put it back at some point.

Envid
October 21st, 2004, 03:38 AM
objects.ded doesnt help if i tell it to execute from there....

Vermil
October 21st, 2004, 03:42 AM
Hmmm that's strange. Have you tried it on a non weapon state, since weapons are handled differently to other things or reducing the sound ID to 8 chars or lowercase?

Envid
October 21st, 2004, 03:44 AM
the point is to have a sound like a clip popping in to the pistol when it loads instead of it being silent..... i have no need for a non-weapon state atm

Vermil
October 21st, 2004, 03:56 AM
What I meant was that the execute command may not work on weapon states because weapons are handled differently to other things.

Indeed, I've just tried an execute playsound command on a weapon state and unfortunately it doesn't seem to work. Though it works fine on non weapon states.

Hence the only way I can think of to attach a sound to a weapon state is to use one of the shotgun reload sound actions.

Envid
October 21st, 2004, 04:01 AM
perhaps a way to generate a single particle that generates from the model invisibly and impacts the ground asap and using the sound command?

keep in mind i have NO IDEA about particles themselves just yet as i have been mainly focused on md2 debugging.

Vermil
October 21st, 2004, 04:02 AM
Indeed though a bit of a hack that would work, since you could make it play as soon as the particle appears (i.e. in it's first state). Make the particle microscopic in size and it would for all intents purposes by invisible.

Though can you attach a particle generator to a weapon state? I've never seen it done.

EDIT:
Just tried it and it would appear you can't add a generator to a weapon state :( (unless I'm doing something wrong of course)

Though I don't know about models, so I have no idea whether a generator can be attached to a weapon model.

Envid
October 21st, 2004, 04:27 AM
i tried to add a rocket explosion to a state and it wouldnt appear so i guess ur right.... grrr

DaniJ
October 21st, 2004, 05:48 AM
No you can't attach a generator to a HUD weapon state atm.

Skyjake fixed the thing with the Execute command only working in the objects.ded. It was an oversight in the DED reader a few versions back.

All lump names I think MUST be 8 characters, however you can use an entry in the special lump DD_DIREC to redirect Doomsday to a file from a lump name (this wouldn't be useful in this instance mind).

Sounds can be played the way your after Envid, Abbs pack v3 does exactly that so it might be a good one to disect.

Cheers for the email btw.

Envid
October 21st, 2004, 06:07 AM
ah thanks once again dani. Ill definitley check it out.

your welcome btw