Passing more info to eventhandlers:
http://www.ofpec.com/yabbse/index.php?board=8;action=display;threadid=17724;start=0After you have read that, read below:
The big problem with using this method, though, is that you can't easily pass a
unit to the EH; only numbers and strings. You
could pass a variable name to the EH though, and then using this trick again in the script, you could extract the value of the variable to be used in your script.
Example:_varName = _this select 5
; (_varName is a STRING, that is the same as the name of a global variable you have)
call format["_unit = %1", _varName]
; now _unit is an OBJECT; the same object that was in the global variable
But if you have an un-changing array with all the units on the map in it, then you could pass an index pointing to the unit in the array, instead of the unit itself.
---------------------------------------------------------
Can anyone help me with a small problem, I have to make an array of units so that i can try and find the place in a set of synchronous arrays where that units wound info is held. I can't seem to get the array to store the unit and find him again by searching the array.
Hmm... not sure if I'm getting you correctly, but would this work?
Make an array of arrays, like so:
GlobalArray = [ [unitA, info1, info2, info3], [unitB, info1, info2, info3] ]
Now, to find the unit and his associated info, you just do a little loop through the array in a function like so:
_unit = _this select 0
_i = 0
#loop
? (GlobalArray select _i) select 0 == _unit : _returnArray = GlobalArray select _i; goto "end"
_i = _i + 1
goto "loop"
#end
_returnArray
Actually, this is in script syntax, but it could easily be converted into a function. I just know scripts better than functions off the top of my head.
Let me know if that isn't what you are talking about. Hope that helps ya'll.