greywolf907 20 Posted January 26, 2015 So I have searched all over till my head hurts for a simple example of how to make this happen. I am making a co op missions where I have 10 objectives spread out on the map of Altis basically clear the towns as in Domination or Invade and Annex. What I need help with is setting it up so that the objective location and the task is produced randomly with a different town each time the map restarts and to where the tasks only shows the one assigned. Being able to make this Jip compatible as well I am using DAC to generate the AO's so then that creates another issue with how to make the DAC zone fire randomly with the random task. Would also like to know how to make a secondary objective within each zone. Any help would be greatly appreciated thanks. Share this post Link to post Share on other sites
jshock 513 Posted January 26, 2015 (edited) Easiest way is to have markers on all the possible locations and then something like this in a seperate "objective init" type file: _locations = ["mrk1","mrk2","mrk3"]; _objType = floor(random(11)); _rndLoc = _locations call BIS_fnc_selectRandom; switch (_objType) do { case 0: {[(getMarkerPos _rndLoc)] execVM "objective0Create.sqf"};//have your task be created in this file and other objective specific stuff created ... case 10: {[(getMarkerPos _rndLoc)] execVM "objective10Create.sqf"}; default {hintSilent "Objective not defined"}; }; Edited January 26, 2015 by JShock Share this post Link to post Share on other sites
greywolf907 20 Posted January 27, 2015 Thanks for the reply. I am not a script wizard so step by step instructions of how to do this would help allot as in a simple example of the objective0create.sqf and how to make them link with the DAC locations, triggers to end that objective and spawn the next Do I need a trigger at the start off the mission with something in the fields to make this happen? thanks. Share this post Link to post Share on other sites
jshock 513 Posted January 27, 2015 (edited) Quick example, as I don't know exactly what your going for, nor how any of the DAC stuff is called/works as I have never used it: //example objective0Create.sqf //call line being: [(getMarkerPos _rndLoc)] execVM "objective0Create.sqf"; _centerPos = (_this select 0); _tower = createVehicle ["Land_TTowerBig_2_F", _centerPos, [], 0, "NONE"]; //This is where any DAC stuff would go, assuming it can use the "_centerPos" to spawn stuff around waitUntil {!alive _tower}; hintSilent "Wooo, tower down!"; //next line restarts the "randomization" process for the next mission which has the switch statement and the rest as exampled above in post #2 0 = [] execVM "objectiveInit.sqf"; Edited January 27, 2015 by JShock Share this post Link to post Share on other sites
greywolf907 20 Posted January 27, 2015 Ok let me see if I have this right prob not :) So in the mission folder have a file named objectiveInit.sqf that has this inside? _locations = ["mrk1","mrk2","mrk3"]; _objType = floor(random(11)); _rndLoc = _locations call BIS_fnc_selectRandom; switch (_objType) do { case 0: {[(getMarkerPos _rndLoc)] execVM "objective0Create.sqf"};//have your task be created in this file and other objective specific stuff created case 1: {[(getMarkerPos _rndLoc)] execVM "objective1Create.sqf"}; case 2: {[(getMarkerPos _rndLoc)] execVM "objective2Create.sqf"}; case 10: {[(getMarkerPos _rndLoc)] execVM "objective10Create.sqf"}; default {hintSilent "Objective not defined"}; }; Then on the map have mkr1, mkr2, mkr3 For example objective0create.sqf inside I would have this? //example objective0Create.sqf //call line being: [(getMarkerPos _rndLoc)] execVM "objective0Create.sqf"; _centerPos = (_this select 0); _tower = createVehicle ["Land_TTowerBig_2_F", _centerPos, [], 0, "NONE"]; //This is where any DAC stuff would go, assuming it can use teh "_centerPos" to spawn stuff around waitUntil {!alive _tower}; hintSilent "Wooo, tower down!"; //next line restarts the "randomization" process for the next mission which has the switch statement and the rest as exampled above in post #2 0 = [] execVM "objectiveInit.sqf"; I'm sorry for being a script noob but for simplicity sake lets just say the mission is on Stratis with 3 markers for the locations to be then once I can get that to work I can hopefully put it to work in my larger mission. Thanks again jShock. Share this post Link to post Share on other sites
jshock 513 Posted January 27, 2015 Yeah just like that. One thing though, for the switch statement there has to be cases from 0 to 10, you can't skip around or you will get the default message a lot. To not worry about it, in the line that says "floor(random(11))" change the 11 to how ever many cases you have, so: case 0: {stuff}; case 1: {stuff}; case 2: {stuff}; case 3: {stuff}; //would be "floor(random(4))" case 0: {stuff}; case 1: {stuff}; case 2: {stuff}; case 3: {stuff}; case 4: {stuff}; case 5: {stuff}; case 6: {stuff}; case 7: {stuff}; //would be "floor(random(8))" Share this post Link to post Share on other sites
greywolf907 20 Posted January 27, 2015 K did that now since I still don't see any task pop up in the editor on my little test mission I made for this or a tower I assume that there is something else I need to put in the editor other than just 3 markers with the names mrk1, mrk2, mrk3 right? Or is there something else I need to write in the script? Share this post Link to post Share on other sites
jshock 513 Posted January 27, 2015 With the example I gave, there is not task made, if you added a scripted task in you may have it setup wrong/have a syntax error (post your script here if so). And to answer your question, in the end, no, all you should need are the markers. Share this post Link to post Share on other sites
greywolf907 20 Posted January 27, 2015 Lol I don't have any scripted task so I need to make one of those then right? Can you give me a simple example of one thanks. And I need to add a tower and name it or is that not right? Share this post Link to post Share on other sites
jshock 513 Posted January 27, 2015 (edited) I recommend using BIS_fnc_setTask to script the tasks out: https://community.bistudio.com/wiki/BIS_fnc_setTask So after the createVehicle line in "objective0Create.sqf" and before the waitUntil line put the following: [ "RadioTowerID", true, ["Destroy the tower by any means necessary.","Destroy Tower","Destroy Tower"], getPos _tower, "AUTOASSIGNED", 5, true, true ] call BIS_fnc_setTask; And then after the waitUntil line: ["RadioTowerID","Succeeded"] call BIS_fnc_taskSetState; Edited January 27, 2015 by JShock Share this post Link to post Share on other sites
greywolf907 20 Posted January 27, 2015 So I am looking at the https://community.bistudio.com/wiki/BIS_fnc_setTask link not sure if I need to make a discription.ext to write the stuff in or where do I put it? Share this post Link to post Share on other sites
jshock 513 Posted January 27, 2015 It's native to the game, it's Bohemia Interactive's function (hence BIS in front), no need to include it anywhere (except when you use it in a script to make a task of course :p). Share this post Link to post Share on other sites
greywolf907 20 Posted January 27, 2015 Ok so I need to make a task1.sqf and inside have something like this? [task#1, Boolean, mrk1, (dest, ASSIGNED, priority, showNotification, isGlobal)] call BIS_fnc_setTask; Blaaww I'm lost here man. Share this post Link to post Share on other sites
greywolf907 20 Posted January 27, 2015 Ok so after I searched a bit I think I have it figured out for the tasks I hope anyway. This is what I have inside the Init.sqf enableSaving [false,false]; execVM "briefing.sqf"; Inside briefing.sqf waitUntil { !isNil {player} }; waitUntil { player == player }; switch (side player) do { case WEST: // BLUFOR briefing goes here { player createDiaryRecord ["Diary", ["*The Note Title*", "*The Note Message*"]]; //Task1 - COMMENT task_1 = player createSimpleTask ["TASKNAME"]; task_1 setSimpleTaskDescription ["TASK DESCRIPTION","Example Task","WHAT WILL BE DISPLAYED ON THE MAP"]; task_1 setSimpleTaskDestination (getMarkerPos "mrk1"); //Task2 - COMMENT task_2 = player createSimpleTask ["TASKNAME"]; task_2 setSimpleTaskDescription ["TASK DESCRIPTION","Example Task","WHAT WILL BE DISPLAYED ON THE MAP"]; task_2 setSimpleTaskDestination (getMarkerPos "mrk2"); //Task2 - COMMENT task_3 = player createSimpleTask ["TASKNAME"]; task_3 setSimpleTaskDescription ["TASK DESCRIPTION","Example Task","WHAT WILL BE DISPLAYED ON THE MAP"]; task_3 setSimpleTaskDestination (getMarkerPos "mrk3"); }; case EAST: // OPFOR briefing goes here { }; case RESISTANCE: // RESISTANCE/INDEPENDENT briefing goes here { }; case CIVILIAN: // CIVILIAN briefing goes here { }; }; I just left the details blank for now to see if it works but on missions start I have all 3 tasks showing none assigned then of course if I set assign as current task in will set it. But no random and I don't want to see all of them on the map just the current task please help. Share this post Link to post Share on other sites
jshock 513 Posted January 27, 2015 It's because your creating all the tasks on mission start, you need to create them in each of the objective#Create.sqfs that way it's only created after it's all randomized. I gave an example of where to do it with BIS_fnc_setTask with pretty simple implementation instructions a few posts up. Share this post Link to post Share on other sites
greywolf907 20 Posted January 27, 2015 Ok so I did what you said to inside objective0create.sqf and the other 2 objective1create.sqf, and objective2create.sqf I put this //example objective0Create.sqf //call line being: [(getMarkerPos _rndLoc)] execVM "objective0Create.sqf"; _centerPos = (_this select 0); _tower = createVehicle ["Land_TTowerBig_2_F", _centerPos, [], 0, "NONE"]; //This is where any DAC stuff would go, assuming it can use the "_centerPos" to spawn stuff around [ "RadioTowerID", true, ["Destroy the tower by any means necessary.","Destroy Tower","Destroy Tower"], _centerPos, "AUTOASSIGNED", 5, true, true ] call BIS_fnc_setTask; waitUntil {!alive _tower}; ["RadioTowerID","Succeeded"] call BIS_fnc_taskSetState; hintSilent "Wooo, tower down!"; //next line restarts the "randomization" process for the next mission which has the switch statement and the rest as exampled above in post #2 0 = [] execVM "objectiveInit.sqf"; But I need to fully understand the task script to make it work because it doesn't do anything by itself like it is right. I know this is just basic stuff for you but never have done a task script only using the modules for tasks it's not just like I can write one up. What do I name the document in the mission folder tasks.sqf? And what do I add inside for the code? Also I'm not understanding what all the tower references are supposed to do is it supposed to spawn a radio tower on the marker and where you wrote this is where any DAC stuff would go where exactly on this line are you referring to? _tower = createVehicle ["Land_TTowerBig_2_F", _centerPos, [], 0, "NONE"]; //This is where any DAC stuff would go, assuming it can use the "_centerPos" to spawn stuff around What is leading each objective#create to the markers on the map since they are all the same how does it know where to put the task? Thanks for your patience man it's a learning process for me here. ---------- Post added at 01:00 PM ---------- Previous post was at 12:42 PM ---------- Ok I see from the BIS fnc setTask page that you have created a task with the lines you gave me but as is in the editor nothing happens no task ever pops up or even shows at all what am I doing wrong here? Share this post Link to post Share on other sites
jshock 513 Posted January 27, 2015 The createVehicle command returns the new object that has spawned so "_tower" is an object now spawned in game so we can use it as a reference to find it's position, whether or not it's destroyed, and other such information. Where I say "use DAC stuff here", that is where you would put all your call's to the DAC functions, like I said I've never used DAC so I don't know exactly how it's used/called. And for the rest, hopefully seeing it all together and working may help, so I put together an example mission. It has a player character and three markers in the editor, markers are named mrk1, mrk2, and mrk3. There is the init.sqf file which executes the objectivesInit.sqf which gives you all the randomization in the location and objective type, location is based on the marker position, which is then sent into one of the objective#Create.sqfs so it can use the marker's position to make the tower and the task destination. Currently all of the objective#Create.sqfs do the same objective (destroy the tower, for example purposes). https://www.dropbox.com/s/nrd6s2dyuexisob/task_example.Stratis.zip?dl=0 Share this post Link to post Share on other sites
greywolf907 20 Posted January 27, 2015 Thanks man I made some proggress since my last post in the init.sqf I put execVM "objectiveInit.sqf"; that little tidbit made a whole lot of difference lol duh right. I will grab you mission I'm sure that will sort out the rest Thanks again man. ---------- Post added at 02:44 PM ---------- Previous post was at 02:40 PM ---------- So this is what I put in the first objective everything works but after destroying the tower it respawns in the same spot again. //example objective0Create.sqf //call line being: [(getMarkerPos _rndLoc)] execVM "objective0Create.sqf"; mrk1 = (_this select 0); t1 = createVehicle ["Land_TTowerBig_2_F", mrk1, [], 0, "NONE"]; //This is where any DAC stuff would go, assuming it can use the "_centerPos" to spawn stuff around [ "task1", true, ["Destroy the tower by any means necessary.","Destroy Tower","Destroy Tower"], mrk1, "AUTOASSIGNED", 5, true, true ] call BIS_fnc_setTask; waitUntil {!alive t1}; ["task1","Succeeded"] call BIS_fnc_taskSetState; hintSilent "Wooo, tower down!"; //next line restarts the "randomization" process for the next mission which has the switch statement and the rest as exampled above in post #2 0 = [] execVM "objectiveInit.sqf"; Share this post Link to post Share on other sites
jshock 513 Posted January 27, 2015 It should be random (FYI you didn't need to change anything from my examples, like the variables and such), so there is still an off chance that it will do the same position twice in a row (especially with only 3 possible locations). Also make sure that the "_locations" variable in objectivesInit.sqf has all of the marker names for each of your locations, if there is only one there, it will only spawn in that one spot. Share this post Link to post Share on other sites
greywolf907 20 Posted January 28, 2015 Oh yeah I see that I did not need to change anything after looking at your example mission. The tower did spawn in one place twice but like you said prob because of only 3 markers so I would need some kind of trigger to end the cycle or it just keeps going forever right? This works like a champ Thanks a bunch for walking me through it now just need to figure out how to link this to my DAC zones and make them spawn with these objectives. Since this is a drop the tower objective how would I make this the secondary objective and the primary objective to clear all enemy from the town or location area? Share this post Link to post Share on other sites
jshock 513 Posted January 28, 2015 (edited) Since this is a drop the tower objective how would I make this the secondary objective and the primary objective to clear all enemy from the town or location area? Try the following alteration to objective0Create.sqf, make sure that enemies are spawned in above the creation of the "_clearTask" line: //example objective0Create.sqf //call line being: [(getMarkerPos _rndLoc)] execVM "objective0Create.sqf"; _centerPos = (_this select 0); //This is where any DAC stuff would go, assuming it can use the "_centerPos" to spawn stuff around _clearTask = [ "ClearID", true, ["Clear the area by any means necessary.","Primary: Clear Area","Clear Area"], _centerPos, "AUTOASSIGNED", 6, true, true ] call BIS_fnc_setTask; _trigger = createTrigger ["EmptyDetector",_centerPos]; _trigger setTriggerActivation ["EAST","NOT PRESENT",false]; _trigger setTriggerArea [300,300,0,false]; _trigger setTriggerStatements ["this",format ["[%1,'Succeeded'] call BIS_fnc_taskSetState",_clearTask],""]; _tower = createVehicle ["Land_TTowerBig_2_F", _centerPos, [], 0, "NONE"]; _towerTask = [ "RadioTowerID", true, ["Destroy the tower by any means necessary.","Secondary: Destroy Tower","Destroy Tower"], getPos _tower, "AUTOASSIGNED", 5, true, true ] call BIS_fnc_setTask; _towerCompleted = [_tower,_towerTask] spawn { waitUntil {!alive (_this select 0)}; [(_this select 1),"Succeeded"] call BIS_fnc_taskSetState; }; waitUntil {([_clearTask] call BIS_fnc_taskState isEqualTo "Succeeded") && {scriptDone _towerCompleted}}; 0 = [] execVM "objectiveInit.sqf"; EDIT: Oh, and another thing make sure to go into your Steam Startup Parameters and enable -showScriptErrors, because most the code I'm giving you is untested and may have small errors. Edited January 28, 2015 by JShock Share this post Link to post Share on other sites
jandrews 116 Posted January 28, 2015 sounds like an invade and annex mission. Share this post Link to post Share on other sites
jshock 513 Posted January 28, 2015 sounds like an invade and annex mission. Basically is, just overly simplified :p. Share this post Link to post Share on other sites
greywolf907 20 Posted January 28, 2015 Same type of objectives to start but trying to get the basics down then I will change them up. Invade and Annex has way to much crap in it and all the restrictions they love to put in causes a bunch of lag for people kind of takes the fun out of it, my mission is challenging and yet still enjoyable to play by simplifying it to where only one AO is active at a time and not all the rest of the junk put into the mission cuts out a bunch of chop for people. I already have the mission made but with task modules to fire the DAC zones so to eliminate all the sync lines on the map and streamline it I would like all the tasks and objectives to fire within scripts. Lucky for me jShock has been patiently guiding me through how to do some things. Share this post Link to post Share on other sites