Jump to content
Sign in to follow this  
Nielsen

Problem with JIP: PublicVariables and MP Framework not working.

Recommended Posts

Instead of expecting us to be clairvoyant, just post the whole init.sqf right away.

Share this post


Link to post
Share on other sites

init.sqf:

0 fadeSound 0;
10 fadeSound 1;

// Loadingtext
if (time < 10) then
{
   titleCut ["", "BLACK FADED", 999];
   [] Spawn {
       waitUntil{!(isNil "BIS_fnc_init")};

       // Info text
       [str("Operation: Eagle Claw") , str(date select 2) + "." + str(date select 1) + "." + str(date select 0), str("By Wiggum")] spawn BIS_fnc_infoText;

       sleep 10;

       titleCut ["", "BLACK IN", 8]
   };
};

PAPABEAR=[West,"HQ"];

[color="RoyalBlue"]nul=execVM "briefing.sqf";[/color]

{ _x setVariable ["BIS_noCoreConversations", true] } forEach allUnits;

nul=execVM "random.sqf";
host attachTo [z1,[0,0,0]];
host2 attachTo [z1,[0,0,0]];
showTheCarAction = true; publicvariable "showTheCarAction"

null = [getMarkerpos "civ1", 220, 320] execVM "AreaMarker2.sqf";
onMapSingleClick "Player setPos _pos";

player createDiaryRecord["Diary", ["OPFOR", "Mostly weary insurgents that dont have NVG's or any heavy weapons. You should know what you can expect from them."]];
player createDiaryRecord["Diary", ["BLUFOR", "TEAM EAGLE = Your team.<br/>CROSSROAD = The HQ.<br/>HAWK = The extraction chopper."]];
player createDiaryRecord["Diary", ["Mission", "You will lead Team EAGLE in this mission. We will insert you and your team about 04:15 in the morning <marker name='1'>here</marker>. The helicopter will fly back to the US-Base and wait for you to call for extraction. The insurgents will maybe hear the helicopter, but because its so early in the morning they should be somewhat surprised by our attack. You have to attack fast, give them no chance to kill the hostage."]];
player createDiaryRecord["Diary", ["ROE", "There are still civilians in Ravanay, so there will be no fire support available."]];		
player createDiaryRecord["Diary", ["Situation", "A few hours ago a Jeep driving through the desert was ambushed by local insurgents. One person in this Jeep was the US Journalist Andy Bush. The insurgents took him hostage. Our Intel is sure that they brought him to <marker name='civ1'>Ravanay</marker>."]];
player createDiaryRecord["Diary", ["Important Note", "To free the Journalist use your Action Menu.<br/>To call the extraction chopper (Hawk) use your radio.<br/>Only the leader can call the helicopter.<br/>You cant call the extraction chopper if you are to far away from the LZ.<br/>Stay at the LZ and wait for the extraction chopper, dont expect the chopper to pick you up somewhere else."]];

briefing.sqf:

SHK_createTask = { // "name" call SHK_createTask
 if isserver then {
   SHK_Jiptasks set [count SHK_Jiptasks,_this];
   publicvariable "SHK_Jiptasks";
 };
 if !isdedicated then {
[color="Magenta"]    /* -- add extra tasks below -- */
   switch _this do {
case "test1": {
       taskTest1 = player createSimpleTask ["test1"]; 
       taskTest1 setSimpleTaskDescription ["knock down a radar","radar",""];
       taskTest1 setTaskState "Assigned"; 

     };[/color]
   };
 };
};
SHK_updateTask = { // ["name","state"] call SHK_updateTask
 if isserver then {
   SHK_Jiptasks set [count SHK_Jiptasks,_this];
   publicvariable "SHK_Jiptasks";
 };
 if !isdedicated then {
   call compile format ["task%1 settaskstate ""%2""",(_this select 0),(_this select 1)];
 };
};
private "_jip";
_jip = false;
if isserver then {
 SHK_Jiptasks = []
} else {
 if (isnull player) then { _jip = true };
};
if !isdedicated then {
 _jip spawn {
   waitUntil {!isnull player};

[color="RED"]    /* -- add briefing tasks below -- */
task3 = player createsimpletask["Extraction"];
task3 setSimpleTaskDescription["Go back to the LZ and call 'Hawk' for extraction. Make sure that the Insurgents are not able to enage the extraction chopper !", "Extraction", "Extraction"];
task2 = player createsimpletask["Rescue the Journalist"];
task2 setSimpleTaskDescription["We know that the captured Journalist is in Ravanay. It is your primary objective to rescue him !", "Rescue the Journalist", "Rescue the Journalist"];
task1 = player createsimpletask["Secure LZ"];
task1 setSimpleTaskDescription["Secure the LZ, our UAV's currently report that the area around the LZ is clean. However you should still be careful !", "Secure LZ", ""];
player setCurrentTask task1;			
   /* -- add briefing tasks above -- */[/color]

   if _this then {
     waituntil {!isnil "SHK_Jiptasks"};
     {
       switch (typename _x) do {
         case (typename ""): { _x call SHK_createTask };
         case (typename []): { call compile format ["task%1 settaskstate ""%2""",(_x select 0),(_x select 1)] };
       };
     } foreach SHK_Jiptasks;
   };
 };
};

