OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: BRAVO-TWO on 03 Jan 2006, 21:40:37
-
one more thing
trying to guarentee that if certain named russian unit is hit he will cry out (arggg) and a trigger can be fired by this..
have looked at the hit kill sqs in editors depot ..(usefull but not what i need)
i guess an event handler is the answer
unitname AddEventHandler ["hit",{_this exec "hit.sqs"}]
but what would i enter in my hit.sqs to force the unit to cry out..
thanx guys
shark attack
-
unitname say "soundfilename"
Perhaps?
I'm pretty sure BIS already has some "screaming in agony" sounds that you could find the name for. Then replace "soundfilename" with the BIS (or your own) "arrgghh" sound.
-
You don't need to make the event handler run a script. It can action the code directly:
unitname addEventHandler [{hit},(_this select 0) say "soundclassname"]
Be aware though if the hit kills him he won't say anything - dead units don't talk. :)
If you do want him to say something even when dead create a game logic at his location and get it to say the sound. That can still all be done without needing to call a script.
-
check out my killed and hit scripts its pretty much what you wanted apart from the sounds dont say "ARRRGGG" only "MEDIC" or "IM HIT" etc etc
here you go (http://www.ofpec.com/editors/resource_view.php?id=841)
You can edit the scripts to play sound files and change the text but give credits to the rest of the script as mine
-
re...
check out my killed and hit scripts its pretty much what you wanted apart from the sounds dont say "ARRRGGG" only "MEDIC" or "IM HIT" etc etc
my post
trying to guarentee that if certain named russian unit is hit he will cry out (arggg) and a trigger can be fired by this..
have looked at the hit kill sqs in editors depot ..(usefull but not what i need)
-
but thanx in anyway 456820
:cheers:nice one :cheers:
-
Can't you just use,
Condition: Getdammage Unitname >= 0.1
On Activation: Playsound "Soundfile"
Or better still,
On Activation: Unitname Say "Soundfile"
-
Many triggers cause a lot of lag. I would suggest using eventHandlers because they decrease lag by the Terabyte ( ;D).
@THobson
Does that format work for eventHandlers? I always use addEventHandler ["hit",{(_this select 0) say "ivebeenshot.ogg"}]. But I'm no expert.
-
Neither am I . . . clearly. I should have said:
unitname addEventHandler [{hit},{(_this select 0) say "soundclassname"}]
I missed the {} after the comma. I know in many cases {...} and "..." are equvalent, but not always. Rather than try and remember I always use {...} for a block of code and "..." for a string.
Except of course I break my own rule in an eventhandler where I use {hit} ::)
-
Go figure ;D