Home   Help Search Login Register  

Author Topic: Speach in the Action Menu  (Read 652 times)

0 Members and 1 Guest are viewing this topic.

Jenkins

  • Guest
Speach in the Action Menu
« on: 12 Sep 2004, 06:38:53 »
Hey,

I'm trying to get it on my mission so you can say something (from a sound file) when you use it out of the action menu. I've converted all the sounds and stuff needed, and trying to do "this addaction ["Test Speach", playsound "Speach1"];" doesn't work. Any help, thanks.

Gooner861

  • Guest
Re:Speach in the Action Menu
« Reply #1 on: 12 Sep 2004, 12:13:31 »
Hi there,

Dnt an expert in this but maybe u need to put the file type at the end of speech1, so instead of:

Quote
["Test Speach", playsound "Speach1"];"

U put:

Quote
["Test Speach", playsound "Speach1.wav"];"

Dunno just an idea  ;D

Gooner

PsyWarrior

  • Guest
Re:Speach in the Action Menu
« Reply #2 on: 12 Sep 2004, 14:25:37 »
Greetings,

I'm afraid that's not it, gooner...

The problem is, in fact, the addAction command. BIS, in their infinite wisdom, made the addAction command in such a way that you can only do one thing with it: execute scripts.
So:
player addAction ["Speak", "TestSpeech.sqs"]
would execute a script called TestSpeech.sqs. The command
this addaction ["Test Speach", playsound "Speach1"]
would try to execute a script called "playsound "speach1"". It can't do that, so it would return an error. The solution is simple, but annoying (since you have to write a script that does virtually nothing):

Put:
this addAction ["Test Speech", "TestSpeech.sqs"]
in place of your first addAction command. Then open up Notepad, and type/ copy this:

===============================

: ***************
; TestSpeech.sqs
; ***************

playSound "Speach1"

exit

===============================

The first three lines are just comments, and are optional.

Go to File > Save. In the 'Save' dialogue, under 'Save As Type', select 'All Files (*.*)'. Navigate to the Codemasters\OperationFlashpoint\Users\[YourName]\[MissionName] directory. Call the file "TestSpeech.sqs" - make sure you put the .sqs extention on.

That's it. Now, when you preview the mission, and select the "Test Speech" action, the script will execute, play the sound, and quit.

The upshot of this: You need a seperate script for every single action you use...  ::)

Reference:
OFPEC Commented Command Reference (COMREF):
http://www.ofpec.com/editors/comref.php?letter=A#addAction

-Supr. Cmdr. PsyWarrior
-Psychic Productions
« Last Edit: 12 Sep 2004, 14:29:12 by PsyWarrior »

Gooner861

  • Guest
Re:Speach in the Action Menu
« Reply #3 on: 12 Sep 2004, 14:28:22 »
 :'(

PsyWarrior

  • Guest
Re:Speach in the Action Menu
« Reply #4 on: 12 Sep 2004, 14:34:31 »
 :)
Sorry, gooner...

It isn't exactly helpful though that BIS missed out this 'small' detail about the action command from the COMREF... ::)

-PsyWarrior

Jenkins

  • Guest
Re:Speach in the Action Menu
« Reply #5 on: 12 Sep 2004, 22:12:42 »
Thanks guys, I got it to work, but I had wanted it so when I hit the action, his mouth moves. I already have a .lip converted too. Thanks again.

PsyWarrior

  • Guest
Re:Speach in the Action Menu
« Reply #6 on: 13 Sep 2004, 18:02:52 »
Greets,

Was that a question?

If so: You need to use the say command, rather than the playSound command. Playsound, you may notice, doesn't identify who is speaking, it just plays the sound from thin air (so who would it lipsync to?).

So, replace the playSound command with:
unitName say "speach1"

Look in the COMREF to see the two varients of the say command.

Also ensure that the .lip file is in the same directory as the sound, and has the same name as the sound (with the exception of the file extentions).

-PsyWarrior