Fr33d0m 11 Posted April 29, 2014 (edited) DOWNLOAD LINK TO .ZIP FRAMEWORK - HOSTED AT OUR NETWORK SITE: http://www.tmnclan.com/MP_JIP_Tasking_Framework.zip ^^ Download to follow along easier. You may also simply edit the fields you need to edit and use this as your framework directly. Hello Everyone! This post today is intended as a little guide to making a Linear storyline / objective MP missions that are JIP compatible. I developed this after having a LOT of trouble with the linear storyline missions I make, and when people JIP, they don't get a task. This JIP framework will also make it possible to create LONG linear storylines that mimic persistent battlefields, and combines with the ALiVE Module well, as you can play through a few objectives, leave, and come back to the same objectives the next day (As long as someone didn't come while you were gone and progress the storyline!!) Disclaimer: I'm not saying this is the best way, or even the RIGHT way to do this. I'm sure there are ways to optimize this framework, and I know it isn't really a FRAMEWORK if you're a serious programmer. It's more like a template. Whatever....You are FREE to take my core work here and add to it. All I ask is that you share your improvements with me, so I can enjoy them too :-) This tutorial is going to ATTEMPT to make things understandable for those who don't read/write ANY SQF, but without some basic knowledge of SQF this is gonna be pretty difficult, as pretty much all the task creation and triggering needs to be to via script or correctly using the BIS_fnc_MP function. Let's jump right into the How-To: Basic Idea: We are setting a Public Variable that changes to a new and unique value every time a mission script is ran. This variable is created and declared as the first player(s) join before the first mission starts. Once other players have joined, the late player is officially a JIP, and the script will evaluate that the PublicVariable indeed exists already, to then it finds out what the unique value of the PublicVariable is, and assigns the current task to the JIP player. First, we want to add to our init.sqf: execVM "initask.sqf"; Now every player that joins will be evaluated by the init task, which will use: if (isNil "missionStatus") then {execVM "initask1.sqf";}else{hint "Welcome, JIP Player...TMN JIP Module is locating the progression of the Game In Progress. Standby."; execVM "scripts\JIPhandle.sqf";}; To find out if the missionStatus PublicVariable has been created already by players starting the mission.If it hasn't, you get the prologue task in initask1.sqf, *****Jump into initask1.sqf****** //so, players that join at mission start should have this task. This task can be used to make a player see a CO or do something small prior to mission kick off, giving all players time to join before you have an icon to go somewhere. ******** // Use your imagination, you can assign any kind of task. THIS PROLOGUE TASK SHOULD HAVE THE SAME FIRST MISSION AS THE JIP USERS!! For example, as soon as players spawn, they need to do something like watch an intro, activate an action or trigger a trigger that executes the missions\mission1.sqf for the task. Otherwise, JIP players will JIP AHEAD of the players that started the mission, until they DO start that mission or someone completes the first mission. No prologue mission or intro? You can eliminate this totally by opening initask.sqf and pasting this instead: if (isNil "missionStatus") then {execVM "missions\mission1.sqf";}else{hint "Welcome, JIP Player...TMN JIP Module is locating the progression of the Game In Progress. Standby."; execVM "scripts\JIPhandle.sqf";}; ******** //For the first time, we are defining the publicVariable "missionStatus". From now on, every player who joins after this script is ran will do the JIPhandle script, not this one. missionStatus= 11; publicVariable "missionStatus"; //creating the "prologue" mission tasks M1 = player createSimpleTask ["Prologue"]; M1 setSimpleTaskDescription ["This is the initial mission for players who didn.t JIP.","Mission 1","Map Text Mission 1"]; M1 setSimpleTaskDestination (getMarkerPos "M1"); M1 setTaskState "Assigned"; player setCurrentTask M1; Otherwise, if it finds the variable DOES exists, then you MUST be a JIPper, and it handles you accordingly. ***so I'm a JIPper....now what?*** here's what JIPhandle.sqf is looking like: *****Jump into scripts\JIPhandle.sqf***** //Now we're at the JIPhandle scripts. This script takes each JIP player and //evaluates where the PublicVariable is at in global space, then executes //the right mission for the JP player based on that info. //Lt's let the player know he's being JIP handled: hint "JIP Manager is working...."; sleep 3.0; //The evaluation begins... checking current PublicVariable value of missionStatus and //figuring out which mission to run for JIPper. //To add a mission to the lineup, just copy my CASE format, and add a new number //(any number will work but 0 or 1 (because they are interpreted by the engine as True or false in this case.) switch (missionStatus) do { case 11: { execVM "missions\mission1.sqf" }; case 22: { execVM "missions\mission2.sqf" }; case 33: { execVM "missions\mission3.sqf" }; case 44: { execVM "missions\mission4.sqf" }; case 55: { execVM "missions\mission5.sqf" }; case 66: { execVM "missions\mission5.9.sqf" }; case 77: { execVM "missions\mission6.sqf" }; case 88: { execVM "missions\mission7.sqf" }; default { hint "Something went horribly wrong. Could not assign JIP task"; }; }; Remember the publicVariable we assigned as 11? Well, the JIPhandle.sqf script is using a simple "switch do" statement to evaluate the current mission as indicated by the last PV the players in game have already set, so if for example, the players complete the objective for mission 11 and publicVariable gets set to 22, when players JIP the misions2.sqf script gets ran: *****Jump into missions\mission2.sqf script ***** //This script gets executed via something in the map, like a trigger or an addAction [bIS_fnc_MP style] //Make sure if you call via BIS_fnc_MP that you set isPersistant to FALSE or every time a player JIPS //you will get your PublicVariable set back to the last mission that was executed via BIS_fnc_MP. //since mission 11 was complete, we can now set PublicVariable to mission= 22 missionStatus= 22; //Below is the line of code that actually send this out to other players. publicVariable "missionStatus"; //and now we can deal with the tasks assignment. mil1 setTaskState "Succeeded"; deleteVehicle docs1; sleep 2.0; M3 = player createSimpleTask ["Mission 3 Title"]; M3 setSimpleTaskDescription ["Mission 3 Description ","Mission 3 ","Mission Task Title"]; M3 setSimpleTaskDestination (getMarkerPos "Mission3MK"); M3 setTaskState "Assigned"; player setCurrentTask M3; sleep 20.0; hint "You may RTB to rearm and seek medical care at the infirmary."; sleep 6.0; hint ""; Players have already made it to mission 2 and missionStatus will now = value 22, because we changed it via the map activated trigger calling missions\mission2.sqf. SO now, when a player runs into scripts\JIPhandle.sqf it will know to execute the script that assigns the mission 2 task to the player when he joins, giving him the same task as the rest of the players are currently on! ********** On the mission side: Setting the PublicVariable. Each mission is separated on a different SQF script (This was the easiest way IMO). Every time a mission is completed, the next mission script gets activated via something in the map, like a trigger or an addAction [bIS_fnc_MP style] Make sure if you call via BIS_fnc_MP that you set isPersistant to FALSE or every time a player JIPS you will get your PublicVariable set back to the last mission that was executed via BIS_fnc_MP. From the README included in the ZIP above: You will need to call each script in the 2D editor via: 1) A trigger using the line: M1= execVM "missions\mission2.sqf"; Explanations: M1= this is a variable name, and is required to execute a VM from the trigger. Syntax rules. But it can be anything that means something to you. I use M1, stands for Mission 1 in my head. execVM "missions\mission2.sqf"; executes the mission2.sqf script inside of the missions folder as seen in your mission root folder (Where your mission.sqm is) 2) From within a script executed with the BIS_fnc_MP function. Example: ["missions\mission2.sqf","BIS_fnc_execVM",true,false] spawn BIS_fnc_MP; Explanation: This BIS_fnc_MP method executes the script on every client computer. 3) From an addAction executed with the BIS_fnc_MP function. Example: this addAction ["Collect Intel",{["missions\mission2.sqf","BIS_fnc_execVM",true,false] spawn BIS_fnc_MP;}]; Explanation: Normally ANYTHING executed via an AddAction is CLIENT SIDE ONLY, but executing the script like THIS makes is MP compatible! YAY BOHEMIA! Now since missionStatus was set to 22 by this mission2.sqf script, every player who JIPS from now on will get assigned mission 2 as indicated by the JIPHandle script executing that mission on the JIP clients computer when he joins. And it just goes on and on!! You can add as many linear story objectives as you want with this method, and will add JIP clients in the right place for the duration. Hope this helps! God bless! -Fr33d0m Edited April 29, 2014 by Fr33d0m added LINK to .ZIP Share this post Link to post Share on other sites
Helice 13 Posted May 7, 2014 Thanks for your framework/template. Downloaded and reading it. It is going to be useful in a mission i'm developing where you have to play 1-1,5 hour. JIP is needed but no experience here howto implement it. Thanks! Share this post Link to post Share on other sites
Fr33d0m 11 Posted May 20, 2014 Sorry late reply, seems I have logged in here numerous times and missed it! Glad the JIP framework can help you out! IF you need any further support with it, you can usually find me in my TS ( IP:63.209.37.190:9107) contact me anytime and hopefully I can answer any questions you may have. Thanks for your framework/template. Downloaded and reading it. It is going to be useful in a mission i'm developing where you have to play 1-1,5 hour. JIP is needed but no experience here howto implement it. Thanks! Share this post Link to post Share on other sites