Jump to content
ABF Quantum

Set task to succeeded after players equip specific gear

Recommended Posts

I'm trying to make a mission where players need to equip CBRN gear midway through. I want the task to succeed when all players equip the items from a crate. I've tried using a trigger to just have it succeed after a delay while they stand there, but that isnt reliable because I dont know how long they would take in reality. Are there any ways to check players for items and have a trigger activate if they have the right items? Or is there a way to succeed the task when the crate is emptied of the items?

Share this post


Link to post
Share on other sites

No delay needed, you just have to use a basic trigger none none , server only, not repeatable,

on condition:  count AllPlayers > 0 && { { vest _x == "equip1" && headgear _x == "equip2" } count allPlayers isEqualTo count allPlayers }

 

on activation: setTaskState or BIS_fnc_taskSetState script

note: I don't know what your CNRN equipment is made of, so, as example, I chose "equip1" class as vest and "equip2" class as headgear. Of course you need to use the required class(es).

 

  • Like 1

Share this post


Link to post
Share on other sites
11 hours ago, pierremgi said:

No delay needed, you just have to use a basic trigger none none , server only, not repeatable,

on condition:  count AllPlayers > 0 && { { vest _x == "equip1" && headgear _x == "equip2" } count allPlayers isEqualTo count allPlayers } 

 

on activation: setTaskState or BIS_fnc_taskSetState script

note: I don't know what your CNRN equipment is made of, so, as example, I chose "equip1" class as vest and "equip2" class as headgear. Of course you need to use the required class(es).

 

I tried this and I cant seem to get it to work. I just made a vest on the ground called equip1 and a helmet called equip2 then made the activation task1 setTaskState "Succeeded";

It didn't give any errors, it just didnt work. I may be misunderstanding how the script works though, I dont know.

 

My actual goal is to have players go into a crate and equip a CBRN suit, an APR mask, and a respirator backpack. So a uniform, a facewear, and a backpack. I figure there is a way to get items in a crate to have variable names for trigger purposes, but I just want to get something to work good enough.

Share this post


Link to post
Share on other sites

I didn't mention any name for vest (or any gear) because on ground, you set name on ground weapon holder (or crate if any), which is the container, not the content.

I mentioned class names, so string like "H_PilotHelmetFighter_B" for a headgear  and/or  "V_RebreatherB" for a vest. (examples. I can't guess your gear classes).

Share this post


Link to post
Share on other sites
3 hours ago, pierremgi said:

I didn't mention any name for vest (or any gear) because on ground, you set name on ground weapon holder (or crate if any), which is the container, not the content.

I mentioned class names, so string like "H_PilotHelmetFighter_B" for a headgear  and/or  "V_RebreatherB" for a vest. (examples. I can't guess your gear classes).

I am missing something because I can't seem to get it to function. I tried to use those exact items to test, but I can't figure it out.

This is what I am doing exactly:

create task, assigned to playable units, task is to rearm. named task1

then a trigger. no activation, no type, server only.

Then I put in condition: count AllPlayers > 0 && { { vest _x == V_RebreatherB && headgear _x == H_PilotHelmetFighter_B } count allPlayers isEqualTo count allPlayers }

on activation: task1 setTaskState "Succeeded";

 

I cant figure it out. Based on this, I would assume that the script would go something like this, which has the gear classes I'm specifically using:

 

trigger: type none, activation none, server only

condition: count AllPlayers > 0 && { { uniform _x == "Item_U_C_CBRN_Suit_01_Blue_F" && faceware _x == "G_AirPurifyingRespirator_02_olive_F" && backpack _x == "B_CombinationUnitRespirator_01_F" } count allPlayers isEqualTo count allPlayers };

activation: task1 setTaskState "Succeeded";

 

What am I missing?

Share this post


Link to post
Share on other sites
48 minutes ago, ABF Quantum said:

I am missing something because I can't seem to get it to function. I tried to use those exact items to test, but I can't figure it out.

This is what I am doing exactly:

create task, assigned to playable units, task is to rearm. named task1

then a trigger. no activation, no type, server only.

Then I put in condition: count AllPlayers > 0 && { { vest _x == V_RebreatherB && headgear _x == H_PilotHelmetFighter_B } count allPlayers isEqualTo count allPlayers }

on activation: task1 setTaskState "Succeeded";

 

I cant figure it out. Based on this, I would assume that the script would go something like this, which has the gear classes I'm specifically using:

 

trigger: type none, activation none, server only

condition: count AllPlayers > 0 && { { uniform _x == "Item_U_C_CBRN_Suit_01_Blue_F" && faceware _x == "G_AirPurifyingRespirator_02_olive_F" && backpack _x == "B_CombinationUnitRespirator_01_F" } count allPlayers isEqualTo count allPlayers };

activation: task1 setTaskState "Succeeded";

 

What am I missing?

 

Different errors each time...  A class name is ALWAYS a string. You must pay attention for syntax if you want to progress in scripting.

count AllPlayers > 0 && { { vest _x == "V_RebreatherB" && headgear _x == "H_PilotHelmetFighter_B" } count allPlayers isEqualTo count allPlayers }

 

or, as beno_83au wrote, use goggles for goggle/mask.

If you don't want to make mistake, equip your player, ESC, then in debug console test : vest Player   uniform player    headGear player          goggles player   on watch lines.

copy/paste the result.

  • Like 1

Share this post


Link to post
Share on other sites

Thanks but I think you need to be a bit clearer when explaining things. I dont know why this is so sensitive but it seems to work one moment and then break the next. I copy pasted your exact example into a trigger, it worked. and then i tried it again and it didnt work. I can not tell the difference between this: 

count AllPlayers > 0 && { { vest _x == "V_RebreatherB" && headgear _x == "H_PilotHelmetFighter_B" } count allPlayers isEqualTo count allPlayers }

and

count AllPlayers > 0 && { { uniform _x == "U_C_CBRN_Suit_01_Blue_F" && goggles _x == "G_AirPurifyingRespirator_02_black_F" && backpack _x == "B_CombinationUnitRespirator_01_F" } count allPlayers isEqualTo count allPlayers }

 

the syntax is exactly the same. the class names are correct. I even got it working with the goggles and the suit, and then adding the backpack broke it. So i took that part out and then it stopped working.

 

I eventually did get it working with this:

count AllPlayers > 0 && { { uniform _x == "U_C_CBRN_Suit_01_Blue_F" && goggles _x == "G_AirPurifyingRespirator_02_black_F" && backpack _x == "B_CombinationUnitRespirator_01_F" } count allPlayers isEqualTo count allPlayers }

 

Which by my estimation is exactly the same as above. So I dont know why it stopped working.

Share this post


Link to post
Share on other sites
12 hours ago, ABF Quantum said:

Thanks but I think you need to be a bit clearer when explaining things.

Really? I can't guess you don't know the difference between a string and a global variable. There are sometimes little issue with written classes and copied classes, even if it's exactly the same (even case). Copying/pasting can solve this kind of issue. No other clue.

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

×