Home   Help Search Login Register  

Author Topic: Attaching sound to vehicle- ie propaganda van  (Read 1935 times)

0 Members and 3 Guests are viewing this topic.

rOk

  • Guest
Attaching sound to vehicle- ie propaganda van
« on: 15 Jul 2004, 13:46:29 »
Well , is it possible through scripting?

It would have to be dynamic ie move with the vehicle.

Offline h-

  • OFPEC Site
  • Administrator
  • *****
  • Formerly HateR_Kint
    • OFPEC
Re:Attaching sound to vehicle- ie propaganda van
« Reply #1 on: 15 Jul 2004, 14:48:22 »
Make an sqs loop with
vehicleName say "soundName"

(A harsh template)
#loop
myvehl say "mysound"
~2
? alive myvehl: goto "loop"
exit

And as always, no guarantees... ::)
« Last Edit: 15 Jul 2004, 14:50:41 by HateR_Kint »
Project MCAR   ---   Northern Fronts   ---   Emitter 3Ditor
INFORMATIVE THREAD TITLES PLEASE. "PLEASE HELP" IS NOT ONE..
Chuck Norris can divide by zero.

rOk

  • Guest
Re:Attaching sound to vehicle- ie propaganda van
« Reply #2 on: 15 Jul 2004, 14:49:37 »
And then the regular this exec "xxx.sqs" in init field?

Offline h-

  • OFPEC Site
  • Administrator
  • *****
  • Formerly HateR_Kint
    • OFPEC
Re:Attaching sound to vehicle- ie propaganda van
« Reply #3 on: 15 Jul 2004, 14:56:38 »
Well that depends how you want to do it...

if you want only that one vehicle to have that sound, then you just execute the script from the vehicles init (for example) with:
[] exec "xxx.sqs"


If you want to have multiple vehicles using that same sound, it's better to make one script that can be used on all of them, then you execute it with:
[this] exec "xxx.sqs"

and change the script to:

_veh= _this select 0

#loop
_veh say "mysound"
~2
? alive _veh: goto "loop"
exit

OR (just to confuse ::) )

with:
this exec "xxx.sqs"

and change the script to:

#loop
_this say "mysound"
~2
? alive _this: goto "loop"
exit
Project MCAR   ---   Northern Fronts   ---   Emitter 3Ditor
INFORMATIVE THREAD TITLES PLEASE. "PLEASE HELP" IS NOT ONE..
Chuck Norris can divide by zero.

rOk

  • Guest
Re:Attaching sound to vehicle- ie propaganda van
« Reply #4 on: 15 Jul 2004, 15:20:02 »
Thx, and double thx i've been pondering the difference between [] and [this] for quite some time now.

Would the 3rd example go with a single vehicle-i like it the most-keepin' it simple
______________________________________________________________

Just a little test:

[bmp1,bmp2] exec "xxx.sqs"

Is this correct? + your 2nd example of script

Offline h-

  • OFPEC Site
  • Administrator
  • *****
  • Formerly HateR_Kint
    • OFPEC
Re:Attaching sound to vehicle- ie propaganda van
« Reply #5 on: 15 Jul 2004, 15:29:56 »
Quote
Is this correct? + your 2nd example of script
nope...
You still need to put it in each vehicles init separately (or in the init.sqs, or in a trigger etc...):
[bmp1] exec "xxx.sqs"
[bmp2] exec "xxx.sqs"

and so on...
But this method requires only one of those scripts...
(If you used the first method you would need a different script for each vehicle...)

If you'd like to execute the script with all the vehicles passed in at once (array of the vehicles), it would require a bit more developed script...

Quote
Would the 3rd example go with a single vehicle-i like it the most-keepin' it simple
Oh, almost missed this...
Yes, you can use that with only one vehicle too...
« Last Edit: 15 Jul 2004, 15:31:36 by HateR_Kint »
Project MCAR   ---   Northern Fronts   ---   Emitter 3Ditor
INFORMATIVE THREAD TITLES PLEASE. "PLEASE HELP" IS NOT ONE..
Chuck Norris can divide by zero.

rOk

  • Guest
Re:Attaching sound to vehicle- ie propaganda van
« Reply #6 on: 15 Jul 2004, 15:34:01 »
Actually just need one, but I was curious.
And I meant that my idea ([bmp1,bmp2] exec "xxx.sqs") be written down in init.sqs, just forgot to wrote it I guess.
Would it still be incorrect this way?

One thing though, I'll probably have to turn the volume up, that would go behind "mysoundname", right?
« Last Edit: 15 Jul 2004, 15:36:00 by rOk »

Offline h-

  • OFPEC Site
  • Administrator
  • *****
  • Formerly HateR_Kint
    • OFPEC
Re:Attaching sound to vehicle- ie propaganda van
« Reply #7 on: 15 Jul 2004, 15:48:53 »
Quote
Would it still be incorrect this way?
Yes it would...

the bmp1 would be called in the script with _this select 0 and the bmp2 would be called with _this select 1 and so on...

Quote
One thing though, I'll probably have to turn the volume up, that would go behind "mysoundname", right?
???

