Jump to content
Sign in to follow this  
iceman77

player's group + BIS_fnc_MP

Recommended Posts

setGroupID effects are local. I need to set the player group's groupID and broadcast it (??). I wanted to use BIS_fnc_mp to do so. Is this correct? Or would it set the groupID of every player's group :confused:. What would be a better way to do this? Thanks.

client function

private ["_input","_compStr","_grpName"];

_input = [_this, 0, "",[""]] call BIS_fnc_param;
_compStr = [_input] call BIS_fnc_filterString;

call compile format [
  "
_grpName = %1;
_grpName = createGroup (side player);	
[player] joinSilent _grpName;
_grpName setGroupID [_compStr];
[[(group player),[groupID (group player)]],'setGroupId'] call BIS_fnc_mp;
  ", 
_compStr
];

Share this post


Link to post
Share on other sites

Should work. The contents of variables used as parameters are transfered by bis_fnc_mp.

However, I would normally make a function for it instead of sending the command directly (even though that is possible now)

Oh and why do you set groupid to [_compstr] and then fetch the groupid again? Why not simply send [_compstr] with bis_fnc_mp? One less command to be processed.

Share this post


Link to post
Share on other sites

Why did you put everything into the call compile, and why do you assign _grpName a variable to then overwrite it with a newly created group? Does the created group keep the designation as _grpName?

_grpName = call compile format [%1,_compStr];
_grpName = createGroup (side player);
[player] joinSilent _grpName;
_grpName setGroupID [_compStr];
[[[_grpName,_compStr],{(_this select 0) setGroupID (_this select 1) }],'BIS_fnc_spawn',true] call BIS_fnc_mp;

Though your BIS_fnc_MP parameter should work as well if it is able to distinguish between multiple parameters when a script command instead of function was passed (would be good to know, honestly).

Share this post


Link to post
Share on other sites
Should work. The contents of variables used as parameters are transfered by bis_fnc_mp.

However, I would normally make a function for it instead of sending the command directly (even though that is possible now)

Oh and why do you set groupid to [_compstr] and then fetch the groupid again? Why not simply send [_compstr] with bis_fnc_mp? One less command to be processed.

Okay. Thankyou for the reply and the advice. Cheers.

Edited by Iceman77

Share this post


Link to post
Share on other sites
if it is able to distinguish between multiple parameters when a script command instead of function was passed (would be good to know, honestly).

AFAIK, it processes the commands first and then only sends the results.

Share this post


Link to post
Share on other sites
Why did you put everything into the call compile, and why do you assign _grpName a variable to then overwrite it with a newly created group? Does the created group keep the designation as _grpName?

_grpName = call compile format [%1,_compStr];
_grpName = createGroup (side player);
[player] joinSilent _grpName;
_grpName setGroupID [_compStr];
[[[_grpName,_compStr],{(_this select 0) setGroupID (_this select 1) }],'BIS_fnc_spawn',true] call BIS_fnc_mp;

Though your BIS_fnc_MP parameter should work as well if it is able to distinguish between multiple parameters when a script command instead of function was passed (would be good to know, honestly).

The variable is undefined there.

Share this post


Link to post
Share on other sites

that should suffice:

_group = createGroup (side player);
[player] joinSilent _group;
[ [_group,[_compStr]], "setGroupId", true] spawn BIS_fnc_MP;

Share this post


Link to post
Share on other sites

@ Wolf - Tried 2 ways with your method.

#1

private ["_input","_compStr","_grpName"];

_input = [_this, 0, "",[""]] call BIS_fnc_param;
_compStr = [_input] call BIS_fnc_filterString;

_grpName = call compile format ["%1",_compStr];
_grpName = createGroup (side player);
[player] joinSilent _grpName;
_grpName setGroupID [_compStr];
//[[(group player),[groupID (group player)]],'setGroupId'] call BIS_fnc_mp;
[[[_grpName,_compStr],{(_this select 0) setGroupID (_this select 1) }],'BIS_fnc_spawn',true] call BIS_fnc_mp;  

/*
call compile format [
  "
_grpName = %1;
_grpName = createGroup (side player);	
[player] joinSilent _grpName;
_grpName setGroupID [_compStr];
[[(group player),[groupID (group player)]],'setGroupId'] call BIS_fnc_mp;
  ", 
_compStr
];

*/

nil

#2

private ["_input","_compStr","_grpName"];

_input = [_this, 0, "",[""]] call BIS_fnc_param;
_compStr = [_input] call BIS_fnc_filterString;

_grpName = call compile format ["%1",_compStr];
_grpName = createGroup (side player);
[player] joinSilent _grpName;
_grpName setGroupID [_compStr];
[[(group player),[groupID (group player)]],'setGroupId'] call BIS_fnc_mp;
//[[[_grpName,_compStr],{(_this select 0) setGroupID (_this select 1) }],'BIS_fnc_spawn',true] call BIS_fnc_mp;  

/*
call compile format [
  "
_grpName = %1;
_grpName = createGroup (side player);	
[player] joinSilent _grpName;
_grpName setGroupID [_compStr];
[[(group player),[groupID (group player)]],'setGroupId'] call BIS_fnc_mp;
  ", 
_compStr
];

*/

nil

rpt #1

7:04:51 Error in expression <newGrp>
7:04:51   Error position: <newGrp>
7:04:51   Error Undefined variable in expression: newgrp
7:04:51 Error in expression <(_this select 0) setGroupID (_this select 1) >
7:04:51   Error position: <setGroupID (_this select 1) >
7:04:51   Error setgroupid: Type String, expected Array

rpt#2

7:03:12 Error in expression <newGrp>
7:03:12   Error position: <newGrp>
7:03:12   Error Undefined variable in expression: newgrp

---------- Post added at 07:07 ---------- Previous post was at 07:06 ----------

that should suffice:

_group = createGroup (side player);
[player] joinSilent _group;
[ [_group,[_compStr]], "setGroupId", true] spawn BIS_fnc_MP;

Believe I tried that. No errors, it worked, but something to do with retrieving the player's groupID. Will give it another go 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  

×