[aps]gnat 28 Posted June 26, 2005 Ok, for a config'ed EH, this works; Quote[/b] ]fired="[_this] exec ""\GNT_B52\firemissiles.sqs"""; but from standard Triggers or unit INIT line; Quote[/b] ][this] exec "\GNT_B52\firemissiles.sqs" doesnt work !!! Error; Type Object, expect Array .......... How do I call the same script from outside the model ? Start of script is; Quote[/b] ]_array = _this select 0_weapon = _array select 1 _ammoname = _array select 4 _plane = _array select 0 thx Share this post Link to post Share on other sites
ProfTournesol 956 Posted June 26, 2005 Well, it's because "fired" eventhandler does return a lot of informations...not only one, all globalized in [_this]. Quote[/b] ]"Fired" string:weapon,string:muzzle,string:mode,string:ammo It means that [_this] returns : _this select 0 : the vehicle who fires ; _this select 1 : weapon fired ; _this select 2 : muzzle of the weapon (a weapon can fire multiple ammo, such as bullets or grenades) ; _this select 3 : mode of the weapon (single, semiauto, auto...) _this select 4 : ammo fired. If you wanna use this script through init line of unit, you should write : nameofunit addEventHandler ["fired",{_this exec "\GNT_B52\firemissiles.sqs"}] Voila  Share this post Link to post Share on other sites
hardrock 1 Posted June 27, 2005 Gnat @ June 26 2005,17:01)]fired="[_this] exec ""\GNT_B52\firemissiles.sqs"""; _this in this case is an array with the entries you mentioned, first being the vehicle itself etc. Thus the script will receive such an array: [ [unit, muzzle, ...] ] Quote[/b] ][this] exec "\GNT_B52\firemissiles.sqs" this in this case is the object, be it a unit or a trigger. Thus the script will receive this array: [ unit ] You know why it doesn't work in both cases? Share this post Link to post Share on other sites
[aps]gnat 28 Posted June 27, 2005 You know why it doesn't work in both cases? Huh!? Â Â riddles ? Anyhow, thanks ProfTournesol but I need to trigger manually so I can't use the Fired EH. But from what u are saying I could be in trouble .... the Fired EH contains the info Im after ......... but does that mean a standard unit query (array call or whatever) wont yeild the info I want ? Share this post Link to post Share on other sites
hardrock 1 Posted June 27, 2005 Gnat @ June 27 2005,05:15)]does that mean a standard unit query (array call or whatever) wont yeild the info I want ? Exactly. Just look at my last post, the script receives different arguments, that's why it doesn't work in the second case. (_array = _this select 0 -> object, when you try to do a = _array select x the error message comes up, as you can't 'select' an element of an object) Share this post Link to post Share on other sites
UNN 0 Posted June 27, 2005 Put this at the start of firemissiles.sqs to see what is being passed. <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">Player SideChat Format ["Param1 %1 Param2 %2 Param3 %3",_This Select 0,_This Select 1,_This Select 4] Most of it can be put straight into your trigger call. <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">[MyPlane01,<Param2>,,<Param3>,] Exec "\GNT_B52\firemissiles.sqs" But I have to ask, do you just want your aircraft to fire it's weapon when it passes over a trigger? Share this post Link to post Share on other sites
ProfTournesol 956 Posted June 27, 2005 Quote[/b] ][MyPlane01,<Param2>,,<Param3>,] Exec "\GNT_B52\firemissiles.sqs" No, i don't think this will work because the script isn't built that way : Quote[/b] ]_array = _this select 0_weapon = _array select 1 _ammoname = _array select 4 _plane = _array select 0 In your example, _array = _this select 0 will only return "MyPlane01", and not an array of infos. And the script will bug... What will work, i think, is (i've tested it on a simple script) to double the "[" and "]" like this : Quote[/b] ][[MyPlane01,Param2,,,Param3]] Exec "\GNT_B52\firemissiles.sqs" Where : param2 is name of weapon, param 3 is name of ammo. And the ",,," are used for item 2 and 3 of the array, not used by the script (but if not, param3 will not be the 5th item of the array, but only the third). Voila  Share this post Link to post Share on other sites
[aps]gnat 28 Posted June 27, 2005 Ok .... thanks guys .... I got it now The extra [ ] did work, and I understand why now, so I changed the script start to accomidate without the extra [ ] and the blanks. Quote[/b] ]_plane = _this select 0_weapon = _this select 1 _ammoname = _this select 2 ? (_ammoname == "B52Bomb"): goto "B52BombRailx" exit #B52BombRailx ?(not alive _plane): goto "Exit" _plane fire _weapon #Exit exit so its called; [A1,"BB52BombRailx","B52Bomb"] exec "\GNT_B52\dropbombs.sqs" Share this post Link to post Share on other sites