Home   Help Search Login Register  

Author Topic: Need help and insight on a script or triger plz?  (Read 1793 times)

0 Members and 1 Guest are viewing this topic.

Offline Chammy

  • Members
  • *
  • I'm a llama!
Need help and insight on a script or triger plz?
« on: 22 Sep 2005, 08:08:50 »
Well, I'm going to try somehting, and I know someone has to have come up with this but, I cannot find it anywhere. I would like to make a trigger to set off a sound effect when a certain weapon is fired. Or, when a certain unit fires, or Units. the sound I want to set off is just a reverb sound.  I wanted to make a boundarie around a city or forest and create some washy reverb to trigger for either m16 or ak47, grenade, etc. But when player or unit steps out of that area or trigger area that triger becomes null untill that unit steps back into the area and fires his weapon and therefore sets off said sound effect. It has to be possible.    

Or plain and simple, a specified unit fires and he triggers a trigger and sets off a certain sound effect like a burst sound effect. Can anywon here please please help me? Your help is greatly appreciated.

Offline The-Architect

  • Former Staff
  • ****
  • Bite my shiny metal...
    • Bob's Un-official Flashpoint Page
Re:Need help and insight on a script or triger plz?
« Reply #1 on: 22 Sep 2005, 09:51:15 »
You need an eventhandler.

http://www.ofpec.com/editors/resource_view.php?id=543

You can get it to check one of the things, like what was fired, was it burst etc. Then you launch a script which plays your sound.
« Last Edit: 22 Sep 2005, 09:51:43 by The-Architect »
James Andrew Wilkinson 1977 - 2005 R.I.P.
"If it ain't the friggin' incoming it's the friggin' outgoing. Only difference is who gets the friggin' grease, and that ain't no friggin' difference at all."

Offline Chammy

  • Members
  • *
  • I'm a llama!
Re:Need help and insight on a script or triger plz?
« Reply #2 on: 22 Sep 2005, 10:57:25 »
CHecking it out now, thank you...............

Offline Chammy

  • Members
  • *
  • I'm a llama!
Re:Need help and insight on a script or triger plz?
« Reply #3 on: 26 Sep 2005, 05:15:59 »
darn it, i still need to figure out scripts, still hanvet had the chance to read about htme.

Offline Triggerhappy

  • Contributing Member
  • **
  • Llama, it's what's for dinner.
Re:Need help and insight on a script or triger plz?
« Reply #4 on: 27 Sep 2005, 04:05:35 »
well, you could tell us what you need it to do (pretty specifically) and maybe we could throw together a basic script that you can mess with to get the effect you want?

Offline Chammy

  • Members
  • *
  • I'm a llama!
Re:Need help and insight on a script or triger plz?
« Reply #5 on: 27 Sep 2005, 04:21:18 »
Yes.........yes I can...

Ok, here goes *all excitedly*...  

The idea I am after is this:  (1)a. make a trigger area specifically in areas that are Forests areas, and City or Urban area. I'd like for this trigger to set off a sound effect that has been made and set aside in a sound folder in the mission folder. There will be several types of sounds which are just reverb sounds. One of which is similar to AK and one to M16, and maybe grenade etc.  
           b.    Now, when a unit that has an AK is in said area of trigger in forest or city area and FIREs it, the trigger will set off the sound effect of a washy reverb sound. If another unit has an m16 it will set off another reverb sound designated for that m16 or ALL units who have m16's.  M16 = m16 reverb, AK74 = AK74 reverb.  Grenade = grenade reverb.  

           c.   Now when unit steps out of this trigger area ,when the unit fires an ak or m16 the trigger will not set off anything.


  (2)a     Now another idea I am working on is when a certain unit fires an ak, m16 etc, depending on what sound is designated for that particular weapon at that time, I'd like to make the unit trigger off a sound effect,for example, an m16 burst sound or ak burst sound and, AND maybe a delayed reaction to set off another sound in the area of the PLayer or players. Example =  (if possible)     making a unit fire in a specified direction and where the bullets fly by the in game sound of the flying bullets would trigger a sound effect next to the player the enemy unit is firing at.



I hope I explained clearly enough heh........I'm reading the scripting tutorial right now :(

Offline Chammy

  • Members
  • *
  • I'm a llama!
