Jump to content
scorpio17523

Create Task2 when player assigns Task1

Recommended Posts

Hi,

 

I'm trying to figure something out, which is probably very simple but I can't figure out the correct syntax and I've spent quite a bit of time looking on the wiki, forums and YouTube trying to find out how to do this.

 

I have a task setup in the Eden Editor (task1) which gets created (not assigned) when BLUFOR are present in the trigger aread. This currently works fine, however I have another task setup with another trigger synced to it so that it doesn't show straight away. I want this second task (task2) to be triggered when the player manually assigns themselve task1...

 

I know I need to put a condition in task2's trigger to check that task1's state is "Assigned" but am unclear how to do this...

 

If anyone could help shed some light on this I would be very greatful!

Share this post


Link to post
Share on other sites
[ "task1" ] call BIS_fnc_taskExits && { [ "task1" ] call BIS_fnc_taskState == "ASSIGNED" }

Edited: Realised you said task1 is created by a trigger so you need to make sure task1 exists before checking its state

  • Like 2

Share this post


Link to post
Share on other sites

As @Larrow said... And IF I AM NOT MISTAKEN, the trigger will evaluate the condition that Larrow said in specific time intervals so, when this will be true, the task will be assigned!

Share this post


Link to post
Share on other sites
On 1/15/2021 at 4:22 PM, Larrow said:

[ "task1" ] call BIS_fnc_taskExits && { [ "task1" ] call BIS_fnc_taskState == "ASSIGNED" }

Edited: Realised you said task1 is created by a trigger so you need to make sure task1 exists before checking its state

Hey @Larrow,

Just in case he wants to get rid of the trigger...could he go for an Eventhandler also?

this addEventHandler ["TaskSetAsCurrent", { params 

["_unit", "_task"];

}];

 

 

  • Like 2

Share this post


Link to post
Share on other sites

Hey @zagor64bz I believe that this will work but, I am not 100% sure if this syntax will work for MP! And because I am a noob, where are you going to add the EH for this to work?

  • Like 1

Share this post


Link to post
Share on other sites
45 minutes ago, A. Ares said:

Hey @zagor64bz I believe that this will work but, I am not 100% sure if this syntax will work for MP! And because I am a noob, where are you going to add the EH for this to work?

I'm not sure about MP as well, since I create SP missions only, but I'm pretty sure that EH can go in the unit init, or the mission init, or in a gamelogic.

For example, in one of my Ghost Recon campaign, I use that EH to activate layers according to task progression:

Spoiler

player addEventHandler ["TaskSetAsCurrent",{      
    params ["_unit","_task"];  
      
    private _layers = switch _task do {  
        case ("Task04" call BIS_fnc_taskReal):{(getMissionLayerEntities "pilotTaskCustom") select 0};  
        case ("Task05" call BIS_fnc_taskReal):{(getMissionLayerEntities "sinkShipCustom") select 0};  
  case ("Task06" call BIS_fnc_taskReal):{(getMissionLayerEntities "powerPlantTaskCustom") select 0};  
  case ("Task07" call BIS_fnc_taskReal):{(getMissionLayerEntities "virusTaskCustom") select 0};  
        default {[]};  
    };      
      
    {  
        _x enableSimulation true;       
        _x hideObject false;    
    } forEach _layers;  
}];

 

Keep in mind that my tasks are all scripted and not using modules.(once understood the concept, it's easier to keep track of tasks and build complex tasks progression without a maze of modules, triggers, and what-nots in the editor).

 

 

  • Like 2

Share this post


Link to post
Share on other sites

@zagor64bz alright mate... I believe that scripting has way more potential than modules (although modules may be faster and easier some times). I try to learn the basics on scripting these days so, it seems that the potential is really high! Although locality and scripting for MP (JIP in mind) some times is a huge pain in the @ss but I take it slow! Now for EH, I believe that they have to be added on every client with a "remoteExec" otherwise they won't be able to execute if the locality of the object change or the commands are have a local effect! But, as I said, I am still a noob and I cannot really confirm that! 😛

Cheers mate.

P.s: I would love to take a look at your campaign! 

  • Like 2

Share this post


Link to post
Share on other sites

As I said, I'm more noob than you on the MP subject! Sorry mate...wish I could help you more.

As for my campaign, please feel free to give it a spin, trash it around as you like, and let me know what's your impressions on it.

  • Like 2

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

×