OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: 456820 on 02 Jul 2005, 10:41:27
-
im trying to add event handlers to all units in the game so i added a trigger
Anybody present Once
condition : This
On activation :
"_X AddEventHandler [{Fired},{_This Exec {TimedGrenade.sqs}}]" ForEach thislist ; "_X AddEventHandler [{Fired},{_This Exec {fired.sqs}}]" ForEach thislist ; "_X AddEventHandler [{Fired},{_This Exec {RPGdeviate.sqs}}]" ForEach thislist
i get no error messages but in one of the scripts thats how it tells me to do it but its not ?
-
So what's the problem?
-
it doesnt work as in the scripts dont activate when i fire
-
Try changing the brackets the other way around:
{_x AddEventHandler ["Fired",{_This Exec "TimedGrenade.sqs"}]} ForEach thislist ; {_x AddEventHandler ["Fired",{_This Exec "fired.sqs"}]} ForEach thislist ; {_x AddEventHandler ["Fired",{_This Exec "RPGdeviate.sqs"}]} ForEach thislist
???
-
Not that I know what I'm talking about however if it is in the "On Activation" box then don't you need to change all the "_this" to just "this"??? So just get rid of the underscore??? Not sure though.
-
No, that won't work, an eventhandler passes its arguments in the array called _this.
Good try though ;D
Planck
-
First, you can simplify those three calls and combine them into one. This makes it more readable and efficient:
{_x addEventHandler["fired",{_this exec"TimedGrenade.sqs";_this exec"fired.sqs";_this exec"RPGdeviate.sqs"}]} forEach thislist
Secondly, try adding a delay of 1 second to that trigger, ie fill in 1 in the Max/Mid/Min fields of the trigger property dialog and see if that helps.