Ghost 40 Posted March 15, 2013 I have a server side script where an addaction is added to a spawned object, a unit. I used raddaction in the past but that does not seem to work now. Any ideas how to properly get this to work with a server side spawned object? Share this post Link to post Share on other sites
loyalguard 15 Posted March 15, 2013 rAddAction was part of the old Multiplayer Framework which appears to have been revamped for A3 and no longer works the same way. BIS_fnc_MP has replaced it for remotely executing code (you can look it up in the functions viewer (or in this post) for details on parameters and such). You could use BIS_fnc_MP to add the code to all the clients, but just note you would have to create your own function that added the addAction to the vehicle and load it into memory first. You could also try setVehicleInit and processInitCommands after you create the vehicle which will broadcast it across the network to it will be added on all clients. Lastly, you could also try public variable events handlers and publicVariable to tell the clients when to add the action to the vehicle. Share this post Link to post Share on other sites
Ghost 40 Posted March 15, 2013 (edited) Thanks for the reply, will look into it. Be nice to have pub variable for the addaction *Update* Looks like using the setVehicleInit and processInitCommands worked out well. May not be the best method but it works and I am happy with that. Edited March 16, 2013 by Ghost Update Share this post Link to post Share on other sites
clydefrog 3 Posted April 18, 2013 Thanks for the reply, will look into it. Be nice to have pub variable for the addaction*Update* Looks like using the setVehicleInit and processInitCommands worked out well. May not be the best method but it works and I am happy with that. In what way did you use it Ghost? I am trying to do the same thing, spawning vehicles with actions attached but when I local host it only I ( the server) gets the action. I tried using the setvehicleinit way but the action still only showed for me and not the person helping me test it. I had: // _veh1 is the name of the vehicle _veh1 setVehicleInit "_veh1 addAction [""Take Stuff"", ""scripts\carintel1.sqf"", [], 1, false, true, """", ""showAction1""];"; processInitCommands; and as I said the action was still only added for the server. Have I done anything wrong there? Share this post Link to post Share on other sites
killzone_kid 1331 Posted April 19, 2013 showAction1 must be true for action to show. Try without it _veh1 setVehicleInit "_veh1 addAction [""Take Stuff"", ""scripts\carintel1.sqf"", [], 1, false, true, """", """"];"; processInitCommands; Share this post Link to post Share on other sites
clydefrog 3 Posted April 19, 2013 showAction1 must be true for action to show. Try without it_veh1 setVehicleInit "_veh1 addAction [""Take Stuff"", ""scripts\carintel1.sqf"", [], 1, false, true, """", """"];"; processInitCommands; Yeah, I also have showAction1=true; publicVariable "showAction1"; in the script before that stuff but I didn't put it in my post. The action does show, just only for the server and nobody else, but this way of doing it is meant to get around that problem. Share this post Link to post Share on other sites
killzone_kid 1331 Posted April 19, 2013 addaction is local command check wiki, arguments local effect local. you need to execute it on every machine Share this post Link to post Share on other sites
clydefrog 3 Posted April 19, 2013 (edited) addaction is local command check wiki, arguments local effect local. you need to execute it on every machine ... :Oo: yes I know that, that's what I'm trying to do which is why I'm here asking how to make it add the action for everybody from a server run script instead of only the server. Edited April 19, 2013 by clydefrog Share this post Link to post Share on other sites
killzone_kid 1331 Posted April 19, 2013 This is easy. Make a function on every client that will add action, add public variable event handler as well so it executes said function if a certain public variable changes, then publicVariable "yourvariable" from the server. this will trigger your function on every client. Share this post Link to post Share on other sites
clydefrog 3 Posted April 19, 2013 This is easy. Make a function on every client that will add action, add public variable event handler as well so it executes said function if a certain public variable changes, then publicVariable "yourvariable" from the server. this will trigger your function on every client. Any chance you could show an example of this? Share this post Link to post Share on other sites
killzone_kid 1331 Posted April 19, 2013 (edited) you can try something like this //init.sqf if (!isDedicated) then { fnc_addActionToVehicle = { _this addAction ["Take Stuff", "scripts\carintel1.sqf", [], 1, false, true, "", ""]; }; addActionToVehicle = []; "addActionToVehicle" addPublicVariableEventHandler {(_this select 1) call fnc_addActionToVehicle}; }; //to add action just for your client _veh call fnc_addActionToVehicle; //to add action for everyone else addActionToVehicle = _veh; publicVariable "addActionToVehicle"; Edited April 19, 2013 by Killzone_Kid Share this post Link to post Share on other sites
Ghost 40 Posted April 20, 2013 Sorry I was away for a while, this is what I used //add save action _object setVehicleInit "ghst_myscript = this addAction ['<t color=""#ffff00"">The Action</t>', 'scripts\objectives\ghst_myscript.sqf', [], 6, true, true, '','alive _target'];"; processInitCommands; Share this post Link to post Share on other sites