Jump to content
Orange_One

trigger activates an addaction that will trigger a task

Recommended Posts

Hello, i have no scripting knowledge, i just watch youtube tutorials on making my first scenario. i'm sorry if there's already a topic here with same as mine. i just want to ask on how can i make an addaction that will trigger a task only after a certain trigger is activated. thanks in advance..

 

first trigger var. name is Card1, the object with add action var name is loudspeak with Init: this addAction ["Sound Alarm",{loudspeak say3D ["hqsiren", 1000, 1];}];

Share this post


Link to post
Share on other sites

https://community.bistudio.com/wiki/addAction

 

addAction takes many parameters, among them a condition.

 

Quote

this addAction
[
    "title",	// title
    {
        params ["_target", "_caller", "_actionId", "_arguments"]; // script
    },
    nil,		// arguments
    1.5,		// priority
    true,		// showWindow
    true,		// hideOnUse
    "",			// shortcut
    "true", 		// condition
    50,			// radius
    false,		// unconscious
    "",			// selection
    ""			// memoryPoint
];

 

 

Assuming you have "hqsiren" correctly defined, then this should work:

this addAction 
[ 
    "Sound Alarm", 
    { 
        params ["_target", "_caller", "_actionId", "_arguments"]; 
        _target say3D ["hqsiren", 1000, 1]; 
        //code for task creation here
    }, 
    nil, 
    1.5, 
    true, 
    true, 
    "", 
    "triggerActivated Card1", 
    50, 
    false, 
    "", 
    ""  
];

Now, do you already have a task set up using editor modules, or do you want to create a task from scratch?

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites

first thank you so much for replying. i have a task titled "DefendHQ" that i want to  be activated once the siren goes off.  is that even possible.

Share this post


Link to post
Share on other sites
1 minute ago, Orange_One said:

is that even possible

 

Sure, and there's more than one way to do it. If you are using editor modules, you should be able to activate the task with a trigger linked to a relevant task state module. There are plenty of tutorials to be found for setting up/managing tasks, either using modules or scripting. The Biki has a full page on the task framework here: https://community.bistudio.com/wiki/Arma_3:_Task_Framework

 

... the upshot of which is that scripting is more robust and feature-rich than the modules.

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites

thanks for the link. i have a lot to learn to understand the framework im sorry but i'm having trouble understanding what and how to write it inside the game. lol. i have a question tho. how do you put two conditions inside that add action, i already put the "triggerActivated Card1" and i want to link a trigger that would set its state to "completed" once the addaction is activated. i may just put a trigger with var name "end" to be connected to the task state

Share this post


Link to post
Share on other sites
1 hour ago, Orange_One said:

how do you put two conditions inside that add action, i already put the "triggerActivated Card1" and i want to link a trigger that would set its state to "completed" once the addaction is activated.

 

I'm not sure I follow. The addAction's condition parameter is just a boolean that determines whether or not the addAction is active/visible/interactable. You can set as many conditions as you'd like using whatever combination of logical and comparison operators are necessary (and/or/==/ etc.)

If you want your addAction to set a task state, then you would use the function BIS_fnc_taskSetState in the addAction's code block.


Using the previous example:

this addAction 
[ 
    "Sound Alarm", 
    { 
        params ["_target", "_caller", "_actionId", "_arguments"]; 
        _target say3D ["hqsiren", 1000, 1]; 
        ["DefendHQ","SUCCEEDED"] call BIS_fnc_taskSetState;
    }, 
    nil, 
    1.5, 
    true, 
    true, 
    "", 
    "triggerActivated Card1", 
    50, 
    false, 
    "", 
    ""  
];

 

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites

oh i see. forgive my ignorance. 😂 i got confused. thank you soo much. i'll let you know if i got things right on my editor. thanks again! 👍

Share this post


Link to post
Share on other sites

No problem, learning is cool. Ask questions, there are plenty of helpful folks here.

  • Like 2

Share this post


Link to post
Share on other sites
On 11/28/2021 at 4:51 AM, Orange_One said:

 

first trigger var. name is Card1, the object with add action var name is loudspeak with Init: this addAction ["Sound Alarm",{loudspeak say3D ["hqsiren", 1000, 1];}];

 

You need to do small things and test. 

 

Do something small and test it.  Do another thing small and test it.  Then join them so they both happen and test it.

 

In your case set a trigger to fire. But it only fires if 2 things have happened.

 

Place box1 on the map. When trigger1 fires it deletes box1

Place box2 on the map. When trigger2 fires it deletes box2

Trigger 3 is set to fire if both box1 and box2 are destroyed

 

There are other versions of this depending on what you want to achieve.

 

 

 

 

 

 

 

 

 

 

  • Thanks 1

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

×