Jump to content
Sign in to follow this  
DChristy87

addAction Problems!

Recommended Posts

My situation in my mission:

-If you have a certain item in your inventory, you are given an addAction. (Works fine for me, not my friend)

-When I use this addAction, it creates a vehicle and adds an addAction to the vehicle (I see the addAction, but my friend doesn't)

I've read this over several times: http://community.bistudio.com/wiki/addAction

It explains that if you want everyone to see the addAction you have to run the script on all players computers. But it doesn't explain how to do that.

In the init.sqf, I have it so if you're side == west then you run an sqf specific for the west side players. Inside of that sqf I have this:

player addAction ["Create A Camp?", "createCamp.sqf", [], 1, false, true, "", " ""ItemRadio"" in (Assigneditems _this)"];

Inside the createCamp.sqf, I have this:

_action = _this select 0;
_caller = _this select 1;
_id = _this select 2;
_caller removeAction _id;
_grp = createGroup WEST;
[_caller] joinSilent _grp;
_grp selectLeader _caller;
_spawnCamp = createVehicle ["FirePlace_burning_F",getPos player, [], 0, "CAN_COLLIDE"];
_spawnCamp setpos  (player modelToWorld [0,1.5,0]);
_spawnCamp setDir ([_spawnCamp, player] call BIS_fnc_dirTo);
_spawnCamp addAction ["Join this camp?", {[_this select 1] joinSilent (_this select 3)}, _grp];
_caller execVM "player\sideMissions\patrolMissions.sqf";
_caller execVM "player\sideMissions\specialMissions.sqf";

Why is it my friend doesn't get the addAction when he has a radio in his inventory and why is it he cant see the addAction when I create the fireplace?

Share this post


Link to post
Share on other sites

The init.sqf is run on all machines, so make sure you have no conditions to only run the addAction statement on the server (I assume you are the local host). You might also want to try adding this line before the addAction (could be an issue with the client synching):

if !(isServer) then {waitUntil {!(isNull player)};};

Other clients will not see the action to join the camp because the function that adds that action runs only on one machine (using an action executes the code locally). You need a system to remotely execute that statement on all clients. This is probably the easiest way:

http://community.bistudio.com/wiki/BIS_fnc_MP

There are other ways to do it if BIS_fnc_MP does not work for you.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×