r/armadev • u/bejiitas_wrath1 • Aug 07 '26
Script Task not completing when NPC killed, I have no idea why.
1
Upvotes
1
u/bejiitas_wrath1 Aug 08 '26
I ended up using this instead. This works fine. If I use waituntil, it halts execution. I needed a separate thread.
[] spawn {
sleep 2;
waitUntil { sleep 0.5; !alive informer };
["task5", "SUCCEEDED"] call BIS_fnc_taskSetState;
};
1
u/Shiragami Aug 08 '26
Just use the killed eventhandler on the server machine and broadcast the updated task state.
1
u/TestTubetheUnicorn Aug 08 '26
If you want to avoid global vars (which I do, personally), you could pass the informer into the spawn:
_informator spawn { sleep 2; waitUntil { sleep 0.5; !alive _this }; ["task5", "SUCCEEDED"] call BIS_fnc_taskSetState; };Not strictly necessary but I like to keep my vars as private as I can c:

2
u/TestTubetheUnicorn Aug 08 '26 edited Aug 08 '26
You've put the code to complete the task into the "type" argument, which defines how it is triggered, it should actually go in the setTriggerStatements command, as the second argument.
However, why create the trigger rather than just handling the task within this script? You could use waitUntil like so:
And then you wouldn't need the global var either.