andylee054 0 Posted July 21, 2003 I found a problem on my addon's Eventhandlers. If I added a eventhandler in my soldier's config like that: class Eventhandlers { init = "[_this select 0] exec ""test.sqs"""; }; The sqs will be triggered when we load this soldier in game. After I loaded the soldier, I order him to get in a car, then I found it will be triggered again when the soldier get out from a car. No matter how many times I do this way, the test.sqs will be triggered again and again. How can we stop it? I found "removeEventhandler" won't work in config's Eventhandlers. Any idea? Thanks. Share this post Link to post Share on other sites
raedor 8 Posted July 21, 2003 put this in ur script:<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">if (format ["%1", soldierInit] == "scalar bool array string 0xfcffffef") then {soldierInit = []} ? (_this) in soldierInit: exit soldierInit = soldierInit + [_this] Share this post Link to post Share on other sites
andylee054 0 Posted July 21, 2003 Great!! It works!! Thanks a lot. Share this post Link to post Share on other sites
bn880 5 Posted July 21, 2003 Make sure to start using a tag (like 'ALE') for that global variable soldierInit or your soldier addon may be useless to others in the future. Share this post Link to post Share on other sites
BraTTy 0 Posted July 30, 2003 I'm curious as to why the init eventhandler is being called over and over? I have never experienced this. Share this post Link to post Share on other sites
sussmori 0 Posted August 23, 2003 Not sure why, but I ran into this problem too. In 1.92 The solution provided however did work Share this post Link to post Share on other sites
gunterlund 0 Posted October 11, 2004 What is this? "scalar bool array string 0xfcffffef" Share this post Link to post Share on other sites
Unnamed_ 0 Posted October 11, 2004 Quote[/b] ]I'm curious as to why the init eventhandler is being called over and over? I have never experienced this. If I remember correctly, it only fires everytime a unit gets out of a vehicle. Probably because they loose some of there individual identity (cant think of a better way of describing this) when they board a vehicle. I think it only applies to addon init events and soldiers. Try using SwitchCamera "EXTERNAL" on a AI unit that has just entered a vehicle as a passanger and moved off. To see what I mean. Quote[/b] ]What is this?"scalar bool array string 0xfcffffef" Thats what an un-initialised variable returns, when used with the format command. So you can check to make sure a script called from the init event only runs once per mission. Share this post Link to post Share on other sites
bn880 5 Posted October 11, 2004 Oh by the way, that kind of comparison of an array to string will crash OFP after there are enough elements in the array. Use count array==count array instead: call{private{_t};_t=true;if(count ARR==count ARR)then{arr=arr+[_this];t=false;};if _t then{Arr=[_this];};} Cheers Share this post Link to post Share on other sites