Home   Help Search Login Register  

Author Topic: Calling sound with eventhandler  (Read 1227 times)

0 Members and 1 Guest are viewing this topic.

pazuzu

  • Guest
Calling sound with eventhandler
« on: 01 Aug 2005, 06:26:26 »
Not sure if this is the right place for this question, but here it goes...

Can I use an addeventhandler to call a sound file as defined in discription.ext?

Like using a "killed" eventhandler that calls "soldierOne say "sound1""

Or do they only call sqs files?

I read one tut for eventhandlers and didn't see anything for calling sounds or music but I thought I'd ask anyway.

Thanks.

Offline bedges

  • Administrator
  • *****
    • OFPEC The Editing Center
Re:Calling sound with eventhandler
« Reply #1 on: 01 Aug 2005, 06:57:48 »
you're right that event handlers call scripts, but it's a simple thing to write a script with a playsound command in it and little else ;)

Offline Killswitch

  • Members
  • *
  • Peace, cheese and ArmA
Re:Calling sound with eventhandler
« Reply #2 on: 01 Aug 2005, 07:25:36 »
Not sure if this is the right place for this question, but here it goes...

Can I use an addeventhandler to call a sound file as defined in discription.ext?
Yes.
Quote
Like using a "killed" eventhandler that calls "soldierOne say "sound1""
Example:
Code: [Select]
soldierOne addEventHandler ["killed",{(_this select 0) say "sound1"}]
Quote
Or do they only call sqs files?
No. See snippet above. Event handlers don't "call sqs files". Event handlers are script strings. In the example above, the string is
Code: [Select]
{(_this select 0) say "sound1"}
EDIT:Naturally, because the killed event handler is called when the guy is dead, he might not be able to say anything...  :-X
« Last Edit: 05 Aug 2005, 17:37:42 by Killswitch »

Offline 456820

  • Contributing Member
  • **
Re:Calling sound with eventhandler
« Reply #3 on: 01 Aug 2005, 08:26:52 »
_this select 0 is the person who is dead i think
and therefore your telling the dead unit to say something wich wont work so it should be
Code: [Select]
unit addEventHandler ["killed",{(soldier_name) say "sound1"}]
also event handlers can call .sqs files but they dont have to you can do it like above

hope that helps

pazuzu

  • Guest
Re:Calling sound with eventhandler
« Reply #4 on: 01 Aug 2005, 19:23:07 »
Thanks guys,  I'll test those suggestions out...

I'm making a mission using the Amazon pack. I've made the Amazon women the enemy & I've downloaded a few "female scream" sounds. I want some of the amazons to scream when they get shot so I thought using addeventhandlers might be best but I've never used them before.

I guess it would make more sense to have them scream when they get wounded since dead people don't generally scream.

What would the syntax be for eventhandler and unit dammaged?

Hmm, I couldn't get those to work using "say sound1". But I got it to work using a script. Only problem is the sound doesn't sound like its coming from the unit killed. I want it to appear to be coming from the dying unit.

I'll keep testing.

Thanks again.
« Last Edit: 01 Aug 2005, 20:05:36 by pazuzu »

Offline 456820

  • Contributing Member
  • **
Re:Calling sound with eventhandler
« Reply #5 on: 01 Aug 2005, 21:06:31 »
use the eventhandler hit
like this
Code: [Select]
unit addEventHandler ["hit",{(soldier_name) say "sound1"}]
theres a tut in the ed depot on eh very usefull
(sorry havent got a link)

pazuzu

  • Guest
Re:Calling sound with eventhandler
« Reply #6 on: 01 Aug 2005, 21:57:19 »
Its not working...

I've already read the tut your talking about but it doesn't give an example using the say command to call the sound.

Maybe I should just use triggers to detect dammage & then use "say "sound1"' in activation field. Thats the only way I can get it to work.

Thanks again.

Offline 456820

  • Contributing Member
  • **
Re:Calling sound with eventhandler
« Reply #7 on: 02 Aug 2005, 08:19:18 »
well put what i said above make sure the names are right eg
name a soldier
unit and then in his init field put
Code: [Select]
unit addEventHandler ["hit",{(_this select 0) say "sound1"}]make sure you have defined the sound in the description.ext and also make sure its names right in the above code
then play shoot the soldier named unit dont kill him just shoot him in the knees and he should say "sound1"