• 🏆 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!

SC2's Engine worse than WC3's?

Status
Not open for further replies.
Level 10
Joined
Jul 22, 2007
Messages
261
Im making a map where it has a lot of on hit checks. In SC2 i get a Too Many Threads error and all the triggers stop working, in WC3 i made the same functions and i got no problems. does Sc2 have a worse engine than WC3's lol

also if anyone knows a way to fix that Too Many scripts error feel free to post.
 
Level 19
Joined
Aug 8, 2007
Messages
2,765
Lol. what he is saying is, the sc2 engine is better than the wc3, its just different. You cant do the same things, but u can do more advanced things if u know how to do them correctly with the sc2 engine. The trigger error thing is because ur treating it like a WC3 map, not sc2.
 

Dr Super Good

Spell Reviewer
Level 63
Joined
Jan 18, 2005
Messages
27,197
It serves you right for abusing events like you did in WC3.

In SC2, you simply use a couple of events to run all the code you want. For example if you have a lot of on attack triggers (for some reason as you can use any effect for an attack) you just have a couple of triggers run all the effects. For example all upgrade related on attack effects from one while the actual game play effects on another.

In WC3 people had the bad habbit of making 100s of triggers with on attack events meaning there are 100s of event handles, 100s of triggers to evaluate ETC which is kind of dumb from a programming point of view. SC2 actually tells you its dumb cause their smarter code system can not handle 100s of threads at once to prevent thread abuse (you could lock up WC3 by creating 10000s of threads with an infinite wait loop).

I just advise programming better and trying to bundle code together. it is far more efficent to have the same code run consecutivly in 1 thread than making 2 threads to run the code in parrallel (still its in series physically but can be considered in parallel in the way it can behave).
 
