ostinelli / SCAR_UCM

Utilities Construction Mod for Arma 3.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Check "UCM_ConstructionDone" event in a trigger

armatourist opened this issue · comments

Hi _SCAR,

my steam name is tourist and you gave me some advice there how to do that ^^

But I'm not much of a coder and didn't get it done. I have put this code in my init.sqf:

private _id = ["UCM_ConstructionDone", {

        params ["_logicModule"];

       
        systemChat format ["Construction 1 is now finished"];

}] call CBA_fnc_addEventHandler;

And in the trigger I write in the condition:

UCM_ConstructionDone

OnActivation has a hint that doesn't play though once the construction is finished. I chose the game-pausing hint with the box to be sure it works and I don't overlook the small hint text. But, alas, it doesn't fire.

Can you give me some more detailed advice how to get to a variable that the trigger can listen to?

Many thanks in advance

tourist

What you want is to set a global variable in the callback. UCM_ConstructionDone is not, it's just a string.

UCM_contructionDone = false;
private _id = ["UCM_ConstructionDone", {    
        UCM_contructionDone = true;
}] call CBA_fnc_addEventHandler;

And then in the trigger condition put UCM_contructionDone. As a note, remember that this will run only server side so take that into consideration for whatever your trigger does.

Or better yet, whatever your trigger is triggering why don't you code it down in the callback?

Wow, that was a really fast response - BIG THX!!!

Tested your above posted code and it works as intended. I want to use it in several triggers placed on a map in an ALiVE Heart&Minds/COIN Mission. Everytime a construction project is finished, I want a trigger to decrease the hostility of all ALiVE spawned civilians present in the trigger area around the project. Basically only those who actually can see the finished project with their own eyes will be convinced that "We're here to help" is a true statement of my Armed Forces. So for every project, there is one trigger covering the surrounding settlements and executing a code that drops the hostility of the inhabitants and any passers-by. For me, anything I can build into a mission with WYSIWYG methods like triggers is easier to handle than loads of code in init.sqf - but then again, I'm just a copy-paster... :-)

This might be part of ALiVE, or not. I don't want to force the standard behavior of zones, but will leave this open for now, for considerations. Thank you.

Now tracked here: #8

Closing.