OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: rOk on 15 Jul 2004, 13:46:29
-
Well , is it possible through scripting?
It would have to be dynamic ie move with the vehicle.
-
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... ::)
-
And then the regular this exec "xxx.sqs" in init field?
-
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
-
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
-
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...
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...
-
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?
-
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...
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] ...
-
Doh, silly me! :P
will keep you posted of results
Thanks again
-
OK results are
from the third example
_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?
-
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...
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...
-
LOL
I did [] exec "xxx.sqs" in init field of Bradley
and this is xxx.sqs
#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.
-
From reply #9:
_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 ;)
__________
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:
_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.
-
Thanks for the explanation ponq!
Just what I needed.
But still one thing bothering me though.
the difference between [] and [this].
-
[] 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.
-
At the risk of confusing stuff more..
Whats the difference between this exec "script.sqs" and [this] exec "script.sqs"
::)
- Ben
-
At the risk of confusing stuff more..
Whats the difference between this exec "script.sqs" and [this] exec "script.sqs"
::)
- Ben
this is the object,[this] is an array containing the object...
this is a reserved variable in OFP that points to the object/unit/whatever in which init field it is...
[this] is an array containing that object/unit/whatever...
-
Ah, ta..
So you use [this] if you need more variables etc (Like [this,you,me] exec "blah")?
Thanks!
- Ben
-
Yup...