kibaBG 53 Posted December 27, 2022 In my mission I have Irani general to be killed otherwise he is getting to enemy barracks and the mission is failed. The problem is the vehicle with the general's group does not trigger task state to "FAILED". Here what I have to spawn the generals groups (working) : veh2 = "LOP_SYR_UAZ" createVehicle [4043.84,5518.31,4.76837e-007]; generalgrp = createGroup [east,true]; generalgrp addVehicle veh2; general = generalgrp createUnit ["O_Officer_Parade_Veteran_F", [4051.8,5504.99,0], [], 0, "NONE"]; guard1 = generalgrp createUnit ["LOP_IRAN_Infantry_SF_Grenadier", [4053.94,5508.33,0], [], 0, "CAN_COLLIDE"]; guard2 = generalgrp createUnit ["LOP_IRAN_Infantry_SF_Rifleman", [4052.81,5501.81,0], [], 0, "CAN_COLLIDE"]; generalgrp setBehaviour "CARELESS"; generalgrp setSpeedMode "LIMITED"; {_x limitSpeed 5} forEach units generalgrp; {_x assignAsCargo veh2} forEach units generalgrp; [general,guard1,guard2] orderGetIn true; guard1 assignAsDriver veh2; Group in spawned and gets in a vehicle. Order group to go to the barracks generalgrp move [3110.86,6298.28,0]; They move to barracks and then I want to use BIS_fnc_taskSetState to make the mission fail. A place a trigger, condition OPFOR present and on act : ["task5","FAILED",true] call BIS_fnc_taskSetState; The task is defined by trigger at the begining: private _myTask = [west,"task5","kill_general",objNull, "CREATED",-1,true,"kill",false] call BIS_fnc_taskCreate; And by this in description.ext : class CfgTaskDescriptions { class kill_general { title = "Kill the Irani general."; description = "Main task of phase one of the operation is finding and ellimination the Irani general. His demise will prevent the city to organize good defense. We have an informator, called Jafar, who will stop his vehicle next to the building where the general is hiding. Locate Jafar in the purple zone and tail his truck. Afterwards ged rid of Jafar and other witnesses if possible."; marker = ""; }; }; The problem is they don't activate the trigger ? and the task is not failed. If I just make condition true to this trigger it works ok. What is wrong? If the player kills the general task is succeeded without any problem with !alive general and: ["task5", "SUCCEEDED"] call BIS_fnc_taskSetState; Share this post Link to post Share on other sites
_foley 192 Posted December 28, 2022 1 hour ago, kibaBG said: The problem is they don't activate the trigger ? and the task is not failed. If I just make condition true to this trigger it works ok. What is wrong? So if I understand correctly, taskSetState works but there is an issue with trigger activation. Show some screenshots of the trigger. 1 Share this post Link to post Share on other sites
kibaBG 53 Posted December 28, 2022 2 hours ago, _foley said: So if I understand correctly, taskSetState works but there is an issue with trigger activation. Show some screenshots of the trigger. Exactly. I have trouble with the screenshot link. The trigger is rectangle, dimensions 20x30x10, act. by Opfor present. I deleted three times and made it back, made it repeatable and not. Nothing else in on act field just ["task5","FAILED",true] call BIS_fnc_taskSetState; I am just 😤 ... ["task5","FAILED"] call BIS_fnc_taskSetState; Same result, it does not detect the general's group. Forgot to mention TaskType is also defined in decription.ext and its working fine. class CfgTaskTypes { class kill { icon = "\A3\ui_f\data\igui\cfg\simpleTasks\types\kill_ca.paa"; }; }; Share this post Link to post Share on other sites
Raider_18 7 Posted December 30, 2022 (edited) Hey kiba, It looks like your already using 2D pos, Cfg stuff in description, and spawning groups successfully so I would suggest you script the trigger as well if that seems scenario appropriate: private _position = [2D position where you need the trigger] private _someName = createTrigger ["EmptyDetector", _position]; _someName setTriggerArea [50, 50, 50, false]; _someName setTriggerType "NONE"; _someName setTriggerActivation ["EAST", "PRESENT", false]; _someName setTriggerStatements ["this", "['task5','FAILED'] call BIS_fnc_taskSetState;", ""]; That should work Correction: if you needed it 20x30x10 _someName setTriggerArea [20, 30, 10, false]; Edited December 30, 2022 by Raider_18 1 Share this post Link to post Share on other sites
kibaBG 53 Posted December 30, 2022 I need the trigger to have variable name "fail5" so it triggers the end mission screen. I modified your suggestion but it gives error. fail5 = createTrigger ["EmptyDetector", [3110.71,6298.43,0]]; fail5 setTriggerArea [50, 50, 50, false]; fail5 setTriggerType "NONE"; fail5 setTriggerActivation ["EAST", "PRESENT", false]; fail5 setTriggerStatements ["this", "['task5','FAILED'] call BIS_fnc_taskSetState;", ""]; Unmodified it gives error too ... don't really what is wrong. Share this post Link to post Share on other sites
RCA3 593 Posted December 30, 2022 Just my 2 cents here: use the task commands instead of the functions. https://community.bistudio.com/wiki/setTaskState 1 Share this post Link to post Share on other sites
kibaBG 53 Posted December 30, 2022 28 minutes ago, RCA3 said: Just my 2 cents here: use the task commands instead of the functions. https://community.bistudio.com/wiki/setTaskState I didn't know they even exist! Thanks, I will try this. 😃 1 Share this post Link to post Share on other sites
_foley 192 Posted December 30, 2022 34 minutes ago, RCA3 said: Just my 2 cents here: use the task commands instead of the functions. https://community.bistudio.com/wiki/setTaskState Could you explain why? The wiki page for createSimpleTask recommends to use the functions over the commands. The reasoning behind it is documented on the Task Framework page. It's one of the rare cases where functions were created after the commands to improve the API, unlike in case of some of math functions that were replaced with a command to improve performance (e.g. vectorMultiply). 1 1 Share this post Link to post Share on other sites
kibaBG 53 Posted December 30, 2022 Yeah, I have to re-do everything. And its recommended to use the functions. Problem is group detection, not the Task framework ... 1 Share this post Link to post Share on other sites
Raider_18 7 Posted December 30, 2022 Dang, sorry! I use those commands exactly how you have them written above for all my scripted triggers and they work for me, hard to know what's wrong without knowing what error or what the scenario looks like. If you wanted to end the mission fromt that trigger you could also put that in the onAct statement field like such: trgName setTriggerStatements ["this", "['task5','FAILED'] call BIS_fnc_taskSetState; 'yourEnding' call BIS_fnc_endMission;", ""]; after the condition block "This", the second "" block is the onAct portion of the trigger. so here you can see it is your failed task and the end mission fnc that you have probably already defined. Works for me at least! I think the BIS_fnc's are always best because your calling or spawning them from the game config so its fast and will work every single time. 1 Share this post Link to post Share on other sites
kibaBG 53 Posted December 31, 2022 @Raider_18 No problems, man. I tested with pre-placed Opfor UAZ in the editor and the task failed as it should. I have the doubt the general's group are "secretly" Civilian lol. Maybe because their UAZ is spawned first without anyone in and in this case is Civilian and somehow it makes the whole group civilian as well. Edit: The problem is solved. I made two groups, one preplaced in the editor (UAZ with a driver, 100% OPFOR 🙂 ) and the generals group which spawns and gets in the vehicle as cargo. This time the UAZ successfully triggers the fail task state. So be warned if you spawn vehicle first and then add it to a group, somehow the group become the civilian side? This is crazy. 😄 1 Share this post Link to post Share on other sites
RCA3 593 Posted December 31, 2022 6 hours ago, _foley said: Could you explain why? I truly was convinced it was the other way around! I went and took a look on my old scripts, I use functions. Disregard, functions are better! Sorry, guys! Thanks for pointing it out, @_foley. Share this post Link to post Share on other sites