Jump to content
Sign in to follow this  
Kupla

Tasks not completing in multiplayer?

Recommended Posts

In my current mission, tasks work fine in singleplayer but as soon as I move to multiplayer, tasks no longer complete for neither of us. I have following tasks in my briefing:

task1 = player createSimpleTask ["Clear the road"];
task1 setSimpleTaskDescription ["All insurgent resistance must be eliminated to guarantee a safe insertion for friendly units.", "Clear the road", "Clear the road"];
task1 = player2 createSimpleTask ["Clear the road"];
task1 setSimpleTaskDescription ["All insurgent resistance must be eliminated to guarantee a safe insertion for friendly units.", "Clear the road", "Clear the road"];
task1 = player3 createSimpleTask ["Clear the road"];
task1 setSimpleTaskDescription ["All insurgent resistance must be eliminated to guarantee a safe insertion for friendly units.", "Clear the road", "Clear the road"];

And the following in a trigger:

task1 settaskstate "SUCCEEDED"; hint "The road has been cleared."

What's wrong?

Also, I wish to thank the community for all the quick replies for my questions, they've helped a lot

Share this post


Link to post
Share on other sites

task1 = player createSimpleTask ["Clear the road"];
task1 setSimpleTaskDescription ["All insurgent resistance must be eliminated to guarantee a safe insertion for friendly units.", "Clear the road", "Clear the road"];

That'll do.

Share this post


Link to post
Share on other sites

But doesn't that create the task for one person only? I want everyone to see the tasks.

Share this post


Link to post
Share on other sites
does the hint work in mp with your mission?

Actually, it didn't. It worked in a test mission I made in mp though.

Share this post


Link to post
Share on other sites

Well, if in this mission the hint also didn't work, something must be wrong with the trigger.

Share this post


Link to post
Share on other sites

Player is the player. You're both players, right. Doesn't matter if there are hundreds of them. Thought you might be confusing the poor engine with task1 = so much ;)

Show us this trigger, then.

Share this post


Link to post
Share on other sites

I checked the trigger and realised that the hint was in a waypoint's on act and the waypoint was synchronized with the trigger. I moved the hint and settaskstate to the trigger's on act, do you think that makes a difference? (can't test it in mp now)

Edited by Kupla

Share this post


Link to post
Share on other sites

I don't think waypoint or trigger should make a difference.

But indeed your player2 and player3 setTasks are unnecessary. player is a reserved variable (thus never ever name any unit in the game to 'player') that refers to the player unit for a client, for all clients. It is a local command and always refers to the player character on the specific machine it is executed on.

Edit: This also means that you can't run scripts refering to player on a dedicated server only since there is no player on that machine.

Edited by Inkompetent

Share this post


Link to post
Share on other sites

Okay, I changed it, thanks for the help.

---------- Post added at 07:03 PM ---------- Previous post was at 05:35 PM ----------

New problem, after the player dies and respawns to another member of the group the tasks don't carry over. That might be because the briefing.sqf file is only executed through the init.sqf... which is in the beginning obviously. How do I fix this?

---------- Post added at 08:25 PM ---------- Previous post was at 07:03 PM ----------

Maybe I have to set the tasks for all group members then, is there some simple command to give all tasks at once or do I have to assign them to everyone individually?

Share this post


Link to post
Share on other sites

Have you updated to 1.03? It should update on respawn since last patch.

Share this post


Link to post
Share on other sites

Nope, doesn't update despite the patch. Are you sure it works with respawn = 4? I started this mission in 1.02 though..

Share this post


Link to post
Share on other sites
Nope, doesn't update despite the patch. Are you sure it works with respawn = 4? I started this mission in 1.02 though..

Restarting the mission in 1.03 should help.

The init is executed on all machines (server or ded server AND clients) for each player and each time a player connects and joins a running mission.

So briefing.sqf should be executed each time.

Share this post


Link to post
Share on other sites

I mean I started making the mission in editor in 1.02. Just tried it on a brand new test mission, didn't work. Test it yourself with "respawn = 4;" in description.ext. If you get it to work, please tell me

Edited by Kupla

Share this post


Link to post
Share on other sites

The new way was a pain and still in ways is but after figuring out how it works, everything was fine. Basically its a script so anything to do with scripts need to factored in. Now that they "fixed" the respawning into same unit issue(lossing tasks) there is a new problem I am seeing. If you use the older method of launching the script via an eventhandler "killed" or something you will get multiples of each task. Also JIP now becomes an issue more so for updated tasks. I am still testing to see what the fixed messed up but I really did like it the old way since the fix only fixes players respawning into same slot.

Share this post


Link to post
Share on other sites
Restarting the mission in 1.03 should help.

disregard.

JIP doesn't load the briefing for me either...

BUT it does if the player bails out to the lobby (dont disconnect!) and rejoins a second time though !

So JIP'ing a second time without disconnect loads the brieifing.sqf perfectly :o

Share this post


Link to post
Share on other sites
disregard.

JIP doesn't load the briefing for me either...

BUT it does if the player bails out to the lobby (dont disconnect!) and rejoins a second time though !

So JIP'ing a second time without disconnect loads the brieifing.sqf perfectly :o

Is this the only way? I'm about to give up with tasks...

Share this post


Link to post
Share on other sites

dont. ;)