if you use say "soundname" you can't add anything more to it. It just says the sound defined in the description.ext (or if you use those already ingame you don't need to define it in the description.ext, just to find it's name...).
In the description.ext you can define the default volume for the sound...
(Tutorials at Ed Depot...)

The thing comref referes to when using the other way of say is that you can use say ["soundname",theDistanceHowFarAwayFromTheSpeakerTheSubtitlesWillShow] ...
Project MCAR   ---   Northern Fronts   ---   Emitter 3Ditor
INFORMATIVE THREAD TITLES PLEASE. "PLEASE HELP" IS NOT ONE..
Chuck Norris can divide by zero.

rOk

  • Guest
Re:Attaching sound to vehicle- ie propaganda van
« Reply #8 on: 15 Jul 2004, 16:23:30 »
Doh, silly me! :P

will keep you posted of results
Thanks again
« Last Edit: 15 Jul 2004, 16:24:21 by rOk »

rOk

  • Guest
Re:Attaching sound to vehicle- ie propaganda van
« Reply #9 on: 15 Jul 2004, 18:26:40 »
OK results are

from the third example

Code: [Select]
_this say "mysound"
~2
? alive _this: goto "loop"

_this in upper code returns an "type array, expect object" error;
had to replace _this with the actual name of the unit

And the dynamics isn't really there or is extremely shallow. btw I think there is some dynamic range sound update;
i don't have, you think this might be the problem?

Offline h-

  • OFPEC Site
  • Administrator
  • *****
  • Formerly HateR_Kint
    • OFPEC
Re:Attaching sound to vehicle- ie propaganda van
« Reply #10 on: 15 Jul 2004, 21:10:10 »
Quote
from the third example
If you executed the third example exactly like I told you, there should be no probs...
For example BIS camera.sqs works that way...

Just vehicle exec "xxx.sqs"... Not [vehicle] ...

Dunno if it's the say command that doesn't like that syntax...

Quote
And the dynamics isn't really there or is extremely shallow.
I think this is just OFP sound engine problem...
And I doubt that Dynamic Range sound AddOn helps...
Project MCAR   ---   Northern Fronts   ---   Emitter 3Ditor
INFORMATIVE THREAD TITLES PLEASE. "PLEASE HELP" IS NOT ONE..
Chuck Norris can divide by zero.

rOk

  • Guest
Re:Attaching sound to vehicle- ie propaganda van
« Reply #11 on: 15 Jul 2004, 21:29:01 »
LOL

I did [] exec "xxx.sqs" in init field of Bradley

and this is xxx.sqs

Code: [Select]
#loop
dude say "start"
~60
? alive dude: goto "loop"
exit


will try it all later on a comp with a better sound card, but I too think it's something with Flashpoint, although I will try the range update too 'cos I remember seeing it that it adresses this issue for engine noise.

ponq

  • Guest
Re:Attaching sound to vehicle- ie propaganda van
« Reply #12 on: 16 Jul 2004, 12:23:20 »
From reply #9:
Quote
_this in upper code returns an "type array, expect object" error;
had to replace _this with the actual name of the unit

Read the error msg carefully. If often says exactly what's wrong (and often not...lol).

Ofp gets an "array" from you while it expects an "object".
anything between brackets [this eg] is an array, where "this" is an object (or the name of the vehicle. dude).

With _Dude1 = _this select 0, you get the first object out of the array. _dude2 = _this select 1, would get the 2nd and so on, as HateR_Kint said.

Now back to the error msg. It tells you that you sent an array (like in [this] exec "xxx.sqs") but the way the script is written ofp wants an object (this exec "xxx.sqs" or bmp1 exec "xxx.sqs").

Because the first this is between bracketes ([this]) it's an array, and you have to tell ofp the get something out of that array first (_this select 0 eg).

Hope this adds some ;)

__________
Quote
I did [] exec "xxx.sqs" in init field of Bradley

and this is xxx.sqs

Code:
#loop
dude say "start"
~60
? alive dude: goto "loop"
exit

This isn't the best way to script, since you don't use a variable for the name of the unit you want to act in this script, but a unit name. (dude). This means you have to write a new script for each unit you want this script to use (now, if you just want 1 car to be the propaganda van...ok ;) )

To make it more usable use this:
Code: [Select]
_dude = _this
#loop
_dude say "start"
~60
? alive _dude: goto "loop"
exit
where you call the script with "this exec "xxx.sqs" from the units init field.

rOk

  • Guest
Re:Attaching sound to vehicle- ie propaganda van
« Reply #13 on: 16 Jul 2004, 22:27:39 »
Thanks for the explanation ponq!
Just what I needed.

But still one thing bothering me though.
the difference between [] and [this].



« Last Edit: 16 Jul 2004, 22:32:12 by rOk »

ponq

  • Guest
Re:Attaching sound to vehicle- ie propaganda van
« Reply #14 on: 16 Jul 2004, 22:57:58 »
[] is used to execute a script without the need for an object. Eg, you want a script to make the time go faster for a while.

[this] is used to run a script which needs an object.