shuko 59 Posted June 21, 2010 (edited) Features: - The script is server driven; all task additions and updates are called on server side. All changes are broadcasted to players in one array variable. This enables more work to be done only on server, since most of AI-related things happen there anyway. This way the number of triggers placed goes down, as they are unnecessary for clients (players). Number of publicvariabled variables goes down also. - Only one eventhandler is created instead of one per task. - As tasks are kept in an array, no global variable is created for each task. - No "call compile format" type of coding. - Variables used to check for task states and statuses are replaced with functions, cutting down number of global variables. - Usage simplified; briefings are easier to create, some parameters are made optional. Creating a briefing in init.sqf [[ ["Task1","Task1Title","Task1Desc"], ["Task2","Task2Title","Task2Desc",true,["markerTask2",getpos obj2]] ],[ ["Note1","Hello West",WEST], ["Note2","Hello East",EAST], ["Credits","Made by: Shuko of LDD Kyllikki<br />www.kyllikki.fi"] ]] execvm "shk_taskmaster.sqf"; Task Data ["TaskName","Title","Description",Condition,[Marker],"State",Destination] Required parameters: TaskName string Name used to refer to the task Title string Task name shown in the in/game task list Description string Task description, the actual text body Optional parameters: Condition boolean/side/faction/unit/group/string Units the task is added to. Default is everyone Marker array Marker related to the task. It will be created only for the units who have the task. Marker will be hidden after task is completed. Can be an array of marker arrays, if you want to create multiple markers. Name string Name of the marker to create. Position string Position of the marker. Type string Marker type. Optional, default is "selector_selectedMission". Color string Marker color. Optional, default is red. State string Task state of the newly created task. Default is "created". Destination object/position/marker Place to create task destination (game's built-in waypoint/marker). If an object is given, setSimpleTaskTarget command is used, attaching the destination to it. Condition (limiting the units to who the tasks and notes are created) Examples: [...,WEST] All playable units on BLUFOR (WEST) [...,"USMC"] Faction USMC [...,grpMarine1] Units that belong to group named grpMarine1 [...,myDude] Unit named myDude Then there is the IF syntax, so you can create a condition anyway you want, where _x is the unit (=player). Examples: "((group _x == grpScouts) OR (_x == pilot1))" Members of grpScouts and unit named pilot1 "(typeof _x == ""CDF_Soldier_Sniper"")" All CDF snipers TaskState The task state of the newly created task. Valid states are succeeded, failed, canceled and assigned. Default is assigned. Note Data [NoteTitle,NoteText,Condition] Required parameters: NoteTitle string Text shown in the list NoteText string The actual note text body Optional parameters: Condition boolean/side/faction/unit/group/string Units the note is added to. Default is everyone. Updating tasks Task states are updated by calling a function. Possible states are: succeeded/failed/assigned/canceled. Example: ["Task1","succeeded"] call SHK_Taskmaster_upd; It's possible to set state of one task and set another as assigned using an optional 3rd parameter. Example: ["Task1","succeeded","Task2"] call SHK_Taskmaster_upd; This will make task state of task Task1 to succeeded and the state of the task Task2 as current. Another optional 3rd parameter can be used to add a new task after updating another task. Example: ["Task1","succeeded",["Task2","Title","Desc"]] call SHK_Taskmaster_upd; This will make task Task1 as succeeded and create a new task Task2. Same set of parameters is used for the creation as in init.sqf or SHK_Taskmaster_add. Creating tasks during a mission Tasks can be added after briefing with the add function. Same set of parameters is used as in creating a briefing. The new task is set as current task automatically. Example: ["Task2","Extraction","Get to teh choppa!"] call SHK_Taskmaster_add; Functions SHK_Taskmaster_isCompleted This function can be used to check if a task is completed. Task is considered completed with states succeeded, failed and canceled. Function returns a boolean (true/false) value. Example: "Task1" call SHK_Taskmaster_isCompleted SHK_Taskmaster_getAssigned Returns list of tasks which have "assigned" as their state. Example: call SHK_Taskmaster_getAssigned Example result: ["Task1","Task4"] SHK_Taskmaster_getState Returns the task state (succeeded/failed/canceled/assigned/created). Example: "Task1" call SHK_Taskmaster_getState SHK_Taskmaster_hasState Checks if a task's state matches the given state. Function returns a boolean value. Example: ["Task1","succeeded"] call SHK_Taskmaster_hasState SHK_Taskmaster_hasTask Checks if a task with the given name has been created. Returns boolean. Example: "Task1" call SHK_Taskmaster_hasTask SHK_Taskmaster_addNote (client side only) Creates a briefing note. This can only be used on client side, and it's not boardcasted for other players. Parameters: ["Title","TextBody",Condition], Condition is optional. Example: ["Enemy forces","Oh noes, there will be enemy soldiers in the area of operation."] call SHK_Taskmaster_addNote Files shk_taskmaster.sqf Example mission I'm sure there are something to fix, add and change. Don't be afraid to ask for instructions, give feedback or report bugs. Edited March 12, 2011 by Shuko Share this post Link to post Share on other sites
galzohar 31 Posted June 21, 2010 I appreciate your effort and hope more people having problems with tasks/notes will use this. I think you may want to re-consider dropping support for single player and hosted servers, as many of the mission makers that would need this sort of script pack are also those that would be playing hosted small coops. If you use addPublicVariableEventHandler for the clients to update the tasks, then it shouldn't be very hard to update the tasks on the server as well every time the server runs a the appropriate publicVariable command. Another thing you may want to consider is recommending (and making it possible to) call compile preprocessFile the script from init.sqf or even a game logic so that adding tasks/notes by a script is possible even right off the bat, rather than getting an error that the functions are not yet defined. Or at least have some kind of initDone variable that you need to wait for before you try to use any functions. Share this post Link to post Share on other sites
Nielsen 10 Posted June 21, 2010 I think you may want to re-consider dropping support for single player and hosted servers, as many of the mission makers that would need this sort of script pack are also those that would be playing hosted small coops. I second that. This would be so priceless to me if it was not restricted to dedicated servers. Anyways. Great initiative with the rewrite. Grats. I only wish it was the script for me. Regards, Share this post Link to post Share on other sites
lexxer 11 Posted June 26, 2010 (edited) nice script however i am having a slight problem here is my init.sqf for the briefing: //briefings: [[ ["Task1","Scuttle the Terrorist ship.","Locate and destroy the ship.",true, "x1", "assigned"] ],[ ["Mission Briefing","blah blah blah.",WEST], ["Note2","Hello East",EAST], ["Credits","Made by: Me!"] ]] execvm "shk_taskmaster.sqf"; Now everything works...almost. It assigns the mission but there is no waypoint. I have a few add in tasks after this one and they all work as well...but no waypoints. (x1 is my marker btw). Also if possible, I would like a pause between finishing a mission and receiving the next one...any way to do that? Edited June 26, 2010 by Lexxer Share this post Link to post Share on other sites
shuko 59 Posted June 26, 2010 It doesn't create a task marker/waypoint (settaskdestination). It only shows/hides a marker (using setmarkeralphalocal) you have placed yourself. As for the pause, just use sleep between _upd and _add; Share this post Link to post Share on other sites
imutep 0 Posted June 26, 2010 Thx for the next taskmaster! Put it on our editing section at Assault Mission Studio. Taskmaster 2 by shk Share this post Link to post Share on other sites
W0lle 1050 Posted June 26, 2010 Nice to see you have a new version ready. But yes, please do not restrict it for dedicated server use only. If I play then on LAN with friends and for that we don't run a dedicated server. SP support would be nice but not really needed but Client/Server support is a must. :) Share this post Link to post Share on other sites
galzohar 31 Posted June 27, 2010 If a script supports both dedicated and hosted then it automatically supports SP as well in most cases anyway (since isServer always returns true both in single player and for the host in a hosted game). That is, as long as you make it teamswitch-compatible (aka create and update tasks and notes for all relevant playable units rather than just for the player unit). Share this post Link to post Share on other sites
lexxer 11 Posted July 1, 2010 Ok very wierd situation here. Ive placed a marker on the map called "x1". ive hidden it using your suggested method in the init fields of the units: "x1" setMarkerAlpha 0; It shows up fine when the maps starts using: in init.sqf: [[ ["Task1","blah.","blah",true, "x1", "created"] ],[ ["Mission Briefing","blah blah.",WEST], ["Note2","Hello East",EAST], ["Credits","Made by: me"] ]] execvm "shk_taskmaster.sqf"; However as soon as someone JIP's the marker disappears for anyone already connected and doesnt show for those JIP'ing. Share this post Link to post Share on other sites
BelgarionNL 10 Posted July 1, 2010 uhm! how the hell will i be able to test my missions? i don't have access to the dedi server 24/7 Share this post Link to post Share on other sites
shuko 59 Posted July 1, 2010 Dedi can be ran on same computer as client, so yes, you do have access to one 24/7. Share this post Link to post Share on other sites
lexxer 11 Posted July 1, 2010 So how do i hide a marker at the start? Hiding it in units init makes it disappear for everyone when they join.. Share this post Link to post Share on other sites
shuko 59 Posted July 1, 2010 I place invisible hpad and put this in the init: {_x setmarkeralphalocal 0} foreach ["marker1","marker2"] ---------- Post added at 12:32 AM ---------- Previous post was at 12:20 AM ---------- However as soon as someone JIP's the marker disappears for anyone already connected and doesnt show for those JIP'ing. setmarkeralphaLOCAL :) That way none of the changes get broadcasted for others. Share this post Link to post Share on other sites
lexxer 11 Posted July 2, 2010 Actually after some testing the invis helipad doesnt work either. As soon as someone JIP's the marker disappears for anyone in game. Share this post Link to post Share on other sites
BelgarionNL 10 Posted July 2, 2010 shk to bad you didn't make em compatible for dedi and not dedi XD guess i have to set up a dedi client! Share this post Link to post Share on other sites
shuko 59 Posted July 2, 2010 Well, if you are just after JIP update and not team/unit switch stuff, then you can give this a try: http://forums.bistudio.com/showpost.php?p=1661325&postcount=19 Share this post Link to post Share on other sites
lexxer 11 Posted July 3, 2010 So setmarkeralphaLOCAL still causes the same issue. Markers are hidden as soon as someone JIP's. Its driving me crazy. Everything works fine but I have to leave the ugly markers showing. Share this post Link to post Share on other sites
shuko 59 Posted July 3, 2010 I had some time to check it out, and the conclusion I came to is that since the client side was missing the common !isnull player check to wait for player to init, the marker showing command was ran too early. Tasks worked because they are added to each unit and are not dependent of player. Version 0.11 0.11 Fixed: Missed !isnull player check, which caused problems in marker handling. Share this post Link to post Share on other sites
lexxer 11 Posted July 4, 2010 (edited) Fixed that problem!! Thank you! edit: not fixed - markers still disappear on JIP...but more randomly :/ One more problem we found in testing: If you are dead awaiting respawn, no mission updates. Another bug: Popup message for completion and new mission works only on the tasks in the init.sqf - any tasks added during the mission gets no message. Edited July 5, 2010 by Lexxer Share this post Link to post Share on other sites
Franklin 0 Posted July 5, 2010 I'm having a bit of a problem with creating a task mid mission. this is my init.sqf portion in regards to the taskmaster. As far as i know this should all work, I haven't checked it using a dedi server yet. notice the "TCP" task and who its going to. [[ ["DestroyArmor","Destroy Armor","Armor",sf,"armor","assigned"], ["TCP","Operate TCP's","TCP",((group _x == squad1) && (group _x == squad2) && (group _x == squad3) && (group _x == squad4)),"tcp","assigned"], ],[ ["SF Notes","Remain in the hide on the hill and destroy the armored column with the javelins provided",sf], ["NINF Notes","Your platoon is operating traffic control points around a town in northern takistan, remain in your positions. Abandoning your posts without orders can cause total mission failure.",((group _x == squad1) && (group _x == squad2) && (group _x == squad3) && (group _x == squad4))] ]] execvm "shk_taskmaster.sqf"; Later during the mission I have a trigger setup so that when the SF group destroys an armored convoy, it triggers all kinds of fun stuff. A script goes off calling in a mortar strike near the SF guys, and forces them to move to a small nearby town for cover. I have the task update set for them to set the first task to succeeded and assign a new task telling them where to run. However I need to tell my infantry platoon that they no longer need to sit on their traffic control points, and now they need to rush to save the SF team before they are overwhelmed by the horde of enemies that are surrounding them. Its very important to me that this be done so that they cannot see the task pending, and that it just suddenly appears for them. this is the code i have in my trigger on act area: ["DestroyArmor","succeeded",["hide","Hide in Imarat","Move to Imarat and take cover in the buildings",sf,"imarat"]] call SHK_Taskmaster_upd; ["TCP","succeeded",["move","Move to Imarat","Support the SF unit",((squad1) && (squad2) && (squad3) && (squad4)),"imarat"]] call SHK_Taskmaster_upd; null=execVM "swarm.sqf"; deleteVehicle trigger1; deleteVehicle trigger2; deleteVehicle trigger3; deleteVehicle trigger4; I couldn't use the (group _x == squad1) because it said that was a local variable in a global space, how do work around this? Share this post Link to post Share on other sites
shuko 59 Posted July 5, 2010 When you use the special condition, you need to pass it as a string: "((group _x == squad1) || (group _x == squad2) || (group _x == squad3) || (group _x == squad4))" You need to use || (OR) not && (AND), since a unit can only be on one group. If your mission has squads 1-4 and sf, you can just use: "(group _x != sf)" to give task to all but sf. Share this post Link to post Share on other sites
Franklin 0 Posted July 5, 2010 thank you for that bit of info, solved a problem I didn't know i had yet. so Thanks. However my question was in regards to how to basically address the same groups (squads 1-4) to update a task and create a new one at the same time while using a trigger. I cant use the _x in the on act area of the trigger. would you recommend just setting the previous task to succeeded, and then call a separate script that has the new task creation in it? Share this post Link to post Share on other sites
shuko 59 Posted July 5, 2010 Fixed that problem!! Thank you! edit: not fixed - markers still disappear on JIP...but more randomly :/ Meh :/ Can't be that random really, find me a pattern. ;) One more problem we found in testing: If you are dead awaiting respawn, no mission updates. Hmm, yeah. Forgot all about that. Added alive player check to this new version. Another bug: Popup message for completion and new mission works only on the tasks in the init.sqf - any tasks added during the mission gets no message. I had commented out a line from the version 0.11. Still happening with 0.12? version 0.12 ---------- Post added at 07:38 PM ---------- Previous post was at 07:36 PM ---------- I cant use the _x in the on act area of the trigger. Well, now that the _x is inside a string, you can use it just fine. ;) Share this post Link to post Share on other sites
Franklin 0 Posted July 5, 2010 your the man... :notworthy: Share this post Link to post Share on other sites