Could I get some help with a logic issue?

Nureru

New Member
Reaction score
1
Okay, here's my problem. I want it so creeps, when they reach a node, are replaced with a higher level creep, and then are sent to the next node. Here's my triggers:

The order trigger:
Trigger:
  • Order Node1
    • Events
      • Unit - A unit enters Node 1 <gen>
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Owner of (Entering unit)) Equal to Player 1 (Red)
          • (Owner of (Entering unit)) Equal to Player 7 (Green)
    • Actions
      • Set temp_group = (Units in Node 1 <gen> matching (((Matching unit) is A structure) Equal to True))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Or - Any (Conditions) are true
            • Conditions
              • (Unit-type of (Entering unit)) Equal to Wisp (Level 1)
              • (Unit-type of (Entering unit)) Equal to Wisp (Level 2)
              • (Unit-type of (Entering unit)) Equal to Wisp (Level 3)
              • (Unit-type of (Entering unit)) Equal to Wisp (Level 4)
              • (Unit-type of (Entering unit)) Equal to Wisp (Level 5)
              • (Unit-type of (Entering unit)) Equal to Wisp (Level 6)
              • (Unit-type of (Entering unit)) Equal to Wisp (Level 7)
          • (Unit-type of (Random unit from temp_group)) Equal to Node (Arcane)
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • node1switch Equal to True
            • Then - Actions
              • Set temp_point = (Center of Node 4 <gen>)
              • Set temp_unit = (Entering unit)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Level of Do Not Level for temp_unit) Not equal to 1
                • Then - Actions
                  • Trigger - Run Level Arcane <gen> (checking conditions)
                  • Unit - Add Do Not Level to temp_unit
                  • Unit - Set level of Do Not Level for temp_unit to 1
                • Else - Actions
              • Unit - Order temp_unit to Attack-Move To temp_point
              • Custom script: call RemoveLocation( udg_temp_point )
              • Set node1switch = False
            • Else - Actions
              • Set temp_point = (Center of Node 3 <gen>)
              • Set temp_unit = (Entering unit)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Level of Do Not Level for temp_unit) Not equal to 1
                • Then - Actions
                  • Trigger - Run Level Arcane <gen> (checking conditions)
                  • Unit - Add Do Not Level to temp_unit
                  • Unit - Set level of Do Not Level for temp_unit to 1
                • Else - Actions
              • Unit - Order temp_unit to Attack-Move To temp_point
              • Custom script: call RemoveLocation( udg_temp_point )
              • Set node1switch = True
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Or - Any (Conditions) are true
            • Conditions
              • (Unit-type of (Entering unit)) Equal to Grunt (Level 1)
              • (Unit-type of (Entering unit)) Equal to Grunt (Level 2)
              • (Unit-type of (Entering unit)) Equal to Grunt (Level 3)
              • (Unit-type of (Entering unit)) Equal to Grunt (Level 4)
              • (Unit-type of (Entering unit)) Equal to Grunt (Level 5)
              • (Unit-type of (Entering unit)) Equal to Grunt (Level 6)
              • (Unit-type of (Entering unit)) Equal to Grunt (Level 7)
          • (Unit-type of (Random unit from temp_group)) Equal to Node (Fel)
        • Then - Actions
          • Set temp_point = (Center of Team 1 Base <gen>)
          • Set temp_unit = (Entering unit)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Level of Do Not Level for temp_unit) Not equal to 1
            • Then - Actions
              • Trigger - Run Level Fel <gen> (checking conditions)
              • Unit - Add Do Not Level to temp_unit
              • Unit - Set level of Do Not Level for temp_unit to 1
            • Else - Actions
          • Unit - Order temp_unit to Attack-Move To temp_point
          • Custom script: call RemoveLocation( udg_temp_point )
        • Else - Actions
      • Custom script: call DestroyGroup( udg_temp_group )


