Jump to content
Sign in to follow this  
Ford555

[ARMA3] help me with BIS_fnc_MP please (advanced)

Recommended Posts

ok sorry about my english (i live in Spain).

I cant understand at all BIS_fnc_MP function:

ok in single player it works perfectly but not in MP. In arma2, multiplayer framework was the solution but in arma3 it seems the solution is here: https://community.bistudio.com/wiki/Functions_Library_%28Arma_3%29

ok but i cant understand because there is no real examples.

if i want for example use 'say' scripting command (i think there are no one function created for 'say') for multiplayer. in arma2 i remember i wrote:

[nil,player,rSay,....] call RE or something similar but now i am stuck.

i am trying with this:

init.sqf

_handle = execVM "functions.sqf";

functions.sqf

funcsay {

private ("_pic");

_pic = this select 0;

(_pic) say ["whisper1",5];

};

description.ext

whisper1 is well defined in description.ext

and then i write in a state (in a .FSM file) when condition is true :

[_pic,"funcsay",player,true] call BIS_fnc_MP;

but it works in SP but not broadcasting in network

please help me, thanks!

pd: i am at work so its posible some errors in the code because i wrote it from my memory

Share this post


Link to post
Share on other sites

init.sqf

call compile preProcessFile "say.sqf";
[{[someUnit] call funcSay;},"BIS_fnc_spawn",true,false] spawn BIS_fnc_MP; 

say.sqf

funcSay = {
_pic = _this select 0;
_pic say ["whisper1",5];
};

Edited by Iceman77

Share this post


Link to post
Share on other sites

thank you very much! yesterday i was trying that and it works fine (now i can understand better it, thank you!).

I dont explain very well my intentions:

it send to all players 'say' command script. what i wanted is send only for the player who is attacked by a zombie, but it was no problem thank to you! but finally i used new script command 'playSound3D' and it is perfect!. now sound works.

Now when a zombie attack one soldier i need it shows a picture on screen (a scratch).

situation:

i have .fsm file with conditions and states, when zombie is nearest target then zombie attack and when zombie attack it send a sound (solved with 'playSound3D') and shows a picture on screen (a scratch). So i do this:

in state .fsm file:

[[[1],"show.sqf"],"BIS_fnc_execVM",_zTarget,true] spawn BIS_fnc_MP;

_zTarget is the target of the zombie (a player) and i think it can be the problem (when i play with an IA assigned to me in a dedicated server, when IA is attacked by a zombie i can see the scratch too, but if a put _zombie instead _zTarget i cant see the picture)

show.sqf;

addCamShake [5, 1, 25];

cutText [format[(scratch%1), 1], "PLAIN"];

Again sorry for my english and thanks for the help!

---------- Post added at 12:12 ---------- Previous post was at 11:53 ----------

or if i put 'player' instead '_zTarget' it will be ok?. i must put 'player' or '_player' in .fsm file,.... and it can recognize its me or another player¿?

Share this post


Link to post
Share on other sites

Kind of a hard question to explain. Hope this helps. Your target parameter of the function "_zTarget" is only know to the zombie object which is you. So only you the player should see it because the zombie reference its target you. But _zombie won't work because is the zombie itself (I assume) which technically only the zombie will get the function. Now putting player for a target can have un wanted results(In MP this value is different on each computer. http://community.bistudio.com/wiki/player ). If you want to target only one object then use that objects variable name.

Edited by Johnson11B2P
grammar

Share this post


Link to post
Share on other sites
[[[1],"show.sqf"],"BIS_fnc_execVM",_zTarget,true] spawn BIS_fnc_MP;

_zTarget is the target of the zombie (a player) and i think it can be the problem (when i play with an IA assigned to me in a dedicated server, when IA is attacked by a zombie i can see the scratch too, but if a put _zombie instead _zTarget i cant see the picture)

The param of BIS_fnc_MP where you have _zTarget should be thought of more as client than who. As the AI that is being attacked is under your control (part of your team), he is local to your machine so adding a reference to him in BIS_fnc_MP will run show.sqf on your machine, your the client where he is local.

To stop this all you need to do is add a check before the call to MP to make sure the zombies target is a player e.g

if (isPlayer _zTarget) then {
[[[1],"show.sqf"],"BIS_fnc_execVM",_zTarget,true] spawn BIS_fnc_MP;
};

Now the only time this will fire is when the target is an actual player and will be firing on that clients machine.

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  

×