Jump to content
🛡️FORUMS ARE IN READ-ONLY MODE Read more... ×
Stark.S

Is it possible to activete a trigger with a code?

Recommended Posts

it seems to be a hard thing to find on the internet. 

 

For example, there's a phone that will be hacked by a player. After the phone will be hacked, a task to move and kill someone should be created. Could you please help me in figuring how to do it? 

Share this post


Link to post
Share on other sites

Depends on how you set it up, you could always activate triggers via script using setTriggerStatements.

Not an optimal way of doing things though, since you need to define on activation and on deactivation with this command.

 

Better solution would be to do the following:

//put in init.sqf
StarkS_fnc_PhoneHacked = false;

In the trigger of your choice set it to anybody and use this as condition:

StarkS_fnc_PhoneHacked

The activation field of the trigger will be executed as soon as StarkS_fnc_PhoneHacked returns true.

So inside the code that is executed when the phone is being hacked simply put:

StarkS_fnc_PhoneHacked = true;
publicvariable "StarkS_fnc_PhoneHacked";

Second line is only needed for MP.

 

Cheers

  • Like 1

Share this post


Link to post
Share on other sites

It really worked. You made me happy.:f:

  • Like 1

Share this post


Link to post
Share on other sites

×