Home   Help Search Login Register  

Author Topic: [A2OA] Counting objects in trigger, triggering when empty  (Read 1367 times)

0 Members and 1 Guest are viewing this topic.

Offline indianz

  • Members
  • *
I'm using R3F Artillery and Logistic scripts for loading/unloading objects from and to vehicles. The general idea is that x placed and named objects (Land_Wicker_basket_EP1 named BA1, BA2 and so forth) will be loaded and moved from a trigger (area1) and thus, when no longer present, triggering something.

Since I'm n00blar with scripting, figuring out which way to implement this is really hard. I've been trying something like:

Trigger name: area1
Condition: {_x in thisList} count [BA1, BA2, etc...] < 1
Act: Hint ("Done");

But I can't get it to work. Once again, not sure if this is the best way or not. Help, instructions and suggestions very much appreciated!

Offline bardosy

  • Honoured Contributor
  • ***
  • campaign designer
    • CartooDiv
Re: [A2OA] Counting objects in trigger, triggering when empty
« Reply #1 on: 18 Sep 2010, 19:31:56 »
i would do different. i would put an object in the center of area1 (even non visible object like gamelogic) named area1obj. And then place a trigger with condition this:
(ba1 distance area1obj greater 100) and (ba2 distance area1obj greater 100) and ... etc

( in my cellphone there is no greater sign, so please replace the word 'greater' to greater-sign.)

This trigger will activate if all ba object is far as 100m from the center of area1.
Fix bayonet!

Offline Wolfrug

  • Addons Depot
  • Former Staff
  • ****
  • Official OFPEC Old Timer
Re: [A2OA] Counting objects in trigger, triggering when empty
« Reply #2 on: 18 Sep 2010, 19:39:46 »
Well, actually your first version should work just fine - the problem might be the Activated By! I -think- empty objects should be under the Civilian side, so make sure it's activated by that. Otherwise, you could try placing a trigger, condition true, on activation: hint str (thisList)

Then it should tell you what's 'inside' it: if the empty objects don't show up under any "activated by" (Anybody, Civilian...don't know what else you could try) then that won't cut it. bardosy's solution seems a good alternative one, but it's easier to do that one in just one command:

Code: [Select]
{(_x distance area1obj) > 100} count [BA1, BA2, BA3...] < 1
Also I'm not sure if it'll work if the objects are deleted in the script (I don't think they are...but you never know). Finally, have you considered the possibility that the objects, as part of the script, are for instance attached 1000000 meters on top of the object transporting them or something like that? Triggers don't care for vertical distance, which would mean they'd still be inside the trigger area (in which case you'd need an alternative solution again).

But first: try changing the "activated by" to Civilian ;)

Wolfrug out.
 
"When 900 years YOU reach, look as good you will not!"

Offline indianz

  • Members
  • *
Re: [A2OA] Counting objects in trigger, triggering when empty
« Reply #3 on: 18 Sep 2010, 20:00:03 »
bardosy, Wolfrug - Thank you! I am very much obliged.

The distance area1obj version works very well in this case, as the main idea is fulfilled (trigger when away from a small area/obj, never to return).

I can't believe that it was that simple! I've been working on this, embarrassingly enough, for many hours and all that needed to change was the act by. Once it was switched to Civilian, it worked like a charm. Will end up using that just... because.

I am also happy to learn new syntax. So, once again, thanks!!