Welcome, Guest Wednesday 23rd April 2014, 19:10:54
   Home   Help Search Login Register  

OFPEC Forum

Author Topic: MP compatible campaign, briefing etc.  (Read 425 times)
0 Members and 1 Guest are viewing this topic.
laggy
*
Offline Offline


"Behold a pale horse"


« on: 07 Apr 2011, 21:51:58 »

Hi all,

Does anyone have useful info or links on how to create a MP compatible campaign?
I'm NOT talking about basic campaign structure, only how to make it MP safe in terms of scripts/commands.
MP campaigns don't seem to follow the standard MP solutions.
A good start would be how to create a briefing on all players, Server AND Clients.

Found this: http://community.bistudio.com/wiki/Multiplayer_framework, but it is not very good  Roll Eyes

Thanks in advance,

Laggy
Logged

And I looked and beheld a pale horse and his name that sat on him was Death and Hell followed with him.
SaOk
Missions Depot Staff
*****
Offline Offline



WWW
« Reply #1 on: 23 Apr 2011, 10:51:52 »

The briefing should work quite normally, but you need to add waituntil-part to briefing.sqf:

Init.sqf:
Code:
_nul = [] execVM "briefing.sqf";

Briefing.sqf:
Code:
waitUntil {!isNull player};
task2 = player createSimpleTask [Localize "STR_T2H"];
task2 setSimpleTaskDescription [Localize "STR_T2", Localize "STR_T2H", Localize "STR_T2W"];
task2 setSimpleTaskDestination (getmarkerpos "UNm");
...

For "Join in Progress"-players you update the current task status(es) and add new tasks with:
Init.sqf
Code:
_nul = [] execVM "briefing.sqf";
if (isnil("Var2")) then {Var2=false;};
if (isnil("Var3")) then {Var3=false;};
if (isnil("VarOBJ2")) then {VarOBJ2 = 0;};
if (isnil("VarOBJ3")) then {VarOBJ3 = -1;};
if (local server) then {} else {_nul = [] execVM "History.sqf";};

History.sqf:
Code:
waitUntil {!isNull player};
//-1 not made, 0 created, 1 finished, 2 assigned, 3 failed
if (VarOBJ2==-1) then {};
if (VarOBJ2==0) then {};
if (VarOBJ2==1) then {task2 settaskstate "SUCCEEDED";};
if (VarOBJ2==2) then {player setCurrentTask task2;};
if (VarOBJ2==3) then {};

if (VarOBJ3==-1) then {};
if (VarOBJ3==0) then {
task3 = player createSimpleTask [Localize "STR_T3H"];
task3 setSimpleTaskDescription [Localize "STR_T3", Localize "STR_T3H", Localize "STR_T3W"];
task3 setSimpleTaskDestination (getmarkerpos "AAm");
player setCurrentTask task3;
        };
if (VarOBJ3==1) then {
task3 = player createSimpleTask [Localize "STR_T3H"];
task3 setSimpleTaskDescription [Localize "STR_T3", Localize "STR_T3H", Localize "STR_T3W"];
task3 setSimpleTaskDestination (getmarkerpos "AAm");
task3 settaskstate "SUCCEEDED";
};
if (VarOBJ3==2) then {};
if (VarOBJ3==3) then {};

First you need server logic placed on map. Then use publicVariables that are changed by server. E.g. when task is done:

A script for server to run (condition local server && this - e.g. "this" from seized area):
Code:
Var3=true; publicVariable "Var3";
VarOBJ3=0; publicVariable "VarOBJ3";
task3 = player createSimpleTask [Localize "STR_T3H"];
task3 setSimpleTaskDescription [Localize "STR_T3", Localize "STR_T3H", Localize "STR_T3W"];
task3 setSimpleTaskDestination (getmarkerpos "AAm");
player setCurrentTask task3;
sleep 5;
Var3=false; publicVariable "Var3";

For clients already in server a separate script (condition !(local server) && Var3):
Code:
task3 = player createSimpleTask [Localize "STR_T3H"];
task3 setSimpleTaskDescription [Localize "STR_T3", Localize "STR_T3H", Localize "STR_T3W"];
task3 setSimpleTaskDestination (getmarkerpos "AAm");
player setCurrentTask task3;

With VarOBJ3=true; publicVariable "VarOBJ3" then JIP-player have updated task data too.
« Last Edit: 23 Apr 2011, 11:51:44 by SaOk » Logged
laggy
*
Offline Offline


"Behold a pale horse"


« Reply #2 on: 23 Apr 2011, 15:25:36 »

Thanks a lot SaOk !

Will try it soon...

Laggy
Logged

And I looked and beheld a pale horse and his name that sat on him was Death and Hell followed with him.
SaOk
Missions Depot Staff
*****
Offline Offline



WWW
« Reply #3 on: 23 Apr 2011, 16:55:25 »

In case you want more MP-scripting hints from MP-rookie like me - I noticed (while creating that Battle of Zargabad Coop) that its better to leave all conditions (e.g. alive unitname, seized areas, everything...) for server and then make the server run a script where it sends a simple signal (VarNUM=true; publicVariable "VarNUM"Wink to clients to run their own script (condition: !(local server) && VarNUM ) with radiochatting, sounds, cameras, tasks, music type commands.
Logged
Pages: [1]   Go Up
  Send this topicPrint  
 
Jump to: