Announcement

Collapse
No announcement yet.

Check if all trucks are in the trigger area - need help

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Check if all trucks are in the trigger area - need help

    Hi guys.

    There is 10 repair trucks on the map. I would like a trigger to activate, when 4 trucks are in trigger area.

    I just don't know what to put in condition, can you help me out?

  • #2
    Re: Check if all trucks are in the trigger area - need help

    Code:
    this && ({typeOf _x == "repairTruckClassName"} count thisList) > 3
    Something like that. Replace "repairTruckClassName" with the class name of the repair truck (get it with a hint format["%1", typeOf this]; in the init of the object).

    The trigger might not fire for empty trucks, not sure.

    Comment


    • #3
      Re: Check if all trucks are in the trigger area - need help

      Originally posted by beita View Post
      Code:
      this && ({typeOf _x == "repairTruckClassName"} count thisList) > 3
      Something like that. Replace "repairTruckClassName" with the class name of the repair truck (get it with a hint format["%1", typeOf this]; in the init of the object).

      The trigger might not fire for empty trucks, not sure.
      It works, thanks beita! :).

      Comment


      • #4
        Re: Check if all trucks are in the trigger area - need help

        ...or if you want to designate specific named units (perhaps with different types, like repair trucks, an ammo truck, and an LAV HQ)...

        trucksInTrigger = ["mtvr_repair1", "mtvr_repair2", "mtvr_reammo1", "lav_hq" ...etc];
        triggerCount = 0;
        { if (_x in trucksInTrigger) then { triggerCount++; }; } forEach trucksInTrigger;
        if (triggerCount > 3) then { true; } else { false; }

        ...and you can always publicVariable the trucks array so the values can be used in other scripts (maybe if too many are destroyed trigger a failed ending or something).

        Comment


        • #5
          Re: Check if all trucks are in the trigger area - need help

          Pretty sure you can't use an increment thing like that.

          triggerCount++; needs to be triggerCount = triggerCount + 1;

          It is ALMOST C heh.

          Comment


          • #6
            Re: Check if all trucks are in the trigger area - need help

            Originally posted by beita View Post
            Pretty sure you can't use an increment thing like that.

            triggerCount++; needs to be triggerCount = triggerCount + 1;

            It is ALMOST C heh.
            Um, uh... oops. :D

            Comment

            Connect

            Collapse

            TeamSpeak 3 Server

            Collapse

            Advertisement

            Collapse

            Twitter Feed

            Collapse

            Working...
            X