OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: BRAVO-TWO on 03 Jan 2006, 21:40:37

Title: arggh
Post 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
Title: Re:arggh
Post by: Lean Bear on 03 Jan 2006, 22:25:51
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.
Title: Re:arggh
Post by: THobson on 03 Jan 2006, 23:24:12
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.
Title: Re:arggh
Post by: 456820 on 04 Jan 2006, 09:38:35
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
Title: Re:arggh
Post by: BRAVO-TWO on 04 Jan 2006, 20:13:44
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)

Title: Re:arggh
Post by: BRAVO-TWO on 04 Jan 2006, 20:15:27
but thanx in anyway 456820

                              :cheers:nice one :cheers:

Title: Re:arggh
Post by: The-Architect on 04 Jan 2006, 21:39:07
Can't you just use,

Condition: Getdammage Unitname >= 0.1
On Activation: Playsound "Soundfile"

Or better still,

On Activation: Unitname Say "Soundfile"
Title: Re:arggh
Post by: Tyger on 10 Jan 2006, 01:08:36
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.
Title: Re:arggh
Post by: THobson on 10 Jan 2006, 21:29:40
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} ::)
Title: Re:arggh
Post by: Tyger on 10 Jan 2006, 22:32:06
Go figure  ;D