Jump to content
leadwolf32

Activate Trigger with addAction

Recommended Posts

Hello I'm trying to activate a repair trigger with an action on an object, say a toolbox. I cant figure out how to get the trigger to activate in a way other than a player entering the field. What I would like is for a pilot to land on a pad (which is in the trigger field), get out, scroll wheel and repair vs simply entering the field then insta repair. I feel like there is something super simple I'm missing but I can't figure it out

Share this post


Link to post
Share on other sites

Hello, welcome on BI forum.

 

use a simple variable set to true in your addaction and add this condition in your trigger:

In addAction code: GoForRepair = TRUE;

in trigger: < condition used > && !isNil "goForRepair"

If repeatable, in deact field: goForRePair = Nil;

 

Share this post


Link to post
Share on other sites
9 hours ago, pierremgi said:

Hello, welcome on BI forum.

 

use a simple variable set to true in your addaction and add this condition in your trigger:

In addAction code: GoForRepair = TRUE;

in trigger: < condition used > && !isNil "goForRepair"

If repeatable, in deact field: goForRePair = Nil;

 

Im still somewhat new to scripting and i may be missing something obvious. when I past in your code Im getting "Error invalid number in expression"

Share this post


Link to post
Share on other sites

Write your code here. I can't guess what is wrong. The principle is simple.

Share this post


Link to post
Share on other sites
16 hours ago, leadwolf32 said:

I feel like there is something super simple I'm missing but I can't figure it out

 

Use the trigger to detect conditions for the action.  Use triggerActivated triggerName in the action's show condition.  Have the action set off the script.

 

1.)  Have the trigger detect whatever conditions for the action:
- a. BluFor Present (or other, becomes "this" in trigger condition),
- b. Helo is in the trigger,
- c. Helo is landed,
- d. Helo is damaged,
- e. Pilot is dismounted.
Given such conditions, setting them in trigger may be easier or better than setting them as a show condition for an action.

 

2.)  In the action's show condition, use triggerActivated trig, else include it, example: "triggerActivated trigName && _this In [pilot1,pilot2,pilot3]" would also limit who gets the action.


3.)  Have the action run or remoteExec the script, rather than the trigger.

 

Or is it critical for the trigger to run the script?

Edited by opusfmspol

Share this post


Link to post
Share on other sites
3 hours ago, leadwolf32 said:

Im still somewhat new to scripting and i may be missing something obvious. when I past in your code Im getting "Error invalid number in expression" 

You shouldn't directly copy the "< condition used >" part! It's not a valid expression. That's why you get an error.
What pierremgi meant is that you should put the appropriate condition there.

Share this post


Link to post
Share on other sites

Why activate a trigger? If all your trigger does is call a script to repair the vehicle, just make the action call the script instead.

Then make the addAction only available if a helicopter is on the repair pad.

Example

 

  • Like 2

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

×