Jump to content
Sign in to follow this  
iceman77

publicVariable JIP

Recommended Posts

When I publicVariable a variable, will the variables current/correct bool state be broadcast to jip players automatically when they join?

Share this post


Link to post
Share on other sites

Yes, also remember that value is assigned before the init.sqf runs so if you plan on having it JIP you must check for it's value status. (isNil)

Share this post


Link to post
Share on other sites

Okay, so I broadcasted some publicvariables via triggers. (OnAct: mine_box_moved=true; publicVariable "mine_box_moved") etc etc. My init.sqf includes an call

onplayerConnected "[] execVM ""playerConnected.sqf""";

playerConnected.sqf

if (mine_box_objective) then {_this = execVM "objective1.sqf"} else {deleteMarker "mine_box_M";deletemarker "mines_delivery_M"};
if (mine_box_moved) then {deleteMarker "mine_box_M"} else {};

When a player connects (dedicated) most times it succeeds in syncing the marker state with the JIP player, but on occasion it doesn't. Would i use (isNil) somewhere or somehow to make this full proof?

Share this post


Link to post
Share on other sites

onPlayerConnected only runs on the server.

You also do not need "else {};", it's optional.

If you just publicVariable when an objective is done you can do something like this in init.sqf

if (!isNil "myObjectivePublicVariable") then {"myMarker" setMarkerAlphaLocal 0};

Share this post


Link to post
Share on other sites
onPlayerConnected only runs on the server.

You also do not need "else {};", it's optional.

If you just publicVariable when an objective is done you can do something like this in init.sqf

if (!isNil "myObjectivePublicVariable") then {"myMarker" setMarkerAlphaLocal 0};

Does setMarkerAlphaLocal work with scripted/created markers?

Share this post


Link to post
Share on other sites

so it wouldn't work for JIP players? haha this is getting frustrating. I just want to keep markers that i've created or deleted, synced for jip players.

Share this post


Link to post
Share on other sites

Something like this maybe.

//init.sqf
if (isServer) then 
{
 TAG_markerArray = [];
 onPlayerConnected '{_x setMarkerPos (markerPos _x)} forEach TAG_markerArray';
};

// bla bla objective script

_marker = createMarker ["test",getPos test];
TAG_markerArray set [count TAG_markerArray,_marker];

Share this post


Link to post
Share on other sites
Something like this maybe.

//init.sqf
if (isServer) then 
{
 TAG_markerArray = [];
 onPlayerConnected '{_x setMarkerPos (markerPos _x)} forEach TAG_markerArray';
};

// bla bla objective script

_marker = createMarker ["test",getPos test];
TAG_markerArray set [count TAG_markerArray,_marker];

hehe, I don't understand any of that. Oh well, I think i'll just stick to SP missions or just playing the game. I didn't realize keeping markers synced to players who join in progress was such a technical chore.

Thanks for trying to help though guys.

Share this post


Link to post
Share on other sites

haha so I didn't completely give up. Here's what I did.

if (!isnil "mine_box_moved") then {"mine_box_M" setmarkeralpha 0};

Trigger:
onAct: mine_box_moved=true; publicvariable "mine_box_moved"; 

Edited by Iceman77

Share this post


Link to post
Share on other sites

Hope I don't steer you wrong... there might be more to it than just this but try making mine_box_moved equal to something in the OnAct. It doesn't matter if it's true or a number like 0 or 1.

Trigger:

onAct: mine_box_moved = true; publicvariable "mine_box_moved";

Share this post


Link to post
Share on other sites
Hope I don't steer you wrong... there might be more to it than just this but try making mine_box_moved equal to something in the OnAct. It doesn't matter if it's true or a number like 0 or 1.

Trigger:

onAct: mine_box_moved = true; publicvariable "mine_box_moved";

Was a typo, I set it to true. None the less thanks twirly! You always come with solutions :cool:

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  

×