Jump to content
Sign in to follow this  
tobmic

Tasks not updating for Jip players

Recommended Posts

I need your help quick :(

In my current mission i have the problem that tasks dont get updated for JIP players.

If a task is succedeed it will be shown for the JIP players as created :(

under trigger activation i did this

"Marker6" setMarkerColor "ColorRed"; [east,"HQ"] sideChat "We seized Olsha good job !";task8 setTaskState "Succeeded"; task8done=true; nul = [objNull, ObjNull, task8, "SUCCEEDED"] execVM "CA\Modules\MP\data\scriptCommands\Taskhint.sqf";

And in the init.sqf

onPlayerConnected "

publicVariable 'task1done';

publicVariable 'task2done';

publicVariable 'task3done';

publicVariable 'task4done';

publicVariable 'task5done';

publicVariable 'task6done';

publicVariable 'task7done';

publicVariable 'task8done';

publicVariable 'task9done';

publicVariable 'task10done';

publicVariable 'task11done';

publicVariable 'task12done';

";

if(isNil "task1done") then{task1done = false};

if(isNil "task2done") then{task2done = false};

if(isNil "task3done") then{task3done = false};

if(isNil "task4done") then{task4done = false};

if(isNil "task5done") then{task5done = false};

if(isNil "task6done") then{task6done = false};

if(isNil "task7done") then{task7done = false};

if(isNil "task8done") then{task8done = false};

if(isNil "task9done") then{task9done = false};

if(isNil "task10done") then{task10done = false};

if(isNil "task11done") then{task11done = false};

if(isNil "task12done") then{task12done = false};

So what have i done wrong and how to make it that each client that connects can see the tasks updated ?

Share this post


Link to post
Share on other sites

You dont set task state for JIPs, you only tell that taskX is done (true).

Share this post


Link to post
Share on other sites

ah allright so how do i set the taskstae for jip players then ?

like

if (isDedicated) then {task8 setTaskState "Succeeded";}

something like that ? not sure how to do that

Share this post


Link to post
Share on other sites

Id just use the double-trigger method. Two triggers for each task/objective.

First:

cond: !alive someguy (or whatever your task condition is)

onact: task8done = true; publicvariable "task8done"

Second:

cond: task8done

onact: "Marker6" setMarkerColor "ColorRed"; [east,"HQ"] sideChat "We seized Olsha good job !";task8 setTaskState "Succeeded"; nul = [objNull, ObjNull, task8, "SUCCEEDED"] execVM "CA\Modules\MP\data\scriptCommands\Taskhint.sq f";

This works like this; when a trigger of the objective goes off (you killed a guy, blowed up something, whatever), it sets a variable to true and broadcasts it. Second trigger will catch that variable and then set taskstate/marker etc.

Since everything broadcasted with pubvar is synced automatically for JIPs, the variables will trigger the second trigger on their computer and thus setting right state etc.

And doing this you can remove that onPlayerConnected and isnil stuff completely.

Share this post


Link to post
Share on other sites

cool thx "shk" thats a good idea !

So the publicvariable replaces that i have written in the init.sqf ?

I will try it out later thx for help

Share this post


Link to post
Share on other sites

AFAIK you still need to publicVariable those onPlayerConnected to get it updated for JIPs, but yes like he said you need to not only update the variable but also to actually set the task state...

Share this post


Link to post
Share on other sites
AFAIK you still need to publicVariable those onPlayerConnected to get it updated for JIPs, but yes like he said you need to not only update the variable but also to actually set the task state...

Im going to try it out later on Dedi server if it work

I have a quick question on this if i make a trigger with condition

Task8done

and on activation

if (isServer) then { grp1 = [getMarkerPos "spawn_1", west, ["CDF_Soldier_GL", "CDF_Soldier_AR", "CDF_Soldier_RPG", "CDF_Soldier", "CDF_Soldier"], [], ["CORPORAL", "PRIVATE", "PRIVATE", "PRIVATE", "PRIVATE"], [0.4,0.3,0.3,0.2,0.2],[], [], round (random 360)] call BIS_fnc_spawnGroup; null = [grp1,(getMarkerPos "spawn_1")] execVM "scripts\BIN_taskDefend.sqf"};

Will the units get spawned once on the server or aswell on player connect multiple times ?

Share this post


Link to post
Share on other sites

Only once since you were smart enough to include the isserver check.

And you shouldn't need the onPlayerConnected pubvars, but test it.

Share this post


Link to post
Share on other sites
Id just use the double-trigger method. Two triggers for each task/objective.

First:

cond: !alive someguy (or whatever your task condition is)

onact: task8done = true; publicvariable "task8done"

Second:

cond: task8done

onact: "Marker6" setMarkerColor "ColorRed"; [east,"HQ"] sideChat "We seized Olsha good job !";task8 setTaskState "Succeeded"; nul = [objNull, ObjNull, task8, "SUCCEEDED"] execVM "CA\Modules\MP\data\scriptCommands\Taskhint.sq f";

This works like this; when a trigger of the objective goes off (you killed a guy, blowed up something, whatever), it sets a variable to true and broadcasts it. Second trigger will catch that variable and then set taskstate/marker etc.

Since everything broadcasted with pubvar is synced automatically for JIPs, the variables will trigger the second trigger on their computer and thus setting right state etc.

And doing this you can remove that onPlayerConnected and isnil stuff completely.

i tried it today but the Taskstate didnt update for jip players :(

i tried it first with the publicvariables on player conenct in init.sqf and later without but both didnt work ?

Did i forgot to do something ?

Share this post


Link to post
Share on other sites

Mate, the problem is as follows: the jip player receives the publicVariable and the triggers become true BEFORE your briefing script starts, in other words, before your tasks exist.

Keep your initial state and try this:

Edit your trigger activation lines to (here the above example):

_nul = [] spawn {WaitUntil{not isNil "task8"}; "Marker6" setMarkerColor "ColorRed"; [east,"HQ"] sideChat "We seized Olsha good job !";task8 setTaskState "Succeeded"; task8done=true; nul = [objNull, ObjNull, task8, "SUCCEEDED"] execVM "CA\Modules\MP\data\scriptCommands\Taskhint.sq f";}

This way I hope the triggers wait with their execution until the particular tasks got created.

Share this post


Link to post
Share on other sites
Mate, the problem is as follows: the jip player receives the publicVariable and the triggers become true BEFORE your briefing script starts, in other words, before your tasks exist.

Keep your initial state and try this:

Edit your trigger activation lines to (here the above example):

_nul = [] spawn {WaitUntil{not isNil "task8"}; "Marker6" setMarkerColor "ColorRed"; [east,"HQ"] sideChat "We seized Olsha good job !";task8 setTaskState "Succeeded"; task8done=true; nul = [objNull, ObjNull, task8, "SUCCEEDED"] execVM "CA\Modules\MP\data\scriptCommands\Taskhint.sq f";}

This way I hope the triggers wait with their execution until the particular tasks got created.

Thx Bon im gonna try it out now

Share this post


Link to post
Share on other sites

Or just add time > 0 to the trigger conditions

cond: task8done && time > 0

Share this post


Link to post
Share on other sites

Combine what me and shk said, thats even more elegant: extend the condition of the triggers to a ... && not isNil "taskx",

so e.g. for the trigger setting task8 to complete has the condition

task8done && not isNil "task8"

That should do it already.

Share this post


Link to post
Share on other sites

Or use a more reasonable system, such as setting the task state within the briefing file. That is:

_task8 = ....
[_taks8] spawn
{
  waitUntil {!isNil "taks8done"};
  waitUntil {taks8done};
  // HERE you can do whatever needs to be done when the task is complete
};

Anyway, like Bon said, you have to create the task first and only then set it to complete.

In the future, try running -showScriptErrors as a parameter in your shortcut (ex: D:\Steam\Steam.exe -applaunch 33910 -nosplash -maxmem=2047 -world=empty -showScriptErrors -mod=@CBA;@ACE;@ACEX;@ACEX_PLA;@ACEX_SM;@zcommon;@CSM2 ) so that you can see the error message for trying to access an undefined variable without having to open up the arma2.rpt file (which you should also know how to read)

Share this post


Link to post
Share on other sites

Hmm i must be doing something wrong and i have no idea : (

I tried all the methods and it wont work.

Can you guys take 5 minutes time and check the mission folder and look what i have done wrong ?

http://www.speedshare.org/download.php?id=CB9990ED11

At Galzohar can you explain me your example a little bit more ?

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  

×