Jump to content

Recommended Posts

I have done a back-port of my A3 to IF and have come across a problem. In A3 it is more easy to use functions with JIP as you have the BIS_fnc_MP command however, in IF you don't. How would I make my functions JIP compatible in IF? Below is one example of a function that works fine with JIP in A3.

Lib_func_createMarker = {
_mName = _this select 0;
_mPos = getMarkerPos (_this select 1);
_mText = _this select 2;
_mSize1 = _this select 3;
_mSize2 = _this select 4;
_mDir = _this select 5;
_mType = _this select 6;
_mShape = _this select 7;
_mBrush = _this select 8;
_mColour = _this select 9;
_mAlpha = _this select 10;

_m = createMarker [_mName, _mPos];
_m setMarkerText _mText;
_m setMarkerSize [_mSize1, _mSize2];
_m setMarkerDir _mDir;
_m setMarkerType _mType;
_m setMarkerShape _mShape;
_m setMarkerBrush _mBrush;
_m setMarkerColor _mColour;
_m setMarkerAlpha _mAlpha;
};

Dirty Haz

Share this post


Link to post
Share on other sites

I don't see how setVehicleInit command would work for this? I tried looking at "call re" but no luck so far... :( :confused:

Dirty Haz

Share this post


Link to post
Share on other sites

setVehicleInit on a logic works as logics are automatically sync'd on JIP, it is the easiest way to do it but not the best. Using the MP framework (look on BIKI under A2) would be the better solution though.

Share this post


Link to post
Share on other sites

use the local variants of the marker commands and let every client execute it on their own

Share this post


Link to post
Share on other sites

Thanks for your reply .kju! Much appreciated... I will try that. What about for my other functions such as my ones for tasks?

Dirty Haz

Share this post


Link to post
Share on other sites

tasks are local. so the same design can be used

Share this post


Link to post
Share on other sites

Lib_func_createMarker = {
_mName = _this select 0;
_mPos = getMarkerPos (_this select 1);
_mText = _this select 2;
_mSize1 = _this select 3;
_mSize2 = _this select 4;
_mDir = _this select 5;
_mType = _this select 6;
_mShape = _this select 7;
_mBrush = _this select 8;
_mColour = _this select 9;
_mAlpha = _this select 10;

_m = createMarkerLocal [_mName, _mPos];
_m setMarkerTextLocal _mText;
_m setMarkerSizeLocal [_mSize1, _mSize2];
_m setMarkerDirLocal _mDir;
_m setMarkerTypeLocal _mType;
_m setMarkerShapeLocal _mShape;
_m setMarkerBrushLocal _mBrush;
_m setMarkerColorLocal _mColour;
_m setMarkerAlphaLocal _mAlpha;
};

I call this function like so:

["AO", "STASZOW", "Capture STASZOW", 250, 250, 0, "mil_dot", "ELLIPSE", "SOLID", "ColorRed", 1] call Lib_func_createMarker;

Lib_func_createTask = {
_taskID = _this select 0;
_taskName = _this select 1;
_taskDescription = _this select 2;
_taskTitle = _this select 3;
_taskWaypointDescription = _this select 4;
_taskWaypointDestination = if (count _this > 5) then {_this select 5;} else {};
_taskState = _this select 6;
_setCurrentTask = _this select 7;
_taskHintMessage = _this select 8;
_taskHintState = _this select 9;

_taskID = player createSimpleTask [_taskName];
_taskID setSimpleTaskDescription [_taskDescription, _taskTitle, _taskWaypointDescription];
_taskID setSimpleTaskDestination (getMarkerPos _taskWaypointDestination);
_taskID setTaskState _taskState;
if (_setCurrentTask) then {{_x setCurrentTask _taskID;} forEach playableUnits;} else {};
taskHint [_taskHintMessage, [1, 1, 1, 1], _taskHintState];
};

I call this function like so:

[task1, "task1", "Soviet forces have occupied STASZOW. Eliminate all of them in the AO at all costs. Stay frosty and good luck. Crossroad out!", "Capture STASZOW", "Capture STASZOW", "STASZOW", "ASSIGNED", true, "NEW TASK AVAILABLE", "taskNew"] call Lib_func_createTask;

They don't work or show in MP, neither for clients on server or for JIP. Any ideas?

Dirty Haz

Share this post


Link to post
Share on other sites

what file do you call them, how and when?

Share this post


Link to post
Share on other sites

In a script which is called from init.sqf - I have if (!isServer) exitWith {}; at the top of this script though... I guess that this could be a problem?

Dirty Haz

Share this post


Link to post
Share on other sites

Thank you, it is working now!

Dirty Haz

---------- Post added at 09:09 PM ---------- Previous post was at 07:37 PM ----------

It seems that I was a bit wrong. It works but loops the tasks for each units on all clients... How do I prevent this?

Dirty Haz

Share this post


Link to post
Share on other sites

if (_setCurrentTask) then {{_x setCurrentTask _taskID;} forEach playableUnits;} else {};

=>

if (_setCurrentTask) then {player setCurrentTask _taskID;};

Share this post


Link to post
Share on other sites

Sorry for the late reply! It is working now, thank you so much!!! ;)

Dirty Haz

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  

×