Nielsen 10 Posted June 22, 2010 I've been looking through the wiki, forums and BIS modules and functions .pbo's. I simply can not figure out how to create a simple task for players with remote execution (through the MP Framework). I can change a (normal/local) created task just fine with e.g. _nic = [nil,player,"loc"+"per",rsetTaskState,tskobj1,"SUCCEEDED"] call RE; . But despite all my trial and error, I can not get the rCreatesimpleTask command to work. :( Would anybody please give me an example of a command line that creates a task through remote execution? Pretty please with sugar on the top Share this post Link to post Share on other sites
st_dux 26 Posted June 22, 2010 What have you tried already? Also, why are you using the "loc" parameter? Share this post Link to post Share on other sites
Nielsen 10 Posted June 22, 2010 Thanks for responding! Yeah, I should have wrote what I have tried. But it seems no matter what I do, I keep getting an error that: BIS_missionSope is nil. I have tried so many different variations that I cant remember them all. I have tried simple lines that look like what I have working e.g.: _nic = [nil,player,"per",rCreateSimpleTask,tskobj1,"TEST"] call RE; I have also tried replacing player with taskobj back and forth in my variations. The closest I have come to an answer is this command ind the BIS mission .pbo. _nic = [objNull, BIS_Cooper, "per", rCREATETASKSET, "objEvidence", [localize "init.sqf_8", localize "init.sqf_9_0", ""]] call RE; I have tried to modify this a lot, but get the same error (BIS_missionscope is nil). I could not figure out what the init.sqf_8 (etc.) was reffering to. Also, I do not know what CreateTaskSet is or does, so I dont know how it differs in execution from rCreatesimpleTask. Regarding the "loc", I dont use it. I just pasted a command line that I have had working. I guess I wouldnt use the "loc" when setting it up in a mission. It is really the "per" I'm interested in with these commands. Share this post Link to post Share on other sites
st_dux 26 Posted June 22, 2010 It sounds like the remote execution scripting for createSimpleTask was designed with BIS custom variables in mind. As I don't have access to my ArmA 2 game files at the moment, I can't say for sure what's going on, but you might want to look into the RE scripts yourself. Alternatively, try creating some variable called BIS_missionScope in your mission to see what happens. It won't be nil anymore, but it will probably show a different error, which might be useful in solving the issue. If all else fails, there are other ways to make task creation JIP-friendly, since I presume that's what you're aiming for with this. Share this post Link to post Share on other sites
Nielsen 10 Posted June 22, 2010 I have tried to look through the scriptingcommands in the modules .pbo. But it does not make a lot of sense to me. I'm learning to script, getting better by the hour, but I'm not well versed enough to wrap my head around deep code bloks and complex command structures. I am trying though... I am not at my own rig atm, but when I get home, I will try to set the BIS_missionscope and post the error here. I does seem to be an effect of wrong syntax however. I have recieved the same error with the rSetTaskState command before I got it to work. I tried: [nil,TskObj1,"per",rSettaskState,"Succeeded"] call RE; And got the error. With the correct command (listed in my op) it works like a charm. So I feel that if I just get the right syntax, it should work. I just can't decipher it. You are correct in your assumption. All I'm trying to do is make my tasks JIP compatible. But every other way I have tried have failed. I figured the build-in BIS functions should work, if I can get them to work in the first place. I have tried double-triggers w. PublicVariables, and the TaskMaster script. Nothing seems to work for me, despite reading every post I can find on the matter. I have described my (failed) efforts to make my missions JIP-compatible here. Any help in making my tasks JIP compatible would be so greatly appreciated! Share this post Link to post Share on other sites
shuko 59 Posted June 22, 2010 I just tested this with a friend, worked fine: doubletrigger.rar Share this post Link to post Share on other sites
Nielsen 10 Posted June 23, 2010 @ST Dux: Well now it gets kinda weird. I tried to set the BIS_missionscope in the init.sqf and it seems to work (kinda). The command: [player,nil,"per",rCreateSimpleTask,"tskobj1"] call RE; Now created a task, and I got no error about BIS_missionscope. This kinda freaks me out, since it does not seem to matter what BIS_missionscope is, as long as it is not nil. Both BIS_missionscope = true / = false / = 1, yielded the same result. I get the task. This would seem to be all good and problem solved, BUT. When the task is created my other tested commands stop working. If I create a task normally (tskobj1 = Player Createsimpletask), I can update it with: [nil,player,"per",rsetTaskState,tskobj1,"SUCCEEDED"] call RE; But when i create it with remote execution, the above command no longer works, and I can not rSettaskstate. At least not with the command that worked for me before. So two steps ahead, and one step back I guess. Any thoughts? @Shk: Thanks for your input, and taking the time to post me a demonstration. My problem however, is not that the double trigger method does not work at all. The problem is that it seems to be unreliable. Your example relies on the PV's getting sent to the player on JIP. This works fine as long as you only get one PV from the server. The problem is that I got multiple (8) tasks, that are all created and completed via this method. The engine does not seem to take to kindly to all these PV's sent. Some, but not all tasks are correctly updated when joining. I've tried to correct it, by only making the variables public onplayerconnected, to make sure that they were recieved in the right order, and use 'sleep' so that the first variable/trigger has time to createsimpletask before the second comes in and SettaskState. This seem to create much more consistent/correct task updates on JIP, but it is still not totally reliable. When testing, sometimes all tasks are updated to completed, sometimes one or two are stuck at created. I simply do not understand why. It makes no sense to me. Another thing is, that even if the above worked, it would still leave the issue of all the variables being public after the onplayerconnected script has run. And as I said, all those (16) PV's seems to somehow, mess up the system. Or have I missed something? I really appreciate both of you taking the time to help me out. Share this post Link to post Share on other sites
shuko 59 Posted June 23, 2010 Since this topic title points at the MPF, I added my reply to your older, more generic, post: http://forums.bistudio.com/showpost.php?p=1656864&postcount=3 Share this post Link to post Share on other sites
st_dux 26 Posted June 23, 2010 @Nielsen: I'm really not sure, since I haven't looked at how the RE function actually works, but from that result I'd assume that BIS_missionscope plays an important role. Setting it to something random almost certainly isn't a viable solution; while it is making it work in your SP test, it probably wouldn't actually function the way it's supposed to in an MP environment. See if you can find the part about rCREATESIMPLETASK in the script found in the modules pbo. Post it in this thread, and I'll do my best to interpret it. Share this post Link to post Share on other sites
Nielsen 10 Posted June 23, 2010 I really appreciate the help guys! @shk: Good point. I will respond in the other thread. See if you can find the part about rCREATESIMPLETASK in the script found in the modules pbo. Post it in this thread, and I'll do my best to interpret it. Right. I have looked at the scripts again, and I feel like I almost understand it. I just cant wrap my head around it. It is hard to pick the important lines of the script, as it all seems kinda important. I'll post the full script in a spoiler below. It aint that long. But here is a comment in the script that seems vital information. createSimpleTask.sqf snipit ///[] spawn {" \n " _nic = [player, objNull, rCREATESIMPLETASK, ""obj7""] call RE; /// init = /*%FSM<STATEINIT""">*/"_nic = [objNull, objNull, rSETTASKSTATE, BIS_missionScope getVariable ""obj0"", ""Succeeded""] call RE;" \n "" \n The editor wont accept the _nic = [player, objNull, rCREATESIMPLETASK, ""obj7""] call RE; It says "Missing ]". If I remove the double "" so it only says "obj7" - it will work as before. Further down in the script it says: if (isNil "BIS_missionScope") exitWith {hint "ERROR: BIS_missionScope is nil";textLogFormat["ERROR: MPF_rCREATESIMPLETASK calls fails - no BIS_missionScope logic"];}; if (alive BIS_missionScope) then {BIS_missionScope setVariable [_taskName+"TaskArray", _taskArray]}; if (alive BIS_missionScope) then {BIS_missionScope setVariable [_taskName+"Objects", _taskArrayObjects]}; if (alive BIS_missionScope) then {BIS_missionScope setVariable [_taskName, _taskArray select 0]}; //last created task is stored in variable Does the "alive BIS_missionscope" mean that I should create a gamelogic with that name perhaps? Here is the full script: scriptName "MP\data\scriptCommands\createSimpleTask.sqf"; private ["_caller","_target","_taskName","_group","_taskArray", "_newTask"]; _caller = _this select 0; _target = _this select 1; _taskName = _this select 2; ///[] spawn {" \n " _nic = [player, objNull, rCREATESIMPLETASK, ""obj7""] call RE; /// init = /*%FSM<STATEINIT""">*/"_nic = [objNull, objNull, rSETTASKSTATE, BIS_missionScope getVariable ""obj0"", ""Succeeded""] call RE;" \n "" \n ///[] spawn {" \n " _nic = [bIS_Cooper, objNull, rCREATESIMPLETASK, ""obj7""] call RE; _group = group _caller; if (!isNil "BIS_DEBUG_MPF") then { textLogFormat["MPF_rCREATESIMPLETASK %1 group %2", _caller, _group]; }; _taskArray = []; _taskArrayObjects = []; //objects that has this task assigned { /* if (!isNil "BIS_DEBUG_MPF") then { textLogFormat["MPF_rCREATESIMPLETASK setting for: %1 isPlayer: %2", _x, isPlayer _x]; }; */ _newTask = _x createSimpleTask [_taskName]; _taskArray = [_newTask] + _taskArray; _taskArrayObjects = _taskArrayObjects + [_x]; } foreach units _group; if (!isNil "BIS_DEBUG_MPF") then { textLogFormat["MPF_rCREATESIMPLETASK _taskArray %1", _taskArray]; textLogFormat["MPF_rCREATESIMPLETASK _taskArrayObjects %1", _taskArrayObjects]; }; if (isNil "BIS_missionScope") exitWith {hint "ERROR: BIS_missionScope is nil";textLogFormat["ERROR: MPF_rCREATESIMPLETASK calls fails - no BIS_missionScope logic"];}; if (alive BIS_missionScope) then {BIS_missionScope setVariable [_taskName+"TaskArray", _taskArray]}; if (alive BIS_missionScope) then {BIS_missionScope setVariable [_taskName+"Objects", _taskArrayObjects]}; if (alive BIS_missionScope) then {BIS_missionScope setVariable [_taskName, _taskArray select 0]}; //last created task is stored in variable //BIS_newTask = _caller createSimpleTask [_taskName]; //if (alive BIS_missionScope) then {BIS_missionScope setVariable [_taskName, BIS_newTask]}; Share this post Link to post Share on other sites
st_dux 26 Posted June 24, 2010 Does the "alive BIS_missionscope" mean that I should create a gamelogic with that name perhaps? It's worth a shot. Share this post Link to post Share on other sites
Nielsen 10 Posted June 24, 2010 Allright. I tried to include a gamelogic with the name BIS_missionScope. I then removed the part where I defined BIS_missionSope in the init.sqf. The result was interesting. When I try to rCreateSimpleTask I get the task, but is not able to update it - just like before when I set BIS_missionScope in the init.sqf. But now I get an error: Taskarray not defined in BIS_missionScope. In addition I just found this in a campaign mission initJIPcompatible.sqf: BIS_missionScope setVariable ["statusFyodor", "neutral"]; BIS_missionScope setVariable ["nikitinDead", FALSE]; BIS_missionScope setVariable ["mainObjsCompleted", 0]; BIS_missionScope setVariable ["metGalkina", FALSE]; if (isNil {BIS_missionScope getVariable "CHBasePos"}) then {BIS_missionScope setVariable ["CHBasePos", 1]}; BIS_missionScope setVariable ["sentryPoints", [ BIS_chedSentry1, BIS_chedSentry2, BIS_chedSentry3, BIS_chedSentry4, BIS_chedSentry5, BIS_chedSentry6 ] ]; BIS_missionScope setVariable ["sentryMarkers", [ "BIS_chedSentry1", "BIS_chedSentry2", "BIS_chedSentry3", "BIS_chedSentry4", "BIS_chedSentry5", "BIS_chedSentry6" ] ]; I dont really understand how it all ties together. Any thoughts? Share this post Link to post Share on other sites