The Levelup Trigger:
Trigger:
  • Level Arcane
    • Events
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of temp_unit) Equal to Wisp (Level 6)
        • Then - Actions
          • Set temp_count = (Integer((Percentage life of temp_unit)))
          • Set temp_point2 = (Position of temp_unit)
          • Unit - Remove temp_unit from the game
          • Unit - Create 1 Wisp (Level 7) for Player 1 (Red) at temp_point2 facing Default building facing degrees
          • Unit - Set life of (Last created unit) to (Real(temp_count))%
          • Set temp_unit = (Last created unit)
          • Custom script: call RemoveLocation( udg_temp_point2 )
          • Skip remaining actions
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Unit-type of temp_unit) Equal to Wisp (Level 5)
            • Then - Actions
              • Set temp_count = (Integer((Percentage life of temp_unit)))
              • Set temp_point2 = (Position of temp_unit)
              • Unit - Remove temp_unit from the game
              • Unit - Create 1 Wisp (Level 6) for Player 1 (Red) at temp_point2 facing Default building facing degrees
              • Unit - Set life of (Last created unit) to (Real(temp_count))%
              • Set temp_unit = (Last created unit)
              • Custom script: call RemoveLocation( udg_temp_point2 )
              • Skip remaining actions
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Unit-type of temp_unit) Equal to Wisp (Level 4)
                • Then - Actions
                  • Set temp_count = (Integer((Percentage life of temp_unit)))
                  • Set temp_point2 = (Position of temp_unit)
                  • Unit - Remove temp_unit from the game
                  • Unit - Create 1 Wisp (Level 5) for Player 1 (Red) at temp_point2 facing Default building facing degrees
                  • Unit - Set life of (Last created unit) to (Real(temp_count))%
                  • Set temp_unit = (Last created unit)
                  • Custom script: call RemoveLocation( udg_temp_point2 )
                  • Skip remaining actions
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Unit-type of temp_unit) Equal to Wisp (Level 3)
                    • Then - Actions
                      • Set temp_count = (Integer((Percentage life of temp_unit)))
                      • Set temp_point2 = (Position of temp_unit)
                      • Unit - Remove temp_unit from the game
                      • Unit - Create 1 Wisp (Level 4) for Player 1 (Red) at temp_point2 facing Default building facing degrees
                      • Unit - Set life of (Last created unit) to (Real(temp_count))%
                      • Set temp_unit = (Last created unit)
                      • Custom script: call RemoveLocation( udg_temp_point2 )
                      • Skip remaining actions
                    • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Unit-type of temp_unit) Equal to Wisp (Level 2)
                        • Then - Actions
                          • Set temp_count = (Integer((Percentage life of temp_unit)))
                          • Set temp_point2 = (Position of temp_unit)
                          • Unit - Remove temp_unit from the game
                          • Unit - Create 1 Wisp (Level 3) for Player 1 (Red) at temp_point2 facing Default building facing degrees
                          • Unit - Set life of (Last created unit) to (Real(temp_count))%
                          • Set temp_unit = (Last created unit)
                          • Custom script: call RemoveLocation( udg_temp_point2 )
                          • Skip remaining actions
                        • Else - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • (Unit-type of temp_unit) Equal to Wisp (Level 1)
                            • Then - Actions
                              • Set temp_count = (Integer((Percentage life of temp_unit)))
                              • Set temp_point2 = (Position of temp_unit)
                              • Unit - Remove temp_unit from the game
                              • Unit - Create 1 Wisp (Level 2) for Player 1 (Red) at temp_point2 facing Default building facing degrees
                              • Unit - Set life of (Last created unit) to (Real(temp_count))%
                              • Set temp_unit = (Last created unit)
                              • Custom script: call RemoveLocation( udg_temp_point2 )
                              • Skip remaining actions
                            • Else - Actions


It almost works, except it levels the creeps up a lot more than it ought to be. It will make some of them level 3, or 4, or 7, instead of just making the level 1 creeps level 2. I assume what it's doing is when the new creep is created, it enters the region for the trigger, and so it runs the trigger again for that creep. Help would be fantastic.

EDIT: Update, I've got it so it's mostly leveling them up to level 2, although sometimes one creep will be leveled to level 3 and I don't know why. However, now it won't tell them where to go properly. It sends all the creeps the same direction, except occasionally one will go the other way. Sometimes they don't even bother moving or leveling up or anything, they just ignore the trigger entirely it seems. This is driving me up the wall.

I'm going to include the map for download, so you can see exactly what is going on. I'd really appreciate help with this.
 

Attachments

  • Vinland Saga.w3x
    222.5 KB · Views: 82

skyblader

You're living only because it's illegal killing.
Reaction score
159
You can have a new trigger, that is on, with no events. Then once ur leveling process is finish, order ur trigger to run that trigger, then that trigger turns off the leveling trigger, waits for a set amount of time, then enable it again.
 

wellwish3r

wishes wells.
Reaction score
52
Several Issues.

First of
Trigger:
  • (Unit-type of (Random unit from temp_group)) Equal to Node (Arcane)


picks any random unit, which could be another unit that is in the region, or the entering unit itself, which causes issues.

Secondly:
You are checking if node1switch == true before you actually set it. This results in the condition referring to the last time the trigger ran. Now that might be what you want, or it might not be (haven't read that deep into the trigger).
 

Nureru

New Member
Reaction score
1
Several Issues.

First of
Trigger:
  • (Unit-type of (Random unit from temp_group)) Equal to Node (Arcane)


picks any random unit, which could be another unit that is in the region, or the entering unit itself, which causes issues.

Secondly:
You are checking if node1switch == true before you actually set it. This results in the condition referring to the last time the trigger ran. Now that might be what you want, or it might not be (haven't read that deep into the trigger).

To answer the first, the unit group is all the units in Node 1 that is a structure, and there will only ever be one structure in the region, so that seemed like the simplest way to do it. If there's a better way, shoot.

And as for the second, yeah, that's what I want. I want it to alternate which way it sends the creep.

If I had the trigger get turned off for a bit, then won't any creeps that enter the region during that duration not be leveled up?
 

wellwish3r

wishes wells.
Reaction score
52
well another thing you could to is to add some sort of sentinel to the unit, that is checked by the trigger, and then if the unit has a certain thing ignores it (this could be a buff or an ability without icon/in a disables spell book, that is removed after 3 seconds or so, but as long as the unit has it, the trigger will ignore the unit.
 

Nureru

New Member
Reaction score
1
Still having issues, edited the first post with an update and included the map.
 
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