draoth 13 Posted March 25, 2017 Hello everyone! So i know how to use addAction in the way the wiki told me (Run a script) , but what if i want to increase a variable of something that only exists in this script. Lets say i have a local variable called: "_speed" I can't use: _Car addaction ["Faster:", "_speed + 10"]; I also can't do this: _Car addaction ["Faster:", "[_speed] speed.sqf"]; (And in speed.sqf : _Car = _this select 0; _speed+10;) I can't seem to find any answers on the forums, so i hope you can help me with this. Remember i'm not that experienced with arma scripting. (scripting in general). Draoth. Share this post Link to post Share on other sites
riten 153 Posted March 25, 2017 "_x" is local variable, you need global or make it publicVariable. For example: script: speed=0; ##(you need to define it before you use addaction) ... addaction: _Car addaction ["Faster:", "speed=speed+10;publicVariable 'speed';"]; You can test it via hint hint format ["My speed variable: %1", speed]; 1 Share this post Link to post Share on other sites
draoth 13 Posted March 25, 2017 1 minute ago, riten said: "_x" is local variable, you need global or make it publicVariable. For example: script: speed=0; ##(you need to define it before you use addaction) ... addaction: _Car addaction ["Faster:", "speed=speed+10;publicVariable 'speed';"]; Thank you for answering this fast. but what if i want to keep it local? The _speed is is for a car you can spawn. So i don't want everyones car to speed up if one person uses the action. Share this post Link to post Share on other sites
riten 153 Posted March 25, 2017 addaction is local so it will run only for one player. Just remove publicVariable and it shouldn't be broadcasted to others :) 1 Share this post Link to post Share on other sites
draoth 13 Posted March 26, 2017 On 25-3-2017 at 1:12 PM, riten said: addaction is local so it will run only for one player. Just remove publicVariable and it shouldn't be broadcasted to others :) thanks! Share this post Link to post Share on other sites