Page 1 of 1

Specific sounds

Posted: August 8th, 2012, 1:45 am
by zahan
I dont know how to add a sound , for exemple, when a quest is accepted. There is posible?
Let's say that i have a general sound in background. When the actor accept the quest i want to play a quest sound. Something like that!


Note: if there is topics with this subject, i really want the link.

Re: Specific sounds

Posted: August 12th, 2012, 3:53 pm
by chocolatepie33
this is a coding thing, I don't know what mode you're using (and if it's RPG, I don't know RPG scripting), but here's some pseudocode based on fps cubescript:

Code: Select all

level_trigger_1 = [showgui person]
newgui person [
guitext "hi, what's up?"
guibar
guibutton "not much" [showgui person2]
guibutton "(say nothing)" [cleargui]
]
newgui person2 [
guitext "I need you to go on a quest."
guibar
guibutton "yes." [sound code plays; showgui person3]
guibutton "no" [cleargui]
like said, I don't know the specific code to play the sound, but I believe you can have the sound play if you have it activated after selecting a guioption that way.

Re: Specific sounds

Posted: August 12th, 2012, 7:59 pm
by Lou
Hi,
I looked in the rpgscript.cpp file and found this reference.

Code: Select all

ICOMMAND(r_sound, "ss", (const char *p, const char *r),
		if(*r)
		{
			getreference(r, ent, ent->getent(entidx), , r_sound)
			playsoundname(p, &ent->getent(entidx)->o);
		}
		else
			playsoundname(p);
	)
So maybe there is a r_sound() function you can call in the script and pass it the sound file?
I could not find any tutorials or references as to how to get this to work so you will have to play with it and
see if it works.

Re: Specific sounds

Posted: August 12th, 2012, 8:10 pm
by Lou
It works but not as expected. Here is what I coded up.

Code: Select all

// Lou NPC script
include scripts/1

//start conversation
r_script_node "main" [result "[Move along and stay out of trouble.]"] [
     r_response "Will do." normal //goes to dialogue normal
	 r_sound "/aard/bang"
	 r_response "Goodbye" "" //closes the dialogue
 ]

//normal path
 r_script_node "normal" [result "[Have a nice day.]" ] [ 
   r_response "Goodbye" ""
 ]
The issues are that the file needs to be a wave type and also the sound plays as soon as the the text branch is entered regardless
of how you respond. So it is firing at a higher level than the conversation code it running. Maybe it would be better to set a variable
when you enter the correct text path and then let that trigger the sound to play. It is just a thought.
Regards,
Lou

Re: Specific sounds

Posted: August 19th, 2012, 2:18 am
by zahan
I'm still working on sounds. thank's for help.

Re: Specific sounds

Posted: August 20th, 2012, 11:01 am
by kddekadenz
Lou wrote: The issues are that the file needs to be a wave type
Actually not. PAS supports mp3 and ogg, too. 2.8 does add FLAC support.
Lou wrote: and also the sound plays as soon as the the text branch is entered regardless
of how you respond.
Then put the command into the respond :P