Jump to content
Sign in to follow this  
engima

Players loses tasks

Recommended Posts

Hi!

I have almost finished my first co04 mission, but before release I must solve one last problem concerning the tasks.

The tasks are initialized in init.sqf (task1 = player createSimpleTask ["xxx"]), and I use respawn "SIDE" in description.ext. Problem is that a player who dies, and by that respawn into another AI group member, lose all his tasks, and the task list ('J') appears blank for that player. I want each player to have their tasks with their current task states, regardless of how many times they respawn. How can I manage that?

Thankful for any help!

Edited by Engima

Share this post


Link to post
Share on other sites

Just wrap this around:

[] spawn {
if (!isDedicated) then {
	while {true} do {
		waitUntil {alive player};

		// your task stuff here

		waitUntil {!alive player};
	};
};
};

Edited by sxp2high
Added isDedicated check

Share this post


Link to post
Share on other sites

Ok, now I do the task stuff in another way. I simply create all tasks for all players on all machines. And when I update a task state, I do it on all playable unit's on all machines. Everything works great, including team switching, but if I die and then team switch I get a blank task list (objectives) in the debriefing screen. Why? Before mission ends my tasks are perfectly updated. Isn't it the tasks referenced by my local variables that shows up in the debriefing task list?

Edited by Engima
To better express myself

Share this post


Link to post
Share on other sites

Perhaps you could elaborate how you are creating the tasks for all players and how you are updating the task states, so people get a better understanding of what your problem might be.

My own preference is to create individually named tasks for all named playable slots and then update each of those tasks. So for a playable unit named bravo1 I create task1a and task2a and for the next playable unit bravo2 I create task1b and task2b and so on, then on fulfilling the appropriate condition I have a publicVariable broadcast and I update the task state of the individually named tasks. The on activation line of a trigger would then be for example: VictoryCondition1 = 1; publicVariable "VictoryCondition1"; "1" ObjStatus "DONE"; task1a setTaskState "SUCCEEDED"; task1b setTaskState "SUCCEEDED"; task1c setTaskState "SUCCEEDED"; task1d setTaskState "SUCCEEDED" to update the first task for all four playable units in a mission. It is not an elegant solution, but it works.

Regards,

Sander

Share this post


Link to post
Share on other sites

That's almost exactly how I do it too. Only difference is that I use arrays.

But my problem is not during the mission. Everything works just fine until mission ends and I see the debriefing screen/dialog. If I don't die during the mission, I see all tasks/objectives, succeeded or failed or whatever and everything is fine. But if I die and team switch into an AI team member, and then finishes the mission, then all tasks seem ok *until* mission ends and the debriefing dialog shows up blank. Why is it blank? All tasks for the current unit is obviously there just a moment before...?

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  

×