sasij 1 Posted March 13, 2013 Hello, I'm completely new to scripting for arma games so I do apologize if this is old but I have been searching google and forums for a couple hours now with no luck. My problem is that I am trying to add action to the player with addAction. It works fine if I put addAction[] etc.. in the "init" box of the unit manually. But I am trying now to put nul = [this] execVM "respawn.sqf"; in the init box and all the code in a script. The code is executed but my player gets no additional actions like he did when I enter it in the init box manually. Any idea what I am doing wrong? Perhaps I need to reference "this" differently? Thanks to anyone who can assist. respawn.sqf titleText ["Respawn Event handled. Food and Water reset.", "PLAIN"]; hunger = 0; thirst = 0; this addAction ["Check Hunger and Thirst Levels.", "check_foodwater.sqf"]; this addaction ["Heal Self.","heal.sqf"]; Share this post Link to post Share on other sites
loyalguard 15 Posted March 13, 2013 outside of the init line, you have to refer to the unit specifically. Substitute this with player and see if that works, such as: _action1 = player addAction ["Check Hunger and Thirst Levels.", "check_foodwater.sqf"]; _action2 = player addaction ["Heal Self.","heal.sqf"]; Share this post Link to post Share on other sites
sasij 1 Posted March 13, 2013 Thanks for the response but I had already tried using player to no avail. But I did manage to fix my problem just now. Not sure if it's the correct way but it seems to have worked. So for anyone else with a similar issue here is how I got it. _me = _this select 0; _me addAction ["Check Hunger and Thirst Levels.", "check_foodwater.sqf"]; _me addaction ["Heal Self.","heal.sqf"]; Share this post Link to post Share on other sites
mikie boy 18 Posted March 13, 2013 if you view the addaction page it will explain what variables are returned from the addaction array. [target, caller, ID, (arguments)] target: Object - the object which the action is assigned to caller: Object - the unit that activated the action ID: Integer - ID of the activated action arguments: Anything - arguments given to the script if you are using the extended syntax so in relation to the above - if you placed your addaction script on an empty item - it wont work - as _me = target. - if you changed it to _me = _this select 1; - then that would be the caller/person who activated the addaction. hope that points you in the right direction for other addaction bits. Share this post Link to post Share on other sites