"Capturing" a region. Need help!

B0ndo

New Member
Reaction score
4
Hi folks

I'd like to know if it's possible (and if, how) to make a trigger that will display a text to all players sayning "Team 1 has captured the middle" (example). If a certain region no longer contains a unit from team 2.

But as soon a unit from team 2 enters the region when no units from team 1 is currently within the region it will display a text saying "Team 2 has captured the middle" (example)

I hope someone gets my point and can help me out here :)

Cheers in advance
 

KaerfNomekop

Swim, fishies. Swim through the veil of steel.
Reaction score
613
Trigger:
  • Capture Region
    • Events
      • Unit - A unit leaves Region 1 <gen>
    • Conditions
    • Actions
      • Set TempUnitGroup = (Units in Region 1<gen> matching ((((Matching unit) belongs to an ally of Player 1 (Red)) Equal to True) and (((Matching unit) is alive) Equal to True)))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in TempUnitGroup) Equal to 0
        • Then - Actions
          • Game - Display to (All players) the text: Team 2 has captured Region 1!
        • Else - Actions
          • Set TempUnitGroup = (Units in Region 1 <gen> matching ((((Matching unit) belongs to an ally of Player 7 (Green)) Equal to True) and (((Matching unit) is alive) Equal to True)))
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Number of units in TempUnitGroup) Equal to 0
            • Then - Actions
              • Game - Display to (All players) the text: Team 1 has captured Region 1!
            • Else - Actions
      • Custom script: call DestroyGroup(udg_TempUnitGroup)


Are you looking for something like this? That is, assuming Player 1 is the first player of Team 1 and Player 7 is the first player of Team 2.
 

B0ndo

New Member
Reaction score
4
Yup that should in theory work, I'll report back to you later when I've tested it, cheers :)
 

B0ndo

New Member
Reaction score
4
When saying "Belongs to an ally of Player 1 (Red) does that include red himself? Or only his allies?
 

KaerfNomekop

Swim, fishies. Swim through the veil of steel.
Reaction score
613
It checks if the unit is considered an ally by Red. This includes his own units.
 

B0ndo

New Member
Reaction score
4
Well the trigger works, but it needs some tweaking, because everytime a unit of team 1 leaves the region it sends the text. So if no units from team 2 is currently in the region and 10 units from team 1 leaves the region at the same time it displays the text 10 times.

I guess I have to chance the event to... Unit - A unit dies perhabs?
 

B0ndo

New Member
Reaction score
4
No wait I'll make a variable and another condition and see if that works out. Brb.
 

B0ndo

New Member
Reaction score
4
This is my code, i added another variable and thought that might fix it, but it doesn't, now it doesn't even send any game txts.

I need help here!

Trigger:
  • Untitled Trigger 001
    • Events
      • Unit - A unit leaves Center Reg <gen>
    • Conditions
    • Actions
      • Set TempUnitGroup = (Units in Center Reg <gen> matching ((((Matching unit) belongs to an ally of Player 11 (Dark Green)) Equal to True) and (((Matching unit) is alive) Equal to True)))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in TempUnitGroup) Equal to 0
          • CaptureChecker Equal to 0
        • Then - Actions
          • Game - Display to (All players) the text: Team 1 has captured...
          • Set CaptureChecker = 1
        • Else - Actions
          • Set TempUnitGroup = (Units in Center Reg <gen> matching ((((Matching unit) belongs to an ally of Player 12 (Brown)) Equal to True) and (((Matching unit) is alive) Equal to True)))
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Number of units in TempUnitGroup) Equal to 0
              • CaptureChecker Equal to 1
            • Then - Actions
              • Game - Display to (All players) the text: Team 2 has captured...
              • Set CaptureChecker = 0
            • Else - Actions
      • Custom script: call DestroyGroup(udg_TempUnitGroup)
 

KaerfNomekop

Swim, fishies. Swim through the veil of steel.
Reaction score
613
What you want is to Turn Off this trigger whenever the region is captured, then have a separate trigger turned on at the same time. The other trigger will run whenever the region is (uncaptured, I guess?), turn itself off and turn this one on again.
 

B0ndo

New Member
Reaction score
4
So shall i seperate the trigger into 2 triggers 1 for each team and turn the trigger off after it has displayed the text? But i don't see how that'll help so I might need a demonstration if you got time? :)
 

KaerfNomekop

Swim, fishies. Swim through the veil of steel.
Reaction score
613
I wish I could. But exams around the corner, and a bunch of projects to rush. Basically you want this trigger to turn itself off whenever there are no units of a certain team in it. You also want another trigger that runs whenever a unit leaves the region, and if there are no more units inside, then turn this trigger back on.
 

B0ndo

New Member
Reaction score
4
Alright np mate, good luck with those projects and exams, I'll try myself, and thanks for your help! +rep
 

NeuroToxin

New Member
Reaction score
46
Just a quick thing B0ndo.
Don't triple or double post, both of which you did above.
Just edit your most recent reply.
 

B0ndo

New Member
Reaction score
4
Oh okay, I appoligize.

OFF-TOPIC: Is that because of the massive traffic on thehelper.net? To like keep the posts down to the minimum?

You don't have to answer btw :)
 

NeuroToxin

New Member
Reaction score
46
No, it's mainly to stop users from "bumping" their thread, and that, but at the same time, you can't post three times, as it keeps pushing your thread up to the top of the unread threads.
 

educator

New Member
Reaction score
9
umm, maybe instead of on unit entry, how bout a "capture" abilty, (prob instant cast) that if cast by a unit in the region does the stuffs u want. just suggesting this coz iv had triggers bug out on me with "unit enters region"
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top