OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: Chammy on 21 Aug 2005, 00:05:43

Title: looking for the " enemy fired" or "detect enemy or who fired"
Post by: Chammy on 21 Aug 2005, 00:05:43
 wonder if theere is a script that detects who fired, or who fired what, or detect type of weapon fired. something like taht, I cant seem to find it in search option.
Title: Re:looking for the " enemy fired" or "detect enemy or who fired"
Post by: bedges on 21 Aug 2005, 00:13:57
take a gander at this (http://www.ofpec.com/editors/resource_view.php?id=543).
Title: Re:looking for the " enemy fired" or "detect enemy or who fired"
Post by: Chammy on 21 Aug 2005, 00:45:34
Now with these I can have a detect who fired what and have it trigger something, like lets say, a sound sample at the saem time? And if so how would I execute this? thanks bedges. :)
Title: Re:looking for the " enemy fired" or "detect enemy or who fired"
Post by: macguba on 21 Aug 2005, 00:51:32
Usually the immediate consequence of an EH is that a script is called.  The script does whatever you need to do.    You can add the EH to a whole bunch of units and the script called by it checks the circumstances of that particular firing and creates consequences - like sound files - accordingly.   Be careful though, if you add an EH fired to every unit on the map and it launches a long script, you're going to get lag.   EHs themselves cause very little lag, but if you are cavalier with them the consequences can be a severe problem.

What is the underlying situation here?  What are you trying to achieve?
Title: Re:looking for the " enemy fired" or "detect enemy or who fired"
Post by: Chammy on 21 Aug 2005, 02:35:31
Ok, my idea.....:    I wanted to create a trigger wide enought to cover a certain area.  Now maybe other triggers for separate events.  My idea was  for anytime either AI or players/players fire their weapon it triggers a sound sample at the same time. My idea was to put it in an area like a city that had alot of buildings or a forest and create some end reverb for the rifles to simulate that they are firing in that area. Then when they step out of that area trigger out into the open there is no trigger to set off the sound sample. Gosh i hope I explained that clearly.
Title: Re:looking for the " enemy fired" or "detect enemy or who fired"
Post by: bored_onion on 21 Aug 2005, 10:11:16
use the "foreach" command to attach an eventhandler to every person in a trigger. it will work but heed macguba's warning about lag.
Title: Re:looking for the " enemy fired" or "detect enemy or who fired"
Post by: Baddo on 30 Aug 2005, 22:15:17
There is no need to start any scripts or non-BIS functions from the 'fired' event handler. Just put the code needed to play the sound straight to the event handler itself. It will work fine and causes minimal lag that way.

Another issue for you to think about is, how you treat the event handler when the unit leaves the trigger's zone. Will you delete the EH or just make a check to the event handler using a if...then statement to see if the unit is in the trigger's zone. The latter choice wouldn't cause much lag either, me thinks. But the point is, no need for scripts / non-BIS functions here.
Title: Re: looking for the " enemy fired" or "detect enemy or who fired"
Post by: Chammy on 08 Aug 2006, 06:59:20
Thanks guys, I 'm looking into it now, I lost alot of info earlier :(