Level 10
Joined
Jul 22, 2007
Messages
261
did that still gave error

  • On Hit AI
    • Events
      • Unit - Any Unit is attacked
    • Local Variables
    • Conditions
      • Or
        • Conditions
          • (Controller of player (Owner of (Triggering unit))) == Computer
          • (Controller of player (Owner of (Triggering unit))) == None
    • Actions
      • General - If (Conditions) then do (Actions) else do (Actions)
        • If
          • Or
            • Conditions
              • ((Triggering unit) Energy (Percent) (Current)) >= 30.0
              • ((Triggering unit) Life (Percent) (Current)) <= 40.0
        • Then
          • General - If (Conditions) then do (Actions) else do (Actions)
            • If
              • (Unit type of (Triggering unit)) == Banshee
            • Then
              • Unit - Order (Triggering unit) to (Banshee - Cloak (Banshee)) (Replace Existing Orders)
            • Else
              • General - If (Conditions) then do (Actions) else do (Actions)
                • If
                  • (Unit type of (Triggering unit)) == Ghost
                • Then
                  • Unit - Order (Triggering unit) to (Ghost - Cloak (Ghost)) (Replace Existing Orders)
                • Else
        • Else
      • General - If (Conditions) then do (Actions) else do (Actions)
        • If
          • ((Triggering unit) can attack (Attacking Unit)) == false
        • Then
          • General - If (Conditions) then do (Actions) else do (Actions)
            • If
              • (Unit type of (Triggering unit)) == Viking (Assault Mode)
            • Then
              • Unit - Order (Triggering unit) to (Viking - Fighter Mode) (Replace Existing Orders)
            • Else
              • General - If (Conditions) then do (Actions) else do (Actions)
                • If
                  • (Unit type of (Triggering unit)) == Viking (Fighter Mode)
                • Then
                  • Unit - Order (Triggering unit) to (Viking - Assault Mode) (Replace Existing Orders)
                • Else
        • Else
      • General - If (Conditions) then do (Actions) else do (Actions)
        • If
          • (Unit type of (Triggering unit)) == Stalker
          • Or
            • Conditions
              • ((Triggering unit) Shields (Percent) (Current)) == 0.0
              • ((Triggering unit) Life (Percent) (Current)) <= 40.0
        • Then
          • Unit - Order (Triggering unit) to (Stalker - Blink targeting ((Position of (Triggering unit)) offset by 7.9 towards (Facing of (Attacking Unit)) degrees)) (Replace Existing Orders)
        • Else
      • General - If (Conditions) then do (Actions) else do (Actions)
        • If
          • ((Triggering unit) Life (Percent) (Current)) <= 40.0
        • Then
          • General - If (Conditions) then do (Actions) else do (Actions)
            • If
              • (Unit type of (Triggering unit)) == Baneling
            • Then
              • Unit - Order (Triggering unit) to (Baneling - Burrow) (Replace Existing Orders)
              • General - Wait for (Conditions), checking every 5.0 Game Time seconds
                • Conditions
                  • ((Triggering unit) Life (Percent) (Current)) >= 75.0
              • Unit - Order (Triggering unit) to (Baneling - Unburrow) (Replace Existing Orders)
              • Unit - Order (Triggering unit) to ( Attack targeting (Position of Player Base[(Owner of (Triggering unit))])) (After Existing Orders)
            • Else
              • General - If (Conditions) then do (Actions) else do (Actions)
                • If
                  • (Unit type of (Triggering unit)) == Hydralisk
                • Then
                  • Unit - Order (Triggering unit) to (Hydralisk - Burrow) (Replace Existing Orders)
                  • General - Wait for (Conditions), checking every 5.0 Game Time seconds
                    • Conditions
                      • ((Triggering unit) Life (Percent) (Current)) >= 75.0
                  • Unit - Order (Triggering unit) to (Hydralisk - Unburrow) (Replace Existing Orders)
                  • Unit - Order (Triggering unit) to ( Attack targeting (Position of Player Base[(Owner of (Triggering unit))])) (After Existing Orders)
                • Else
                  • General - If (Conditions) then do (Actions) else do (Actions)
                    • If
                      • (Unit type of (Triggering unit)) == Infestor (Spellcaster)
                    • Then
                      • Unit - Order (Triggering unit) to (Infestor - Burrow) (Replace Existing Orders)
                      • General - Wait for (Conditions), checking every 5.0 Game Time seconds
                        • Conditions
                          • ((Triggering unit) Life (Percent) (Current)) >= 75.0
                      • Unit - Order (Triggering unit) to (Infestor - Unburrow) (Replace Existing Orders)
                      • Unit - Order (Triggering unit) to ( Attack targeting (Position of Player Base[(Owner of (Triggering unit))])) (After Existing Orders)
                    • Else
                      • General - If (Conditions) then do (Actions) else do (Actions)
                        • If
                          • (Unit type of (Triggering unit)) == Roach
                        • Then
                          • Unit - Order (Triggering unit) to (Roach - Burrow) (Replace Existing Orders)
                          • General - Wait for (Conditions), checking every 5.0 Game Time seconds
                            • Conditions
                              • ((Triggering unit) Life (Percent) (Current)) >= 75.0
                          • Unit - Order (Triggering unit) to (Roach - Unburrow) (Replace Existing Orders)
                          • Unit - Order (Triggering unit) to ( Attack targeting (Position of Player Base[(Owner of (Triggering unit))])) (After Existing Orders)
                        • Else
                          • General - If (Conditions) then do (Actions) else do (Actions)
                            • If
                              • (Unit type of (Triggering unit)) == Ultralisk
                            • Then
                              • Unit - Order (Triggering unit) to (Ultralisk - Burrow) (Replace Existing Orders)
                              • General - Wait for (Conditions), checking every 5.0 Game Time seconds
                                • Conditions
                                  • ((Triggering unit) Life (Percent) (Current)) >= 75.0
                              • Unit - Order (Triggering unit) to (Ultralisk - Unburrow) (Replace Existing Orders)
                              • Unit - Order (Triggering unit) to ( Attack targeting (Position of Player Base[(Owner of (Triggering unit))])) (After Existing Orders)
                            • Else
                              • General - If (Conditions) then do (Actions) else do (Actions)
                                • If
                                  • (Unit type of (Triggering unit)) == Zergling
                                • Then
                                  • Unit - Order (Triggering unit) to (Zergling - Burrow) (Replace Existing Orders)
                                  • General - Wait for (Conditions), checking every 5.0 Game Time seconds
                                    • Conditions
                                      • ((Triggering unit) Life (Percent) (Current)) >= 75.0
                                  • Unit - Order (Triggering unit) to (Zergling - Unburrow) (Replace Existing Orders)
                                  • Unit - Order (Triggering unit) to ( Attack targeting (Position of Player Base[(Owner of (Triggering unit))])) (After Existing Orders)
                                • Else
        • Else
 

Dr Super Good

Spell Reviewer
Level 63
Joined
Jan 18, 2005
Messages
27,197
I advise disabling stuff in the triggers until you find the cause of the too many thread errors. For example start by disabling all the actions but a debug message one and seeing if the error occurs. Then slowly turn them on 1 by 1 until the thread error appears.

There are 2 possible causes, an infinite loop or a bug as far as I can see at a glance.
 
Status
Not open for further replies.
Top