Trigger spawning help

xKxIxNxGx

New Member
Reaction score
3
In this TD we want the spawn to be based off of the bounty you can get per round. lets say 20... We have different units that have different values.. It would randomly pick those units and those values would add up to 20.
Example.
Boss=3
Tanks=2
Flying=2
others=1
so maybe one round a boss(+3) no tanks 5 flying (+10) and 7 other (+7) would equal 20. But. for some reason it works like a charm for the first couple rounds but after words they spawn in groups. So we started to see if we did the trigger right. So we maybe it after the round starts it would tell us exactly what spawned.. but after that few couple rounds the numbers say this, but the spawn doesn't look like what was just said. So we think the actuall getting the group to spawn is correct but the part of spawning gets messed up or something... It's complicated to say, but I hope this helps... Here is the code

Trigger:
  • TRIGGER 004
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Ability being cast) Equal to Next round
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Number of units in (Units in PLYR_Region[(Player number of (Owner of (Casting unit)))] owned by Player 12 (Brown))) Equal to 0
            • Then - Actions
              • Set SPWN_Active[(Player number of (Owner of (Casting unit)))] = True
            • Else - Actions
              • Set SPWN_Active[(Player number of (Owner of (Casting unit)))] = False
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • SPWN_Active[(Player number of (Owner of (Casting unit)))] Equal to False
            • Then - Actions
              • Game - Display to (Player group((Owner of (Casting unit)))) the text: (|cffCC0000Round |cffBCAC00 + ((String(PLYR_ROUND[(Player number of (Owner of (Casting unit)))])) + |r|cffCC0000 is already in progress|r))
              • Skip remaining actions
            • Else - Actions
          • Trigger - Turn off (This trigger)
          • Set SPWN_Active[(Player number of (Owner of (Casting unit)))] = False
          • Set PLYR_ROUND[(Player number of (Owner of (Casting unit)))] = (PLYR_ROUND[(Player number of (Owner of (Casting unit)))] + 1)
          • Set SPWN_Health[(Player number of (Owner of (Casting unit)))] = (((Power((Real(PLYR_ROUND[(Player number of (Owner of (Casting unit)))])), 2.00)) + 4.00) x DIFF_Health[(Player number of (Owner of (Casting unit)))])
          • Multiboard - Set the text for (Last created multiboard) item in column 4, row MLTI_Player_placement[(Player number of (Owner of (Casting unit)))] to (PLYR_Color[(Player number of (Owner of (Casting unit)))] + (String(PLYR_ROUND[(Player number of (Owner of (Casting unit)))])))
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (PLYR_ROUND[(Player number of (Owner of (Casting unit)))] mod Levls_per_BNTY_increese) Equal to 0
            • Then - Actions
              • Set BNTY_Multi[(Player number of (Owner of (Casting unit)))] = (BNTY_Multi[(Player number of (Owner of (Casting unit)))] + 1)
              • Set SPAWN_Extra_Zombies[(Player number of (Owner of (Casting unit)))] = (SPAWN_Extra_Zombies[(Player number of (Owner of (Casting unit)))] + 1)
            • Else - Actions
          • Set SPWN_Total = (SPWN_Gold_per_Round[(Player number of (Owner of (Casting unit)))] + SPAWN_Extra_Zombies[(Player number of (Owner of (Casting unit)))])
          • Game - Display to (All players) the text: (String(SPWN_Total))
          • Set SPWN_Queen_int[1] = (Random integer number between 0 and 1)
          • Set SPWN_Total = (SPWN_Total - (SPWN_Queen_int[1] x SPWN_Type_gold[5]))
          • Set SPWN_Crawler_int[1] = (Random integer number between 0 and ((SPWN_Total / 4) / SPWN_Type_gold[3]))
          • Set SPWN_Total = (SPWN_Total - (SPWN_Crawler_int[1] x SPWN_Type_gold[3]))
          • Set SPWN_Runner_int[1] = (Random integer number between 0 and ((SPWN_Total / 2) / SPWN_Type_gold[2]))
          • Set SPWN_Total = (SPWN_Total - (SPWN_Runner_int[1] x SPWN_Type_gold[2]))
          • Set SPWN_Tank_int[1] = (Random integer number between 0 and ((SPWN_Total / 2) / SPWN_Type_gold[4]))
          • Set SPWN_Total = (SPWN_Total - (SPWN_Tank_int[1] x SPWN_Type_gold[4]))
          • Set SPWN_Flying_int[1] = (Random integer number between 0 and (SPWN_Total / SPWN_Type_gold[6]))
          • Set SPWN_Total = (SPWN_Total - (SPWN_Flying_int[1] x SPWN_Type_gold[6]))
          • Set SPWN_Normal_int[1] = SPWN_Total
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • SPWN_Normal_int[1] Greater than or equal to 1
            • Then - Actions
              • For each (Integer A) from 1 to SPWN_Normal_int[1], do (Actions)
                • Loop - Actions
                  • Unit - Create 1 SPWN_Normal[(Random integer number between 1 and SPWN_Normal_int[0])] for (Owner of (Casting unit)) at SPWN_Start_pt[(Player number of (Owner of (Casting unit)))] facing Default building facing degrees
                  • Unit - Change ownership of (Last created unit) to Player 12 (Brown) and Retain color
                  • Unit - Order (Last created unit) to Move To SPWN_End_pt[(Player number of (Owner of (Casting unit)))]
                  • Unit - Set life of (Last created unit) to SPWN_Health[(Player number of (Owner of (Casting unit)))]
                  • Unit - Set the custom value of (Last created unit) to ((1000 x (Player number of (Owner of (Casting unit)))) + (100 x 1))
              • Set ABT_Number = SPWN_Normal_int[1]
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • SPWN_Runner_int[1] Greater than or equal to 1
            • Then - Actions
              • Wait 0.25 seconds
              • For each (Integer A) from 1 to SPWN_Runner_int[1], do (Actions)
                • Loop - Actions
                  • Unit - Create 1 SPWN_Runner[(Random integer number between 1 and SPWN_Runner_int[0])] for (Owner of (Casting unit)) at SPWN_Start_pt[(Player number of (Owner of (Casting unit)))] facing Default building facing degrees
                  • Unit - Change ownership of (Last created unit) to Player 12 (Brown) and Retain color
                  • Unit - Order (Last created unit) to Move To SPWN_End_pt[(Player number of (Owner of (Casting unit)))]
                  • Unit - Set life of (Last created unit) to SPWN_Health[(Player number of (Owner of (Casting unit)))]
                  • Unit - Set the custom value of (Last created unit) to ((1000 x (Player number of (Owner of (Casting unit)))) + (100 x 2))
              • Set ABT_Number = (ABT_Number + SPWN_Runner_int[1])
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • SPWN_Crawler_int[1] Greater than or equal to 1
            • Then - Actions
              • Wait 0.25 seconds
              • For each (Integer A) from 1 to SPWN_Crawler_int[1], do (Actions)
                • Loop - Actions
                  • Unit - Create 1 SPWN_Crawler[(Random integer number between 1 and SPWN_Crawler_int[0])] for (Owner of (Casting unit)) at SPWN_Start_pt[(Player number of (Owner of (Casting unit)))] facing Default building facing degrees
                  • Unit - Change ownership of (Last created unit) to Player 12 (Brown) and Retain color
                  • Unit - Order (Last created unit) to Move To SPWN_End_pt[(Player number of (Owner of (Casting unit)))]
                  • Unit - Set life of (Last created unit) to SPWN_Health[(Player number of (Owner of (Casting unit)))]
                  • Unit - Set the custom value of (Last created unit) to ((1000 x (Player number of (Owner of (Casting unit)))) + (100 x 3))
              • Set ABT_Number = (ABT_Number + SPWN_Crawler_int[1])
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • SPWN_Flying_int[1] Greater than or equal to 1
            • Then - Actions
              • For each (Integer A) from 1 to SPWN_Flying_int[1], do (Actions)
                • Loop - Actions
                  • Unit - Create 1 SPWN_Flying[(Random integer number between 1 and SPWN_Flying_int[0])] for (Owner of (Casting unit)) at (SPWN_Start_pt[(Player number of (Owner of (Casting unit)))] offset by (-256.00 + (32.00 x (Real((Integer A))))) towards 0.00 degrees) facing Default building facing degrees
                  • Unit - Change ownership of (Last created unit) to Player 12 (Brown) and Retain color
                  • Unit - Order (Last created unit) to Move To SPWN_End_pt[(Player number of (Owner of (Casting unit)))]
                  • Unit - Set life of (Last created unit) to (SPWN_Health[(Player number of (Owner of (Casting unit)))] x 0.85)
                  • Unit - Set the custom value of (Last created unit) to ((1000 x (Player number of (Owner of (Casting unit)))) + (100 x 6))
              • Set ABT_Number = (ABT_Number + SPWN_Flying_int[1])
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • SPWN_Tank_int[1] Greater than or equal to 1
            • Then - Actions
              • Wait 0.25 seconds
              • For each (Integer A) from 1 to SPWN_Tank_int[1], do (Actions)
                • Loop - Actions
                  • Unit - Create 1 SPWN_Tank[(Random integer number between 1 and SPWN_Tank_int[0])] for (Owner of (Casting unit)) at SPWN_Start_pt[(Player number of (Owner of (Casting unit)))] facing Default building facing degrees
                  • Unit - Change ownership of (Last created unit) to Player 12 (Brown) and Retain color
                  • Unit - Order (Last created unit) to Move To SPWN_End_pt[(Player number of (Owner of (Casting unit)))]
                  • Unit - Set life of (Last created unit) to (SPWN_Health[(Player number of (Owner of (Casting unit)))] x 1.50)
                  • Unit - Set the custom value of (Last created unit) to ((1000 x (Player number of (Owner of (Casting unit)))) + (100 x 4))
              • Set ABT_Number = (ABT_Number + SPWN_Tank_int[1])
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • SPWN_Queen_int[1] Greater than or equal to 1
            • Then - Actions
              • Wait 0.25 seconds
              • For each (Integer A) from 1 to SPWN_Queen_int[1], do (Actions)
                • Loop - Actions
                  • Unit - Create 1 SPWN_Queen[(Random integer number between 1 and SPWN_Queen_int[0])] for (Owner of (Casting unit)) at SPWN_Start_pt[(Player number of (Owner of (Casting unit)))] facing Default building facing degrees
                  • Unit - Change ownership of (Last created unit) to Player 12 (Brown) and Retain color
                  • Unit - Set life of (Last created unit) to (SPWN_Health[(Player number of (Owner of (Casting unit)))] x 3.00)
                  • Unit - Order (Last created unit) to Move To SPWN_End_pt[(Player number of (Owner of (Casting unit)))]
                  • Unit - Set the custom value of (Last created unit) to ((1000 x (Player number of (Owner of (Casting unit)))) + (100 x 1))
            • Else - Actions
          • Trigger - Turn on (This trigger)
        • Else - Actions


