Jump to content
Sign in to follow this  
chneemann

Problem with addaction as mission target in MP

Recommended Posts

Hi there,

I have a problem with an "addaction" script which should be used as end mission parameter.

I'm currently building a little MP Coop mission where you have to fulfill two tasks, one of them is to find secret documents.

I placed a "Land_File_research_F" with the name "AkteTS" at the map and gave it an init string:

this enableSimulation false; this addaction ["Take secret documents", "collect.sqf"];

Then I created a collect.sqf file:

deletevehicle AkteTS;

obj2 setTaskState "SUCCEEDED"; hint "Documents secured!";

I would like to use this object as mission target.

So the end trigger had the condition "taskCompleted obj1 && taskCompleted obj2;"

But only the person who found the documents will get a check mark to the "object2 task".

So at the end of the mission only the one who found the document will get a debriefing.

The other players still continue playing the mission.

I also tested other versions like Target2=true; publicvariable "Target2", but without success.

I tested it on a dedicated gameserver.

Share this post


Link to post
Share on other sites
[[obj2,"SUCCEEDED"],"BIS_fnc_taskSetState",true,false,false] call BIS_fnc_MP;

Share this post


Link to post
Share on other sites

Wow, that was quick :-)

I'll try this. But it may take some time get my test players together.

Share this post


Link to post
Share on other sites

Well unfortunately that didn't work out. :-/

I also tried

["obj2","SUCCEEDED","BIS_fnc_taskSetState",true,false,false] call BIS_fnc_MP;

and

["obj2","SUCCEEDED","BIS_fnc_taskSetState",true,true] call BIS_fnc_MP;

but it result in absolutely nothing. Even the player who activates the addaction didn't get the check mark anymore.

Maybe my scripting skills are a bit rusty ;-)

Share this post


Link to post
Share on other sites

How are you creating the task in the first place?

Share this post


Link to post
Share on other sites

It's a default object with init Parameters

20150212_Arma01.jpg

Sorry for the German ingame language. But everything should be on a similar place in english ;-)

Share this post


Link to post
Share on other sites

I understand that your attaching an action to the object, but how is the original task itself created, as in where/how does "obj2" come about?

Share this post


Link to post
Share on other sites

nah, the problem is enablesimulation false;

When you do this, no actions attached to the object will appear.

Share this post


Link to post
Share on other sites
nah, the problem is enablesimulation false;

When you do this, no actions attached to the object will appear.

I can't confirm this, because in my code, in which I disable simulation and add action, works fine.

Share this post


Link to post
Share on other sites

You could try using the in game Create Task and Set Task State modules to synchronise your players tasks?

I have a mission that has almost an identical event as what you have described and I have no issues.

Share this post


Link to post
Share on other sites

To avoid all those nasyte multiplayer addaction local variable things in Arma I mostly do this with some variables that I declare public.

in the init.sqf

pickedupdocument = false;

In the collect.sqf something like

pickedupdocument = true;

publicVariable "pickedupdocument";

And then a trigger who waits for

pickedupdocoument == true;

And in the trigger activation line the code you want to execute :-)

Share this post


Link to post
Share on other sites
To avoid all those nasyte multiplayer addaction local variable things in Arma I mostly do this with some variables that I declare public.

in the init.sqf

pickedupdocument = false;

In the collect.sqf something like

pickedupdocument = true;

publicVariable "pickedupdocument";

And then a trigger who waits for

pickedupdocoument == true;

And in the trigger activation line the code you want to execute :-)

And I avoid doing that :p, I think his issue may be that the task itself is being created local in the first place as well.

Share this post


Link to post
Share on other sites

Well, I wouldn´t do that if I have tons of things to manage, but with just a few variables needed it´s a quick and easy solution.

I use the FHQ Tasktracker to keep track of the tasks.

Share this post


Link to post
Share on other sites

Wow, a lot of new answers. After all the years this forum is still great! :-)

@Jshock

