Jump to content
ALPHIVE

How to make removing weapon trigger ?

Recommended Posts

Hi everybody,

 

I tried to make removing weapon trigger but it doesnt work ...

My goal is simple : when an independant enter inside a trigger named "TR1", all of his weapons are removed 

 

I want to make a firerange with auto-weapon control system

 

By advance, thank tou guys

Share this post


Link to post
Share on other sites

@ALPHIVE,

Try something like this in the ON ACTIVATION field of your trigger,

{ removeAllWeapons _x } forEach units thislist;

Have fun!

Share this post


Link to post
Share on other sites

Units thislist is the problem just use thislist

  • Like 2

Share this post


Link to post
Share on other sites

Like this.  My bad,

{ removeAllWeapons _x } forEach thislist;

Have fun!

  • Like 2
  • Thanks 1

Share this post


Link to post
Share on other sites

@ALPHIVE,

Quote

It doesnt work :/


It works, bro. I tested it before I posted. What's happening? Nothing?

Share this post


Link to post
Share on other sites

Yeah bro, nothing happens when i get inside the trigger :/ and i configured it well :/

 

When i get inside, my weapons are not removed :'(

Share this post


Link to post
Share on other sites

@ALPHIVE,

Quote

When i get inside, my weapons are not removed :'(

Does it return an error?

 

Have you tried putting,

hint "it worked!";

in the trigger without the script?

  • Like 1

Share this post


Link to post
Share on other sites
46 minutes ago, ALPHIVE said:

Yeah bro, nothing happens when i get inside the trigger 😕 and i configured it well 😕

 

When i get inside, my weapons are not removed 😢

then your trigger settings are messed up and its not firing, do what schatten said

  • Like 1

Share this post


Link to post
Share on other sites

Thank you for your help guys ;)

 

Here you can find my screenshot of my trigger configuration 1568145525-20190910215721-1.jpg

Share this post


Link to post
Share on other sites

This will only work for independents so just to be sure: you're not testing with a blufor soldier are you ?

Share this post


Link to post
Share on other sites

The problem is: you want to remove the weapon for units entering the trigger, (and perhaps, in a second time, you'd want to give them some kind of weapon for the pattern).

 

A trigger (repeatable) fires when the condition is met (here some indep unit present), applying the code on thisList (which is the list of compliant unit(s), usually the first one or the list at start if any). Why the first one while in game? Because the trigger scans the condition every 0,5 sec and it's harder to make 2 or more units entering at the same 0,5 sec slot. Once the condition is met, you need to deact the trigger to react it again. I'm far from Arma for testing but you need to deact (empty thisList) if you want to see a good result:

The condition could be:
this && thisList findIf {_x isKindOf "CAManBase" && !(count weapons _x isEqualTo 0)}  > -1

This way, the trigger will fire if an infantry unit has some weapon (vehicles are not concerned), and deact after it removes all weapons of thisList, so it should rearm at the next slot.

NOT TESTED

The second step, adding some other weapons, if any, needs to pass a variable on each disarmed unit, to be treated apart.

  • Like 2

Share this post


Link to post
Share on other sites

@pierremgi,

Quote

Once the condition is met, you need to deact the trigger to react it again


I only tested on a single player character. Now I understand. Trigger lists are not a "real-time" tally. A trigger creates its list at time of activation and fixes those values until it's fired again.

Share this post


Link to post
Share on other sites

Not exactly. thisList is updated every 0,5 sec. but the code runs only at each activation. So, you think thisList isn't updated but in fact the code needs to be fired again if you want to deal with this update. The only mean to re-run such code is to deactivate (make the condition wrong again) and play the repeat.

Share this post


Link to post
Share on other sites

Hi guys, thank you for your help 😉

 

So what i really write in condition, on activation ?

Share this post


Link to post
Share on other sites
10 hours ago, ALPHIVE said:

Hi guys, thank you for your help 😉

 

So what i really write in condition, on activation ?

Answered. Did you test it?

 

Share this post


Link to post
Share on other sites

this && thisList findIf {_x isKindOf "CAManBase" && !(count weapons _x isEqualTo 0)}  > -1

 

Your command worked thank you bro 😉 !

  • Like 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

×