Jump to content
Sign in to follow this  
fasad

group dataType variable locality issue

Recommended Posts

Sorry for all the questions smile_o.gif

I'm having trouble with the refering to groups in MP. I've tried the following :

groupVar = group this; publicVariable "groupVar";

in the init of the unit.

groupVar = group unitName; publicVariable "groupVar";

in the init of the unit.

groupVar = group unitName; publicVariable "groupVar"

in init.sqf.

Whenever I check the variable in SP, it returns West-1-1-B (for example).

Whenever I check the variable from the player on a dedicated server, it returns <GROUP-NULL>.

What's going on?

Share this post


Link to post
Share on other sites

The "unit" your're attempting to do this on is a manned vehicle, not a soldier, right?

In any case, it looks like a quirk that existed in OFP too - in multiplayer, the group of a vehicle isn't valid at the time the mission's init lines are processed. The workaround is to first name the vehicles, then wait a bit in your init.sqf and then set the group references:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

// init.sqf

// Things that can be processed before time > 0 goes here

...

...

// Just wait a wee while. Two seconds might be enough and it might not be enough. Test!

waitUntil { time > 2 };

tankgroup = group sometank;

bmpgroup = group thebmp;

...

// etc etc

PS. Don't ever do publicVariables in the init lines of mission editor-placed units. This is because the init lines are executed on *all* computers, so it's not needed.

Share this post


Link to post
Share on other sites

Rock and roll, thanks for that! Yes, the unit's are static artillery pieces. I see I've got some catching up to do on all these MP idiosyncrasies. I also tried group = gunner this with the same result. Thanks again.

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  

×