Jump to content
Sign in to follow this  
LtAnderton159

Jip and BIS fnc MP

Recommended Posts

Hello !

I ask for your help to resolve my problem. I would like to have objectives compatible whith JIP. After some research, i found the new function multiplayer (https://community.bistudio.com/wiki/BIS_fnc_MP). So, i would like that a new player have the briefing, and have objectives with the same status than others players. Moreover, i would like that the execution of this function, is local for the new player.

So in a game logic, (for the briefing) i put this :

[[[],"briefing.sqf"],"BIS_fnc_execVM"] call BIS_fnc_MP; 

=> When a player arrive, same objectives double. The new player, have not the briefing.

In the trigger that change the status of one objective (for players who are already playing), in add i completed with this :

[[obj1,nil,nil,nil,SUCCEEDED,nil,false],"bis_fnc_setTask"] call BIS_fnc_MP; 

This is not seems to work. Can you explain me how can i do ? How do I configure the settings to get what I want?

Thank you for your help, and sorry if the question seems stupid, I am a beginner in this field and research did not bring more informations.

Edited by LtAnderton159

Share this post


Link to post
Share on other sites

How do you create tasks? AFAIK bis_fnc_taskCreate/bis_fnc_taskSetState is JIP-compatible, so you don't need to bother about JIPs.

Concerning calling briefing.sqf for those who join in progress - add this

waitUntil {!isNull player};
[] execVM "briefing.sqf"

to mission init.sqf file, it should do the trick. :) I had similar problem some time ago, see this thread.

About calling BIS_fnc_MP only on JIP's computer: well, that a little bit tricky (and to be honest I didn't tried that) because you must explicitly specify a target client in third argument when calling that function. But if you want some code to be executed now on each client and on those who will join your mission later then just pass "true" as fourth argument

[[[],"briefing.sqf"],"BIS_fnc_execVM", true, [color="#FF0000"]true[/color]] call BIS_fnc_MP;

Edited by Semiconductor

Share this post


Link to post
Share on other sites

Hello ! Thanks for your help :p

For my objectives i put this in trigger (on activation) :

["TaskSucceeded",["Neutraliser le colonel Mahmoud."]] call bis_fnc_showNotification;   
"m_obj1" setmarkercolor "colorgreen";   
obj1 setTaskState "SUCCEEDED";   
ve1 = true; 

So i must remplace the third line by :

[[obj1,nil,nil,nil,SUCCEEDED,nil,false],"bis_fnc_setTask", true, true] call BIS_fnc_MP; 

?

For my Briefing, that should solve my problem i think. I knew that objectives was jip-compatible but this problem is irregular and curious...

Edited by LtAnderton159

Share this post


Link to post
Share on other sites

If you for some reson want bis_fnc_setTask to be executed on each client (+JIPs) and your trigger activates only on one of the clients then yes, but I think you need to use "bis_fnc_taskSetState" instead "bis_fnc_setTask", last one creates new task with given properties. There is also a somewhat simplier way to do it:

null = [{ obj1 setTaskState "SUCCEEDED";  }, "BIS_fnc_spawn", true, true] spawn BIS_fnc_MP;

But if your trigger activates on each machine (for example, trigger with BLUFOR Present condition) then it's dangerous to do so: it probably work with bis_fnc_taskSetState but if you call, say, bis_fnc_taskCreate, it might create playersCount2 tasks. In short, you don't need to call BIS_fnc_MP if some function will be called on each PC anyway or will have global effect (like bis_fnc_taskSetState, createVehicle etc).

So I don't understand why do you want to do that. When you call "bis_fnc_taskSetState" (it's not the same as setTaskState, take a look at "Tasks" category in Functions Viewer) as well as other similar functions you don't need to worry about other clients - the function will automatically update task's status on each client (JIPs too) and show a notification, so you don't need to call bis_fnc_showNotification or execute it on each PC explicitly.

For example, thats how I do it:

[group player, "task", ["Description", "Caption", nil], nil, "CREATED", 0] call bis_fnc_taskCreate;  //create task

["task", "SUCCEEDED"] call bis_fnc_taskSetState; //mark task as succeeded

Edited by Semiconductor

Share this post


Link to post
Share on other sites

After several trials, this code works perfectly. I have the notification and jip, in other configuration, it doesn't works.

null = [{ obj1 setTaskState "SUCCEEDED";  }, "BIS_fnc_spawn", true, true] spawn BIS_fnc_MP; 
["TaskSucceeded",["Neutraliser le colonel Mahmoud."]] call bis_fnc_showNotification;  
"m_obj1" setmarkercolor "colorgreen";  
ve1 = true; 

For the briefing, i solved my problem with this in the init :

waitUntil {!isNull player};
[] execVM "briefing.sqf"

Thx for the tip Johnson (the initiplayerlocal.sqf).

Semiconductor, i don't think use simply a function like bis_fnc_taskCreate is jip-compatible, like i said, it doesn't works in my trials. But maybe i'm wrong. However, i solve my problem with your solution :p Thx you. :)

Edited by LtAnderton159

Share this post


Link to post
Share on other sites

Hello !

I come back because i have one problem that i just found.

For update a state of an objectif, i put this in a trigger :

null = [{ obj1bis setTaskState "SUCCEEDED"; }, "BIS_fnc_spawn", true, true] spawn BIS_fnc_MP; ["TaskSucceeded",["Nettoyer site d'insertion."]] call bis_fnc_showNotification; "m_obj1" setmarkercolor "colorgreen"; ve1 = true; player setCurrentTask obj2;

It works for an objectif which was created in the briefing but if it was created during the game, it doesn't works.

i create objectif like that :

["obj1bis",west,["Nettoyer zone d'insertion.","Nettoyer zone d'insertion.","m_obj1"],(getMarkerPos "m_obj1"),"ASSIGNED",1,true,true] call BIS_fnc_setTask;

I don't know why.

Can you help me ?

Thanks you.

Share this post


Link to post
Share on other sites

Hello.

I solve my problem.

Creation of an objectif :

[player, "obj1bis", ["Nettoyer zone d'insertion.", "Nettoyer zone d'insertion.", "m_obj1"], objNull, true] call BIS_fnc_taskCreate;

Update of this objectif :

[["obj1bis", "Succeeded"],"BIS_fnc_taskSetState", true, true] call BIS_fnc_MP;

Update of an objectif which was created in the briefing :

null = [{ objx setTaskState "SUCCEEDED"; }, "BIS_fnc_spawn", true, true] spawn BIS_fnc_MP;
Edited by LtAnderton159

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  

×