Jump to content
Sign in to follow this  
Somerville

Activating Variables when JIP

Recommended Posts

Okay, here's the situation:

We've got 15 units and a JIP mission. Each unit has a number of variables that he/she can get throughout the mission.

Of course, when Joining in Progress, variables don't work, do they?

But what I'm wondering is, is there any way at all to use the onplayerconnected command to activate these variables?

The units, at the beginning of the mission are called p1 thru p15 respectively.

Thanks for anybody's help!

Share this post


Link to post
Share on other sites

init.sqf

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

...

var1 = ..

var2 = ..

...

varN = ..

synchroVariables = true;

PublicVariable "synchroVariables";

...

create a trigger (repeating) activated by synchroVariables

on activation write

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">ptr = [] execVM "synchro.sqf"

create a logical element named for example log_server

create script:

synchro.sqf

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

if(local log_server) then {//server

PublicVariable "var1"

PublicVariable "var2"

....

PublicVariable "varN"

synchroVariables = false;

PublicVariable "synchroVariables";

};

if (true) exitWith {};

Share this post


Link to post
Share on other sites

I don't think the init.sqf script is run on the client when said client JiP.

Share this post


Link to post
Share on other sites

init.sqf runs always before game start. when client joined he publics variable synchroVariables on his own init.sqf. Then trigger will be activated on every clients and server, but only server will publics needed variables.

Share this post


Link to post
Share on other sites

Actually the init.sqf/.sqs isnt loaded on JIP players.

The easy solution is creating a trigger with the condition true.

Then put everyting you want activated in the onactivation field and your done.

Somer if you need any help you know where to find me.

Share this post


Link to post
Share on other sites

According to my tests on a Dedicated Server(1.05 and 1.05+) the init.sqf, all unit Init-Lines and all init-eventhandlers are run on the client that is JIP into the game . smile_o.gif

On the Issue,it might be easier to do what Przemek_kondor has posted in OnPlayerConnected . But since you only can have one of those...

Share this post


Link to post
Share on other sites
According to my tests on a Dedicated Server(1.05 and 1.05+) the init.sqf, all unit Init-Lines and all init-eventhandlers are run on the client that is JIP into the game . smile_o.gif

On the Issue,it might be easier to do what Przemek_kondor has posted in OnPlayerConnected . But since you only can have one of those...

Thanks for the post. I was going to say I'm seeing the same thing on my dedicated server as well.

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  

×