The Variable ABT_number or w/e is useless so ignore it... We don't think it's the problem either...

The screen shots..
http://img189.imageshack.us/gal.php?g=wc3scrnshot071509232325.jpg
 

Weegee

Go Weegee!
Reaction score
102
Are the units supposed to spawn in groups?

And can you post a picture of it or maybe your map? Or just change your code to wc3 tags? :p
 

xKxIxNxGx

New Member
Reaction score
3
There are suppose to be a mixed amount of units.. not all flying or all one type.. A mixed variety.. and I know randomness does get the all grouped together, that's really not the problem.. The problem is the spawn doesn't match the randomness we did...
Okay, I will get a screen shot.. That should help...

Well when I went to get the screen shot.. It never happnened.. So it must be really rare... I will come back if it occurs again...
 

xKxIxNxGx

New Member
Reaction score
3
two days later. My friend and I have been trying to fix this problem. But we don't see it.. It would be very greatly appreciated if this could be looked at. If anyone has anymore questions please feel free to ask.
 

asipo

New Member
Reaction score
15
Usually...weird problem cause by the loop is because of the Integer A loop

Try to create an integer variable called counter123

Then change the
For each (Integer A) from 1 to SPWN_Tank_int[1], do (Actions)
into
For each (counter123) from 1 to SPWN_Tank_int[1], do (Actions)

Please remember each loop require one unique variable
So if the trigger use 2 loop
Then you need to create counter123 and counter456

Why need to have unique variable for each loop?
The Integer A will collide with each other if there is 2 trigger using it

Hope this help
p/s: I didnt read all the code you put since its too long, just some personal exp from developing with GUI.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +2
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    New recipe is another summer dessert Berry and Peach Cheesecake - https://www.thehelper.net/threads/recipe-berry-and-peach-cheesecake.194169/

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top