• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Solved] Boolean-type Trigger Failure

Status
Not open for further replies.
SOLVED

I'm trying to create a trigger that creates a star where there are no other stars. For some reason it's not working, and it has to do with the Pick Each Unit function as I've tried other variations on this trigger, however when I attempt to get it to detect whether or not there is a star already there it just ignores it and carries on. I cannot figure out another way for the game to detect if there's a star there, though.

Aside from creating 100+ of each type of region (massive headache) to detect if theres a region in a region, this is my only option.

I've tried using "is there a star there? if yes, set variable to true. Is variable false? then create a star there" but it doesn't work, and instead just spawns a star there anyways.

-> Move region
-> Are there stars there?
-> No? Create a star
-> Yes? Try again

  • Move System
    • Events
      • Timer - Every 0.1 seconds of Game Time
    • Local Variables
    • Conditions
      • Total Solar Systems < Max Total Solar Systems
    • Actions
      • Unit Group - Pick each unit in Stars and do (Actions)
        • Actions
          • General - If (Conditions) then do (Actions) else do (Actions)
            • If
              • Or
                • Conditions
                  • ((Picked unit) is in System) == True
                  • ((Picked unit) is in Star) == True
            • Then
              • Region - Move Star to (Random point in (Playable map area))
              • Region - Move System to (Center of Star)
              • Region - Move Planet to (Random point in System)
            • Else
              • Variable - Modify Total Solar Systems: + 1
              • Trigger - Run Create System (Check Conditions, Don't Wait until it finishes)
  • Create System
    • Events
    • Local Variables
    • Conditions
    • Actions
      • Unit - Create 1 (Planet) Star (Orange) for player 0 at (Center of Star) using default facing (No Options)
      • Unit Group - Add (Last created unit) to Stars
      • General - If (Conditions) then do (Actions) else do (Actions)
        • If
          • Total Solar Systems >= Max Total Solar Systems
        • Then
          • Trigger - Run Scale Planets (Check Conditions, Wait until it finishes)
        • Else
Edit:
  • Move System
    • Events
      • Timer - Every 0.1 seconds of Game Time
    • Local Variables
    • Conditions
      • Total Solar Systems < Max Total Solar Systems
    • Actions
      • Region - Move Star to (Random point in (Playable map area))
      • Region - Move System to (Center of Star)
      • Region - Move Planet to (Random point in System)
      • General - If (Conditions) then do (Actions) else do (Actions)
        • If
          • ((Closest unit to (Center of Star) in Stars) is in Star) == False
        • Then
          • Trigger - Run Create System (Check Conditions, Don't Wait until it finishes)
        • Else
  • Create System
    • Events
    • Local Variables
    • Conditions
    • Actions
      • Unit - Create 1 (Planet) Star (Orange) for player 0 at (Center of Star) using default facing (No Options)
      • Unit Group - Add (Last created unit) to Stars
      • Variable - Modify Total Solar Systems: + 1
      • General - If (Conditions) then do (Actions) else do (Actions)
        • If
          • Total Solar Systems >= Max Total Solar Systems
        • Then
          • Trigger - Run Scale Planets (Check Conditions, Wait until it finishes)
        • Else
 
Last edited:
Use points instead of regions. And check the tutorial in my signature on leaks.

There are no leaks in the Sc2 editor thanks to the garbage collection system, and I don't see how points will solve my problem identifying if a unit is in the region, as you can only select specific points as function queries, you cannot ask if there are any points at all in a region.
 
Level 25
Joined
May 11, 2007
Messages
4,651
Oh sorry, it looked like Warcraft 3. (I used the New Posts button when replying to this). My bad :)
But still, like in Warcraft 3, use something like

planetPoints_Max = 10;
set tempPoint1 = position of Start;
for (int i = planetPoints_Max; i++)
{
set tempPoint2 = temppoint1 offset by 200 and angle 0;
set tempggroup = units within temppoint2 of unit-type == planet;
if units in tempgroup == 0;
create planet;
else
//Sing a song.
}

Very tired when typing this, but you should probably get an idea or so.
 
Oh sorry, it looked like Warcraft 3. (I used the New Posts button when replying to this). My bad :)
But still, like in Warcraft 3, use something like

planetPoints_Max = 10;
set tempPoint1 = position of Start;
for (int i = planetPoints_Max; i++)
{
set tempPoint2 = temppoint1 offset by 200 and angle 0;
set tempggroup = units within temppoint2 of unit-type == planet;
if units in tempgroup == 0;
create planet;
else
//Sing a song.
}

Very tired when typing this, but you should probably get an idea or so.

Found a workaround.
I was messing about with points, and decided I needed to create 100 of them and move each one individually if I wanted this done (lots of GUI triggers) when I tried something new and it worked.

OP is edited with fix.
 
Status
Not open for further replies.
Top