patpowercat 7 Posted December 22, 2016 I am trying to make a simple script for an addaction. Addaction on unit, rescue them and they join your group, then delete the addaction so they don't always have a "Rescue" option over them. I currently have this in the hostage's (h1) init field: this addaction ["Rescue", {[h1] joinsilent (_this select 1); h1 setcaptive false; h1 enableAI "Move";}]; This works great. However, if I put the code {[h1] joinsilent (_this select 1); h1 setcaptive false; h1 enableAI "Move";}]; into a script and call it rescue.sqf and then put this in the units init field this addaction ["Rescue","rescue.sqf"]; Nothing at all happens. Any ideas? Additionally I would like to add to the script a removeaction, how would I go about doing this? Sorry, I'm coming back from about a five month break from Arma and I'm pretty rusty on things. Share this post Link to post Share on other sites
davidoss 552 Posted December 22, 2016 this addaction ["Rescue","rescue.sqf"]; rescue.sqf private _hostage = _this select 0; private _rescue = _this select 1; private _actionid = _this select 2; [_hostage] joinSilent _rescue; _hostage setCaptive false; _hostage enableAI "MOVE"; _hostage removeAction _actionid; Share this post Link to post Share on other sites
patpowercat 7 Posted December 23, 2016 Thanks. Seems like what I had was almost the same, except naming the unit. This is more versatile though, thanks a lot again! Share this post Link to post Share on other sites
Grester 40 Posted January 28, 2017 Late response but might be useful for someone else. You either didn't use this in a multiplayer scenario or somehow it worked, but from my tests, in a multiplayer situation the "removeAction" command needs to be broadcasted to the other players, otherwise it will only remove for the player that activated the action. For example: [_hostage, _actionid] remoteExec ["removeAction"]; Share this post Link to post Share on other sites
Nach 13 Posted January 28, 2017 in MP You can put into init.sqf. hostageaddaction = namevariableuniteditor addaction ["Rescue","rescue.sqf"]; publicvariable "hostageaddaction"; all clients can read the addaction on the hostage Share this post Link to post Share on other sites