Home   Help Search Login Register  

Author Topic: Triggers arent deleting...  (Read 1510 times)

0 Members and 1 Guest are viewing this topic.

Offline 456820

  • Contributing Member
  • **
Triggers arent deleting...
« on: 15 Sep 2007, 21:51:48 »
Well I have a very big mission set up covering essentially the entire island.
I have included several triggers to remove certain areas of the island which can be chosen by the admin by slecting the parameter.

Code: [Select]
titleParam1 = Enemy;
valuesParam1[] = {1,2,3,4};
defValueParam1 = 1;
textsParam1[] = {Enemy North + South ,Enemy South , Enemy North, No Enemy};

Thats my description.ext bit which sets up the parameter.
Now the triggers are...


Set to repeatedly and Anybody present

CONDITION:
Code: [Select]
this and param1 == 3 or param1 == 4ON ACTIVATION:
Code: [Select]
{deletevehicle _this} foreach thislist; deletevehicle trig_setup1_1
I have 3 other triggers to match with the other parameter options all the same apart from the condition is changed.

When I play the game, doesnt matter what parameter I set it to the enemy are always there. Is there something wrong anywhere? Cheers.

Also this doesnt work in SP either.

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: Triggers arent deleting...
« Reply #1 on: 16 Sep 2007, 12:37:11 »
For the condition, you need to be sure to take operator precedence into account (and binds higher than or, so currently, if param1 == 4, then the trigger might fire before thisList is filled, though I'm not sure it would matter in this particular case):
Code: [Select]
this and param1 == 3 or param1 == 4 // This acts as "(this and param1 == 3) or param1 == 4
Should be
Code: [Select]
this and (param1 == 3 or param1 == 4) // Alternatively, use "this and (param1 in [3,4])"

In forEach blocks, each iteration sets _x, not _this, to the item. Thus it should be,
Code: [Select]
{deletevehicle _x} foreach thislist;

I'm sure it is the latter issue that is causing your problem, but the former is good practice anyway.
« Last Edit: 16 Sep 2007, 12:39:16 by Spooner »
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)

Offline 456820

  • Contributing Member
  • **
Re: Triggers arent deleting...
« Reply #2 on: 16 Sep 2007, 15:11:13 »
Thanks, shall give this a go asap.
Shall report back

Edit - Ah damn it. Whilst copying the syntax into the triggers I realised why it wasnt working. mixed _x with _this, im more rusty then i thought.

Anyway works perfectly now. Thank you.
« Last Edit: 16 Sep 2007, 15:48:26 by 456820 »