OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: O Neil on 08 Jun 2004, 04:02:37
-
Hey
How would I get a sound file to play when a tank or vehicle starts up ?
(O'Neil
-
Well, you could replace the original sounds with the new one. But that's a bit excesive if it's just for a mission. I suppose you could detect if the vehicle was moving and then play the sound. Just a idea, and probably not the best way to do it :P
-
check the latest version of the ComRef. I think in 1.90 or something some commands like ifengine or engineon were introduced.
:beat: *Gets Shot* :beat:
EDIT: Can't find it but I know I've used it. :-\
-
Yeeeeeeh! Found it. Wasn't in the ComRef. WTF?
isengineon
Returns true or false I belive.
:beat: *Gets Shot* :beat:
-
Hey
Soz, not into scripting very well, wtf do I do with it ? ;)
(O'Neil
-
not into scripting very well
Scripted Cut-Scene scripter
???
Dilemma... ??
;D
I think you can use this even in a trigger:
cond.: isEngineOn
on Act.: vehicleName say "soundName"
Or then in a script like:
@isEngineOn
vehicleName say "sound"
or the same with a loop (well, sort of..)...
#lyyp
? isEngineOn: goto "playSound"
~.5
goto "lyyp"
#playSound
vehicleName say "soundName"
And for the record, no guarantees on anything I say... :P
-
I'm not at home now so I ain't sure but I can check the script later. However, I think it was something like:
? !(isengineon _whatever) : tjommitjommitjommi
This checks if engine is off on the vehicle _whatever, thus the !, which I think you know means Not.
So if you want to wait untill vehicle has his engine on and then, say, put a hint in you do this:
@ (isengineon _whatever) : hint format ["%1 just put his engine on!", _whatever]
Happy cutscening (like your cutscene page btw)
:beat: *Gets Shot* :beat:
-
That will loop the script (which might cause lag), so I'd rather go for eventhandlers - to get rid of the looping.
Something like this would be it (not sure if this is correct though):
unitName addEventHandler ["Engine",if (_this select 1) then {[_this select 0] exec "yourscript.sqs"}]
and in yourscript.sqs:
unitName say "soundName"
-
Using an @ won't make the script to loop.
:beat: *Gets Shot* :beat:
-
so I'd rather go for eventhandlers
Right..
Totally forgot that there was that EH too...
That would be the way to go...
Using an @ won't make the script to loop.
Well, it sort of does as it stops the script there and checks in every frame if the condition is met, so it kinda loops the 'question'... ::)
-
Using an @ won't make the script to loop.
It sure does mate ;)
Can't remember the exact number, but something tells me it looped back to check every 0.5 second ;)
-
0.5 seconds correct (just like a trigger) . The reason I said the previous was that I thought he mixed it with the questionmark (?) which you will have to loop if you want to check it again. :)
:beat: *Gets Shot* :beat:
-
Hey
Lol, caught be out Hater_kint. Cut-Scene scripting is all I can do, trust me, I'm no good at ANYTHING else.
Anys, thxs for all your help guys, be trying it out soon ;)
(O'Neil