• 0

    posted a message on [Trigger] Changing ownership of a structure w/ regions

    I'm still new to the editor, so bear with me. Maybe this has been answered elsewhere already, but I've had no luck with the search function so far.

    Here's the situation:

    I have a structure that I want to change hands based on the number of players within a region, with some very specific restrictions:

    1. If only 1 player is present in the region, control is given to him.
    2. If more than one player is present, control is returned to the neutral player.
    3. If no units are present, control is returned to neutral.

    Essentially, it operates like the Xel'naga watchtower. Simple stuff, you'd think.

    I've managed to accomplish the basic idea by setting a variable to increment or decrement whenever a unit enters or leaves a region, and a trigger that fires once every so often to check the number of players present, and set control back to neutral as necessary. I can even set control of the structure to whichever unit enters the region first. The problem comes in when it's time to determine who's still remaining in the region upon 1 player leaving. Also, the event that is triggered is Any UNIT entering the region. if one player brings in say a whole ball of Marines, each one would fire the trigger, incrementing the variable and breaking the trigger.

    TLDR Version:

    How do I tell how many PLAYERS are present (regardless of the amount of units) in a given region, and give control of a structure to the player if he's the only one present at a given time?

    There's probably a simple elegant way of doing this that I'm completely overlooking, so feel free to make me feel dumb for missing it. This system of controllable nodes is kind of the central theme of my entire map, so any help you can give would be great.

    Posted in: Triggers
  • To post a comment, please or register a new account.