The obj2 is part of the briefing.sqf

//Objective 2
obj2 = player createSimpleTask["Secret documents"];
obj2 setSimpleTaskDescription["Secure the secret documents of our planned operations.", "Find the secret documents", "Find the secret documents"];
obj2 setSimpleTaskDestination (getMarkerPos "Mbase");

@barbolani & Schatten

I hope the enablesimulation is not the reason of the problem, because I don't want the documents lying on the ground.

@Imperator_Pete

I can't follow you at the moment :-/

@CommanderX

As written in my first post I tried nearly the same... But it only worked for the player who take the documents. It seems this is only local for one player... But your version is minimal different. So I'll try this out too.

But I think Jshock get the point... :-/

Do you have some details about the FHQ Tasktracker?

As you maybe noticed I'm not very firm with the new ArmA3 functions :-/

All my knowledge belongs to OFP to ArmA1 were I was really active in this community.

But since 2010 I'm not this active any more. But I still like the game very much :-)

Share this post


Link to post
Share on other sites

Try making the task like this instead:

[
"obj2",
true,
[
	"Secure the secret documents of our planned operations.",
	"Find the secret documents", 
	"Find the secret documents"
],
getMarkerPos "Mbase",
"AUTOASSIGNED",
5,
true,
true
] call BIS_fnc_setTask;

And then to set the state, do the same as I put in post #2:

[["obj2","SUCCEEDED"],"BIS_fnc_taskSetState",true,false,false] call BIS_fnc_MP; 

---------- Post added at 09:49 ---------- Previous post was at 09:42 ----------

As you maybe noticed I'm not very firm with the new ArmA3 functions

One of my favorite BIKI pages :D:

https://community.bistudio.com/wiki/Category:Arma_3:_Functions

---------- Post added at 09:51 ---------- Previous post was at 09:49 ----------

Well, I wouldn´t do that if I have tons of things to manage, but with just a few variables needed it´s a quick and easy solution.

I use the FHQ Tasktracker to keep track of the tasks.

I guess it's all personal preference, cause I script literally everything now, so at any given point I'm only directly managing 2-3 tasks at a time, I've never had a need for a task manager such as FHQ or Shuko's Taskmaster. And I only deal with a few variables at a time, but they are local to the script that's running them :p.

Share this post


Link to post
Share on other sites

Hi JShock,

thanks for your code lines :-)

But my briefing is a sqf file and your code is php. Is that compatible?

:eek: there are many functions in ArmA3 :eek: thanks for your link

Share this post


Link to post
Share on other sites

It's not PHP code, that is just a means to highlight the code here on the forums, so it's sqf code, with php code tags around it to make the code look better than plain black font.

Share this post


Link to post
Share on other sites

Ok thank you. I'll try this out.

When I was active here,it was another forum platform

Share this post


Link to post
Share on other sites

Hi JShock,

sorry for my late answer, but I was ill.

I just work on a little testmission.

But with your syntax my end-trigger doesn't work anymore.

I used

taskCompleted obj1 && taskCompleted obj2;

I think this will change with the new syntax?

Share this post


Link to post
Share on other sites

Try:

["obj1"] call BIS_fnc_taskCompleted && ["obj2"] call BIS_fnc_taskCompleted

Share this post


Link to post
Share on other sites

Apologies for the ambiguity in my post, glad that you've resolved your issue.

What I meant to say was that you can achieve the same outcome via the use of in-editor placed modules and triggers.

Task creation/assignment/completion can all be handled via the editor placed modules. You can even determine if these tasks are assigned to the entire side or specific players.

This task completion would then be synced (F5) to a trigger with a condition of "pickedupdocument;"

Once your AddAction .sqf file is activated and run the trigger would update the synced task to completed. You could then also define a countdown timer of 10 or so seconds that would then link to another End Mission module placed on the map that can (if desired) run a specific End class as defined in your description.ext.

I hope this makes sense? If not I could develop an example and send it to you.

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  

×