wok 1 Posted November 2, 2013 I need to pass cursorTarget as an argument of addAction and then read it on the sqf file the action runs. My test code is: init.sqf player addAction ["test", "test.sqf", cursorTarget]; test.sqf (I've read on bis wiki that the argument would be passed on the _this array with the index 3) _test = format ["%1", _this select 3]; hint _test; My problem is that the hint always shows "<NULL-object>", no matter what I am aiming at. If I replace _this select 3 with cursorTarget, and then run the action while aiming at another soldier the hint show something like "B Alpha 1-1:2". And also if I pass a string instead of cursorTarget on init.sqf, then the hint shows the string correctly using _this select 3. So, why I can't read cursorTarget using _this select 3? I am just worried that the cursorTarget may change after running the action and mess up stuff, that's why I want to pass it as an argument. Share this post Link to post Share on other sites
Hypnomatic 10 Posted November 2, 2013 (edited) I'm pretty sure that that cursorTarget is being evaluated only when the addAction command runs. By that I mean that cursorTarget is basically running once: Whatever is in front of the player's cursor when the action is added is always going to be passed to the script. So if the player is looking at nothing when you add the action, you'll get an objNull in _this select 3 every time. If you add the action when a player is looking at something, _this select 3 will always return that unit, even once you're no longer looking at it. So I recommend assigning cursorTarget to a variable at the start of test.sqf, and you should be golden, ie: _targetPlayer = cursorTarget; Edited November 2, 2013 by Hypnomatic Share this post Link to post Share on other sites