The extra tasks work !

I can create them and update them.

The Briefing tasks are created but not updated at all, thats my problem.

And should there be Task-Hints ?

I dont see them, would it be possible to have them with your script ?

Thanks for your help !

Share this post


Link to post
Share on other sites

Since the script creates global variables, I made it add "task" infront of the given task name. So, if you are planning on using names like task1, task2, task3, you need to create the tasks as tasktask1, tasktask2, tasktask3. As you can see, your extra task is actually names taskTest1. ;)

I usually give my tasks an actual name instead of a number. It makes the variable names more logical and easier to remember when updating. For example, instead of having "task1", "task2" and "task3", you could have "secure", "rescue" and "extraction".

Share this post


Link to post
Share on other sites

Great, now it works ! :)

Now the only thing i need to be perfect happy are the Task Hints like in the campaign. How do i have to execute them so all players get them ?

Share this post


Link to post
Share on other sites

Latest version with hints:

SHK_createTask = { // "name" call SHK_createTask
 if isserver then {
   SHK_Jiptasks set [count SHK_Jiptasks,_this];
   publicvariable "SHK_Jiptasks";
 };
 if !isdedicated then {
   /* -- add extra tasks below -- */
   switch _this do {
     case "gohome": {
       taskGoHome = player createSimpleTask ["gohome"]; 
       taskGoHome setSimpleTaskDescription ["Time to go <marker name='mGoHome'>home</marker>.","Home",""]; 
       taskGoHome setTaskState "Assigned";
       player setcurrenttask taskGoHome;
       "mGoHome" setmarkeralphalocal 1;
     };
   };
   /* -- add extra tasks above -- */
   if !SHK_Jiptasks_JIP then {
     call compile format ["task%1 call SHK_showTaskHint",_this];
   };
 };
};
SHK_showTaskHint = { // Task call SHK_showTaskHint
 private "_p";
 _p = switch (tolower(taskstate _this)) do {
   case "created": { [localize "str_taskNew", [1,1,1,1], "taskNew"] };
   case "current": { [localize "str_taskSetCurrent", [1,1,1,1], "taskCurrent"] };
   case "assigned": { [localize "str_taskSetCurrent", [1,1,1,1], "taskCurrent"] };
   case "succeeded": { [localize "str_taskAccomplished", [0.600000,0.839215,0.466666,1.000000], "taskDone"] };
   case "failed": { [localize "str_taskFailed", [0.972549,0.121568,0.000000,1.000000], "taskFailed"] };
   case "canceled": { [localize "str_taskCancelled", [0.750000,0.750000,0.750000,1.000000], "taskFailed"] };
 };
 taskHint [format [(_p select 0) + "\n%1", ((taskDescription _this) select 1)], (_p select 1), (_p select 2)];
};
SHK_updateTask = { // ["name","state"] call SHK_updateTask
 if isserver then {
   SHK_Jiptasks set [count SHK_Jiptasks,_this];
   publicvariable "SHK_Jiptasks";
 };
 if !isdedicated then {
   call compile format ["
   task%1 settaskstate ""%2"";
   task%1 call SHK_showTaskHint;
   ",(_this select 0),(_this select 1)];
 };
};
SHK_Jiptasks_JIP = false;
if isserver then {
 SHK_Jiptasks = [];
} else {
 if (isnull player) then { SHK_Jiptasks_JIP = true };
};
if !isdedicated then {
 [] spawn {
   waitUntil {!isnull player};
   player createDiaryRecord ["Diary",["About","<br />Version: 20100703<br />Made by: Shuko of LDD Kyllikki<br />Contact: shuko@Quakenet<br />www.kyllikki.fi"]];
   /* -- add briefing tasks below -- */
   taskAmbush= player createSimpleTask ["ambush"];
   taskAmbush setSimpleTaskDescription ["A convoy of unbelievers is coming from the <marker name='mNorth'>north</marker>. Go and smite their necks!","Ambush",""];
   taskAmbush setTaskState "Assigned";
   player setcurrenttask taskAmbush;
   /* -- add briefing tasks above -- */

   if SHK_Jiptasks_JIP then {
     waituntil {!isnil "SHK_Jiptasks"};
     {
       switch (typename _x) do {
         case (typename ""): { _x call SHK_createTask };
         case (typename []): { call compile format ["task%1 settaskstate ""%2""",(_x select 0),(_x select 1)] };
       };
     } foreach SHK_Jiptasks;
     SHK_Jiptasks_JIP = false;
   };
 };
};

Share this post


Link to post
Share on other sites

Heh, I have been putting my diary in a briefing.sqf. Great I can now add it to this. Thanks once again.

Share this post


Link to post
Share on other sites

Thanks for the update.

I'm having a problem, and I could need some advise on how to debug it.

I have used the script in one of my missions, and it seemed to work. But all of a sudden none of the created tasks get updated for JIP. The initially created task works fine. I must have messed something up, but I can not locate the error. I get no script errors, and I've looked over the code a thousand times. I cant think of what I might have done to screw it up. I have a few questions that could help me locate it.

If none of the tasks get created/updated on JIP, must not the error then lie in the init.sqf? (or in my case briefing.sqf).

I have A LOT of tasks in my mission. The mission I've done forces me to make nearly 40 seperate tasks (not all of which needs to be completed of course).

Is there a maximum on the number of tasks I can create with this script?

Are there any restrictions on where I can call the create/update task command, and could these result in my symptoms?

How reliable is "-showScriptErrors"? Is it possible that I have a syntax error causing this problem, without me being prompted?

Edited by Nielsen
Being more specifik

Share this post


Link to post
Share on other sites

There is no task limit.

I'd advice to call them from triggers or something that executes the function on all machines.

-showscripterrors is reliable, you can also check arma2oa.rpt (on W7 it's under users\yourname\appdata\local\arma 2 oa).

One of the best debugging commands is "diag_log". You can write anything to the rpt file with it. So, just place tons of things like:

diag_log "myscript.sqf now doing this";

That way you can check the rpt to see what actually gets ran and what doesn't.

Share this post


Link to post
Share on other sites

Thanks for the info.

The "diag_log" will certainly come in handy in the future.

Unfortunately it did not help me solve my current problem.

I dont get it. I get no script errors. The briefing.sqf is running from start to finish (confirmed with diag_log). And I get nothing in the .rpt that gives me a clue as to what might be causing this. I am calling the script from triggers or from scripts executed by triggers, so that should be allright also.

I'm so depressed about this. I've spent so much time and put a lot of work into this mission. When I implemented your script, and it worked I was like :yay: x10.

I then finished up the mission, and all of a sudden the JIP does not work. At first I thought that it was propably a syntax error, and started to debug. But now - getting no error or other indication of what is going on - I'm getting really frustrated. Especially cause I know I'm at fault, since I've seen the script work.

Now, I know that you are not running a help desk, but I could sure use a bit more help if you've got the time.

Would you agree, that since none of the tasks get either created nor updated on JIP, the problem must lie within the briefing.sqf (where I run the script)?

If so, can you tell me if anything is wrong with this:

Briefing.sqf:

diag_log "Briefing.sqf Started running!";

SHK_createTask = { // "name" call SHK_createTask
 if isserver then {
   SHK_Jiptasks set [count SHK_Jiptasks,_this];
   publicvariable "SHK_Jiptasks";
 };
 if !isdedicated then {
   /* -- add extra tasks below -- */
   switch _this do {
//Tasks created by civilian information!
     case "Hideout1": {
       taskHideout1 = player createSimpleTask ["Hideout1"]; 
	taskHideout1 setSimpleTaskDescription ["Clear insurgent hideout, and neutralize any insurgent presence.", "Neutralize hideout", "Neutralize hideout"]; 
	taskHideout1 setSimpleTaskDestination getPos hideout_1; 
	taskHideout1 setTaskState "Assigned";
     };
  case "Hideout2": {
       taskHideout2 = player createSimpleTask ["Hideout2"]; 
	taskHideout2 setSimpleTaskDescription ["Clear insurgent hideout, and neutralize any insurgent presence.", "Neutralize hideout", "Neutralize hideout"]; 
	taskHideout2 setSimpleTaskDestination getPos hideout_2; 
	taskHideout2 setTaskState "Assigned";
// I have a lot of similar tasks here, all copy pasted and corrected from the above tasks.
     };
   /* -- add extra tasks above -- */
   if !SHK_Jiptasks_JIP then {
     call compile format ["task%1 call SHK_showTaskHint",_this];
   };
 };
};
SHK_showTaskHint = { // Task call SHK_showTaskHint
 private "_p";
 _p = switch (tolower(taskstate _this)) do {
   case "created": { [localize "str_taskNew", [1,1,1,1], "taskNew"] };
   case "current": { [localize "str_taskSetCurrent", [1,1,1,1], "taskCurrent"] };
   case "assigned": { [localize "str_taskSetCurrent", [1,1,1,1], "taskCurrent"] };
   case "succeeded": { [localize "str_taskAccomplished", [0.600000,0.839215,0.466666,1.000000], "taskDone"] };
   case "failed": { [localize "str_taskFailed", [0.972549,0.121568,0.000000,1.000000], "taskFailed"] };
   case "canceled": { [localize "str_taskCancelled", [0.750000,0.750000,0.750000,1.000000], "taskFailed"] };
 };
 taskHint [format [(_p select 0) + "\n%1", ((taskDescription _this) select 1)], (_p select 1), (_p select 2)];
};
SHK_updateTask = { // ["name","state"] call SHK_updateTask
 if isserver then {
   SHK_Jiptasks set [count SHK_Jiptasks,_this];
   publicvariable "SHK_Jiptasks";
 };
 if !isdedicated then {
   call compile format ["
   task%1 settaskstate ""%2"";
   task%1 call SHK_showTaskHint;
   ",(_this select 0),(_this select 1)];
 };
};
SHK_Jiptasks_JIP = false;
if isserver then {
 SHK_Jiptasks = [];
} else {
 if (isnull player) then { SHK_Jiptasks_JIP = true };
};
if !isdedicated then {
 [] spawn {
   waitUntil {!isnull player};
   player createDiaryRecord ["Diary",["About","<br />Version: 20100703<br />Made by: Shuko of LDD Kyllikki<br />Contact: shuko@Quakenet<br />www.kyllikki.fi"]];
   /* -- add briefing tasks below -- */ 
taskInitial = player createSimpleTask ["Initial"];
   taskInitial setSimpleTaskDescription ["Patrol the streets of Baghdad.","Patrol","Patrol"];
   taskInitial setTaskState "Assigned";
   player setcurrenttask taskInitial;
   /* -- add briefing tasks above -- */

   if SHK_Jiptasks_JIP then {
     waituntil {!isnil "SHK_Jiptasks"};
     {
       switch (typename _x) do {
         case (typename ""): { _x call SHK_createTask };
         case (typename []): { call compile format ["task%1 settaskstate ""%2""",(_x select 0),(_x select 1)] };
       };
     } foreach SHK_Jiptasks;
     SHK_Jiptasks_JIP = false;
   };
 };
};

diag_log "Briefing.sqf Finished running!";

It should be just a copy of your script, with my own tasks-template pasted into it. What I dont get is that the initially created task (taskInitial) is created just fine on JIP. I guess that would suggest that the problem is in the "extra tasks" section. But I have checked, double and tripplechecked my task names etc. They should be correct.

Do you have any insight into what type of error could result in my symptoms (total breakdown of a part of the script)?

Share this post


Link to post
Share on other sites

Add these to the end of it, jip should print true for jips and tasks should list the added tasks as well.

diag_log SHK_Jiptasks_JIP;

diag_log SHK_Jiptasks;

Share this post


Link to post
Share on other sites

Of course. I should have thought about that.

I will test it as soon as my buddy is online.

Obviously when I tried it by myself SHK_Jiptasks_JIP returned false and SHK_Jiptasks returned [].

Share this post


Link to post
Share on other sites

How do I call up the hints in a trigger? Example mission did not have that.

---------- Post added at 04:53 PM ---------- Previous post was at 04:47 PM ----------

Would it be

TaskKill call SHK_showTaskHint ?

Kill being the name of the task. How does it know if its failed/done,canceled ect.

Share this post


Link to post
Share on other sites

Use this version:

SHK_createTask = { // "name" call SHK_createTask
 if isserver then {
   SHK_Jiptasks set [count SHK_Jiptasks,_this];
   publicvariable "SHK_Jiptasks";
 };
 if !isdedicated then {
   /* -- add extra tasks below -- */
   switch _this do {
     case "gohome": {
       taskGoHome = player createSimpleTask ["gohome"]; 
       taskGoHome setSimpleTaskDescription ["Time to go <marker name='mGoHome'>home</marker>.","Home",""]; 
       taskGoHome setTaskState "Assigned";
       player setcurrenttask taskGoHome;
       "mGoHome" setmarkeralphalocal 1;
     };
   };
   /* -- add extra tasks above -- */
   if !SHK_Jiptasks_JIP then {
     call compile format ["task%1 call SHK_showTaskHint",_this];
   };
 };
};
SHK_showTaskHint = { // Task call SHK_showTaskHint
 private "_p";
 _p = switch (tolower(taskstate _this)) do {
   case "created": { [localize "str_taskNew", [1,1,1,1], "taskNew"] };
   case "current": { [localize "str_taskSetCurrent", [1,1,1,1], "taskCurrent"] };
   case "assigned": { [localize "str_taskSetCurrent", [1,1,1,1], "taskCurrent"] };
   case "succeeded": { [localize "str_taskAccomplished", [0.600000,0.839215,0.466666,1.000000], "taskDone"] };
   case "failed": { [localize "str_taskFailed", [0.972549,0.121568,0.000000,1.000000], "taskFailed"] };
   case "canceled": { [localize "str_taskCancelled", [0.750000,0.750000,0.750000,1.000000], "taskFailed"] };
 };
 taskHint [format [(_p select 0) + "\n%1", ((taskDescription _this) select 1)], (_p select 1), (_p select 2)];
};
SHK_updateTask = { // ["name","state"] call SHK_updateTask
 if isserver then {
   SHK_Jiptasks set [count SHK_Jiptasks,_this];
   publicvariable "SHK_Jiptasks";
 };
 if !isdedicated then {
   call compile format ["
   task%1 settaskstate ""%2"";
   task%1 call SHK_showTaskHint;
   ",(_this select 0),(_this select 1)];
 };
};
SHK_Jiptasks_JIP = false;
if isserver then {
 SHK_Jiptasks = [];
} else {
 if (isnull player) then { SHK_Jiptasks_JIP = true };
};
if !isdedicated then {
 [] spawn {
   waitUntil {!isnull player};
   player createDiaryRecord ["Diary",["About","<br />Version: 20100703<br />Made by: Shuko of LDD Kyllikki<br />Contact: shuko@Quakenet<br />www.kyllikki.fi"]];
   /* -- add briefing tasks below -- */
   taskAmbush= player createSimpleTask ["ambush"];
   taskAmbush setSimpleTaskDescription ["A convoy of unbelievers is coming from the <marker name='mNorth'>north</marker>. Go and smite their necks!","Ambush",""];
   taskAmbush setTaskState "Assigned";
   player setcurrenttask taskAmbush;
   /* -- add briefing tasks above -- */

   if SHK_Jiptasks_JIP then {
     waituntil {!isnil "SHK_Jiptasks"};
     {
       switch (typename _x) do {
         case (typename ""): { _x call SHK_createTask };
         case (typename []): { call compile format ["task%1 settaskstate ""%2""",(_x select 0),(_x select 1)] };
       };
     } foreach SHK_Jiptasks;
     SHK_Jiptasks_JIP = false;
   };
 };
};

As you can see the hints are included already, to update a task use for example:

["ambush","failed"] call SHK_updateTask

...and the failed hint will show up and the task gets updated.

Share this post


Link to post
Share on other sites

They should be called automatically when adding or updating.

Share this post


Link to post
Share on other sites

@shk:

Allright now it gets really weird.

Got my buddy online to test, and everything works fine!

This is SO weird. I've tested it with him many times, as late as yesterday, and nothing got updated on JIP. Now he joins and every task is spot on! The only thing I've changed since last nights test, is that I optimized an old script called by an addaction, and which I did'nt even call during the tests. The script does not contain any taskscreation/updating. You dont think having an unrelated script with excessive "if - if - if" statements could have been the problem do you? I simply can not comprehend this enigma. When checking his .rpt I find that '_JIP' is 'true' and _jiptasks contains an array with the relevant tasks as should be. So I guess everything is good, although it makes me kind of nervous that it suddenly works, when I have no idea what made it work.

Unfortunately I did not have the possibility of making several checks, as my buddy did not have time, and when we set up another try he got kicked straight to debrief when entering. This has been a problem for us before, and I never could figure out why. But the .rpt gave me a clue. It said "Unit slot not found", so I guess I'll have a look at that next.

Anyways. The .rpt did report another anomalous thing.

When he entered my game on creation (not JIP) the .rpt did not report: False and []. Instead of giving an empty array it read:

"Briefing.sqf Started running!"
false
"Briefing.sqf Finished running!"
Error in expression <
};
diag_log SHK_Jiptasks_JIP;
diag_log SHK_Jiptasks; 
diag_log "Briefing.sqf Fi>
 Error position: <SHK_Jiptasks; 
diag_log "Briefing.sqf Fi>
 Error Undefined variable in expression: shk_jiptasks
File mpmissions\__CUR_MP.Baghdad\briefing.sqf, line 293

The taskarray should have been stated right below 'false'. The line (293) it refers to, is the "diag_log SHK_Jiptasks;". My .rpt read an empty array. Is this because I'm server and defining the empty array, and is this normal? If so I guess I have no more problems as long as my mission does not shift gear on me again.

Thanks for your help man, I really appreciate it!

Edited by Nielsen
being more specific

Share this post


Link to post
Share on other sites

The array should be undefined if he joined on creation (=not jip). It only gave the error since you tried using it with diag_log, it won't give the error without that.

Share this post


Link to post
Share on other sites

Allright. I've done some more testing with my buddy.

My results are this.

The script works like it should when JIP. After doing a lot of connects and re-connects we've found, that the tasks get updated as they should most of the time. However, sometimes when a player JIP's he wont get the tasks. I have realized that it is not your script (or my implementation of it) that seems to cause this, as it effects several things. I implemented weather selection in my mission, and when the tasks fail to update on JIP, the weather is also not updated correctly.This is 100% consistent in my tests, and it can be cleared with a reconnect. I'm not sure what is causing this, but it seems that neither you nor I am to blame for this (I am keeping the door open on the "I" though ;)). Also, as it seem to be clearable with a reconnect I do not really see it as a major concern. One thing we noticed though is, that the problem only arises when my buddy have disconnected and attempts to reconnect to the same character/unit. This might just be coincidental, I'm not sure.

Well whatever. As I said, with a reconnect there's no problem, so I dont worry about it. I just figured, that when you have taken the time to code this for the community, the least I could do was to get back to you on this issue now that I had some time to test it more.

The bottom line. The script works - and I love it! Thanks.:)

Share this post


Link to post
Share on other sites

We could try to make some changes so the script could be run with "call compile preprocessfile". That way it should not be affected by other scripts etc.

Share this post


Link to post
Share on other sites

Well if you think that would make a difference, I'm all for it.

But as I said, I do not consider this a problem. I think this script is awesome as it is.

But yeah, you're the expert, and I'm sure alot of less experienced scripters like myself are having (and will have) so much use for this script. So if you think a rework is worth your time, then I'll be waiting for the update ;).

Share this post


Link to post
Share on other sites

@ shk

A quick question:

I use your script (the last version with task hints) and it works great, but i noticed that in SP when i change the unit (team switch), what i often do if my guy is heavy wounded, i no longer have any tasks or notes, they not show up.

Can you help (maybe this is a game bug) ?

Share this post


Link to post
Share on other sites

It's not even meant to work with team switch. Nor is it a bug, tasks are unit specific, not client specific.

Share this post


Link to post
Share on other sites

@Wiggum: Thats because the script uses "player createSimpleTask". What you need to do is change 'player', so that the tasks get created for all units on the given side, instead of just the player unit. I can not remember the command, as I have never done it (I feel switching units breaks immersion for me). But I am farely sure that it is straight forward, and can be done by replacing 'player' in the script with something like 'side west' or something like that. Do a search ad you should solve it in a min.

@Shk:

As I was browsing the forum, I saw someone stating that on JIP, sometimes the client just wont run the init.sqf. If this is true (as I suspect it to be), then that is propably the cause of my issues. It certainly explains why neither tasks, weather nor time gets updated on JIP every now and then, and why it can be fixed with a reconnect. If this is the case, then I guess compiling the script in init.sqf will do no good... Just a heads up before you spend time reworking the code.

EDIT: After rereading your post I am unsure if you were actually sugesting to compile it once in the init.sqf. I've only just started to look into compiling scripts, and havent yet figured out when/how to use the different commands in this regard.

Regarding the issue, I figure an editor solution would be to put a trigger to check if the init has been initialized, and execute the init.sqf it the client has not allready done so. I'm not sure if this would pose a problem in the sequenze of things. I guess it would be a problem if the trigger starts activating the init.sqf before the client has a chance to do so. I understand that the init.sqf fires quite late on JIP, when the client is allready ingame, and I wouldnt want it to run twice.

Edited by Nielsen
Addition

Share this post


Link to post
Share on other sites

Well, I don't buy into these "not loading init.sqf" comments without real proof. If you are still seeing the problem, make init.sqf print something at start and in the end with diag_log.

Anyway, with the compile thing I mentioned would mean that the script is run from init field of a unit. It wouldn't change much as it still needs to wait for player variable to init (unless I change it so that the tasks are just added using playableunits variable). It would be run in it's own thread and added to the queue sooner, plus it wouldn't be affected as much on init.sqf's share of cpu time.

Share this post


Link to post
Share on other sites

Hmm. You want proof?... - You cant handle the proof! :D. Seriously, you might be right about the init.sqf. I will add some diag_log to the init.sqf. When I see the problem again, I will check if that was the issue and get back to you.

Regarding the update. Good point. I'm allways a fan of optimizing performance :). On the other hand I dont know how much of a (potential) performance boost we are talking about. I have no knowledge of the impact that init.sqf has on cpu performance.

setPostMode DevilsAdvocate 1;

I would say that unless you think that there would be a significant gain, then it might be better to keep the script (and implementation) simple. No need to include the placing of objects and init-lines, unless it is performance wise well founded (not saying that it is not). If - in your considered oppinion - the performance boost would be noticeable, and the suggested way might noticeably help to weed out potential problems, then I think it is a good idea. Otherwise I would prefer it the way it is.

As to make it 'playable units' based, I'm not sure that is such a good idea. I'm quite sure that I will be using this script in all my mission. I dont see myself making missions where units have various briefings in the near future. However, I feel that keeping options open is a solid approach. I'm not sure how valid a concern this is, but I'm mentioning it because I felt that your implementation of task hints took something (just a little bit) away from the overall usefullness of the script. The implementation of "custom" tasknames, and the option to do failed (etc.) tasks greatly improved the overall usefullness of the script. But even though the automatic taskhints are convenient, they feel a bit restrictive. I often do more informative taskhints than just "task created" and "task completed", but having two taskhints right on top of each other looks rather messy imo... This is not a great concern, and I'm gladly using the taskhint version, having deleted my own taskhints. I'm just saying this, cause I figure alot of people are using it or going to. It would be a shame if such a great/usefull script left people feeling hindered in any way.

setPostMode DevilsAdvocate 0;

Well, whatever you come up with, I'm sure it will be great. I just think the true beauty of this scripts is the "simplicity" (not that it is simple to me), and the solid functionality.

Edited by Nielsen
Trying (and failing) to be funny

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×