Not even sure if I missed something in my inis.

Just fumbling around for hours now to get that whole JIP and ded stuff together for various startup group joins & conditions and such...

One time, after the JIP'ng instance CTD'ed, the briefing showed up nicely JIP'ing the first time after that long (cherno map) loading period .

Its all about timings with that MP stuff.

Did you check the OFPEC MP forum ?

Maybe someone of the cracks over there has specific experience with 1.03 loading task.

Will report back as soon as I have any info in that. Wanna have that fixed too sooner or later.

Share this post


Link to post
Share on other sites

I don't know what happened but I got it to work in a new testmission I made. I wrote this into briefing:

taskExample1 = player createSimpleTask ["taskname"];
taskExample1 setSimpleTaskDescription ["taskmessage", "taskname", "taskname"];
player addEventHandler ["killed", 
{ 
	[] spawn {
		waitUntil { alive player };
		[] execVM "briefing.sqf";
	};	
}];
if (triggeractivated tasktrig) then {task1 = player createsimpletask ["tasklol"]};
if (WPcompleted) then {task1 settaskstate "SUCCEEDED"};

As you can see I made a trigger which created a new task, so I had to add extra lines to check whether that trigger has been activated already.

EDIT: I'm getting double tasks when there's another person on the server. Still got to fix that

Edited by Kupla

Share this post


Link to post
Share on other sites

great, congrats !

lol tasklol ..:-)

I suppose with eventhandler "killed" the briefing is launched each time a player joins/JIP's ?

And while task1 is correctly created for the player, taskExample1 is not I guess ?

great find, thanks for sharing !

---------- Post added at 04:44 PM ---------- Previous post was at 03:47 PM ----------

EDIT: I'm getting double tasks when there's another person on the server.
trigger activation = repeatedly ?

Share this post


Link to post
Share on other sites

Or when you respawn I bet. Have to remove the exec from killed handler I gather. Happened to me, but confused me a long while because I get this intermittent problem with editor where it doesn't save, though everything appears to have done so, and I need a re-boot...

Share this post


Link to post
Share on other sites

Yeah on respawn... It worked fine alone, no double tasks or anything.

Share this post


Link to post
Share on other sites

Hi Kupla, hows it going ?

Think I have sorted it :-)

Theres just one thing we need to know i guess: I think the assumption somewhere in the Biki, that the init.sqf is executed right *after* a JIPing player enters the 3D scene is right.

That means, again, the script timings seems to be important here.

I got it working by

  1. putting the briefing.sqf call relatively on top of the ini, in any case pre any delays (sleep), so it shows up completely in the briefing room at mission start
  2. delaying the briefing call with sleep 1; for the JIP'ing path inside the init.sqf.

seems to work flawlessly ;)

EDIT:

err, sorry - guess i've overssen you are workin on respawn not JIP, right ?

but generally i think that timing issue applies here too.

Just argueing the solution using a trigger works because triggers need some time (abound 0.1 sec) to react. Maybe this serves as the delay needed for the playing unit entering back the scene hence loading the texts up..

---------- Post added at 04:24 PM ---------- Previous post was at 04:03 PM ----------

ok forget about my "guessings", think Xeno has put it spot on here

thats it.

Edited by Wiper

Share this post


Link to post
Share on other sites
ok forget about my "guessings", think Xeno has put it spot on here

thats it.

So how does this work in practice?

Share this post


Link to post
Share on other sites

From my briefing template (put it on the beginning of file):

waitUntil { !isNull player };
waitUntil { player == player };

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  

×