Re:Need help and insight on a script or triger plz?
« Reply #6 on: 18 Oct 2005, 23:07:33 »
I guess noone has ay idea :(,  I am assuming it would be something in the like of the fired script , or the fire_despertion script as mentioned earlier but, instead of for bullet impact and direction areas it would be soley involving certain sound samples being played when a certain weapon is fired and in what area it was.

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:Need help and insight on a script or triger plz?
« Reply #7 on: 19 Oct 2005, 20:32:27 »
Add eventHandlers "fired" to all relevant units.    When the unit fires, the script checks to see if he is in the trigger area.  It might be easier just to check his distance to a central point.  If he is within range, the sound file plays.   If he is not, it doens't.

Obviously the script will check what weapon he has and plays the relevant sounds.

Potentially useful commands:-

distance
list
playsound
hasWeapon
Plenty of reviewed ArmA missions for you to play

Offline Chammy

  • Members
  • *
  • I'm a llama!
Re:Need help and insight on a script or triger plz?
« Reply #8 on: 20 Oct 2005, 03:49:38 »
Thanks majcuba, im chekcing it nwo, been having  atime tryin to lear al this stuff, having one 5 year old ADHD and a 7 month old boy and being a stay at home dad / graveyard shift can put quite the strain when trying to learn anything heh. thankls again.

Offline Chammy

  • Members
  • *
  • I'm a llama!
Re: Need help and insight on a script or triger plz?
« Reply #9 on: 19 Aug 2006, 03:29:17 »
I was wondering , acn triggers and synchs be used other than eventhandlers? Can they be used in place or instead of eventhandlers.?

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re: Need help and insight on a script or triger plz?
« Reply #10 on: 19 Aug 2006, 08:22:17 »
You do have to experiment to learn.  If someone is heavily into building a mission they could just run this off for you.  It is a while since I have built a real mission so all I can do is give you ideas to experiment with.  Macguba had it when he said you would be better not to use a trigger but to check the distance from some specific location.  So do this:
In the mission editor press the show IDs button, find a bush or a tree or something in the middle of the area where you want the fired effect to happen.  Note down its ID number.  Let's say the number is XXYYZZ

Give all units a fired Event Handler.  To do this create a trigger that covers the map and has condition set to true and should be anybody present (note that this is fine for all except civilian units.  See Reply #6 here for an explanation of the complication with civilians:  http://www.ofpec.com/forum/index.php?topic=27814.0).  In the On Activation field put:

{{_x addeventhandler ["fired",{_this exec"UnitFired.sqs"} forEach crew _x} forEach thislist

See this thread also:
http://www.ofpec.com/forum/index.php?topic=27908.0

and this explanation, especially click on the 'here' in the note from General Barron:
http://www.ofpec.com/COMREF/index.php?action=list&letter=a#addEventHandler


The script UnitFired.sqs should look something like:

Code: [Select]
_this select 0 = _unit
_this select 1 = _weapon

if (_unit distance object XXYYZZ > 200) then {exit}
;XXYYZZ id the ID of the object at the centre of the area where the effect should happen
;200 is the radius of the area where the effect should happen

if {_weapon == "m16") then {_unit say "m16sound"}
if {_weapon == "ak74") then {_unit say "ak74sound"}
exit

Where m16sound and ak74 sound are the sounds you have put in your sound folder and defined in your description.ext

You would need to make some changes if you wanted a rectangular area.  See here for dealing with X,Y,Z coordinates:
http://www.ofpec.com/forum/index.php?topic=27979.0

If you wanted an eliptical area then you could either do the maths in the script to work out if the unit is inside the elipse - or you could use an 'Anybody Present'  trigger that is the shape you want it to be.  Give the trigger a name say: trig_elipse1

Then instead of:
Code: [Select]
if (_unit distance object XXYYZZ > 200) then {exit}
;XXYYZZ id the ID of the object at the centre of the area where the effect shoudl happen
;200 is the radius of the area where the effect should happen

Put:
Code: [Select]
if not(_unit in list trig_elipse1) then {exit}
Or some such.  I have tested none of this.  There could be typos etc. but it is a start to help you with experimenting.

Given your domestic situation (I too have significant other commitments) I would ask myself what is my objective: to have a mission built or to build a mission.  For me it is the last one,  it is the building that is fun.  I recommned it as an objective.  Experiment and enjoy.

« Last Edit: 19 Aug 2006, 08:54:34 by THobson »