Jump to content
Sign in to follow this  
causticwindow911

MP private Addaction woes

Recommended Posts

I recently did a search on this forum about private addactions, ie. addactions that only one player can see / use in multiplayer. There were solutions that solved their problems, but none of them worked for me.

Here's what I have in a few soldiers init field:

Quote[/b] ]if (player == this) then {this addaction ["the action","action.sqf"]};

I have tested this in single player and it works. I go up to the other soldiers that have the same init and I cannot see their addactions. However, some things to note:

1. It seems like whenever I give my unit a name, such as "s1" for DAC, the addaction will not appear. If I change "player == this" to "s1 == this" then it works, but subsequently I can see other people's addactions as well.

2. These units were manually changed from side East to West in the mission SQM. So, it's East units that are seen as West to the AI. I don't know if that affects anything, but it might!

Overall, once compiled into a .PBO and tested in MP, it just doesn't work. No addactions appear whatsoever. I haven't tried this on a dedicated server but I don't think it would matter. I have tried other variations that were recommended, such as:

Quote[/b] ]if (local player and player == this) ...

Which did not work as well. I wish I could elaborate more, but my testings with this have been inconsistant and downright bizarre. Hope to see some suggestions. inlove.gif

Share this post


Link to post
Share on other sites

try saying "player addaction ..." in the init.sqf file (create it if it's not there). Make sure to end with a semicolon! This file runs once on each computer when they start the map. You can restrict who runs each command (say, you want something server only) by adding the isServer condition to an if statement (or any other conditional).

Also, you can add "waituntil {player == player}; before your addaction. That means that JIP players will wait until their player object was created before running your addaction line.

If you want the action to persist after respawn you'll need to do a little more work.

Share this post


Link to post
Share on other sites
try saying "player addaction ..." in the init.sqf file (create it if it's not there). Make sure to end with a semicolon! This file runs once on each computer when they start the map. You can restrict who runs each command (say, you want something server only) by adding the isServer condition to an if statement (or any other conditional).

Also, you can add "waituntil {player == player}; before your addaction. That means that JIP players will wait until their player object was created before running your addaction line.

If you want the action to persist after respawn you'll need to do a little more work.

"player addaction..." in init.sqf does work, but the problem remains that everyone can see / use the player's addaction as well.

I'm not totally familiar with the isServer command, although looking at the BIS Wiki it doesn't seem like something that I could use in this situation. Could you possibly make an example that I could use in this case?

Thanks for the help thumbs-up.gif

Share this post


Link to post
Share on other sites

just a quick guess but I'd try

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">if (local s1) then {this addaction ["the action","action.sqf"]};

for a dedicated server.

if you want it to run also on server/client MP games then

I wouldn't be putting the code in the init line of the unit.

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

Share this post


Link to post
Share on other sites

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">player addaction ["the action","action.sqf"];

Should only add the action to the player on his own machine. Since player is unique to each computer, it should not show up for the other players. If you name each player s1, s2 in the init.sqf you will get one action added to each player on each machine.

Hopefully that works. I can't test on two clients at the moment though. :-/

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  

×