Why is this trigger crashing my map?

Uszi

New Member
Reaction score
5
So, the following triggers deal with barricades and zombie AI in a survival map I've been working on...

Basically, with the barricades, I've found that making them units that the zombies can walk around makes it a lot easier on me, because if the zombies couldn't walk through them their default AI has them start running around all willy nilly trying to find a path into the base.

The problem now is that I needed to create several triggers that force the zombies to attack the barricades rather than just walk through.

One of these triggers is causing WC3 to crash to the desktop if more than one zombie is in the "door area" at a a time when the barricades fall:

Code:
Attack the Damn Barricades II
    Events
        Unit - A unit Is issued an order targeting a point
    Conditions
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                And - All (Conditions) are true
                    Conditions
                        BarricadeUp[1] Equal to True
                        ((Ordered unit) is in (Units in Room01   East Door <gen> owned by Player 12 (Brown))) Equal to True
            Then - Actions
                Unit - Order (Ordered unit) to Stop
                Unit Group - Pick every unit in (Units in Room01   East Door <gen> owned by Player 12 (Brown)) and do (Unit - Order (Picked unit) to Attack Barricade[1])
            Else - Actions
                Do nothing
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                And - All (Conditions) are true
                    Conditions
                        BarricadeUp[2] Equal to True
                        ((Ordered unit) is in (Units in Room01   North Door <gen> owned by Player 12 (Brown))) Equal to True
            Then - Actions
                Unit - Order (Ordered unit) to Stop
                Unit Group - Pick every unit in (Units in Room01   North Door <gen> owned by Player 12 (Brown)) and do (Unit - Order (Picked unit) to Attack Barricade[2])
            Else - Actions
                Do nothing
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                And - All (Conditions) are true
                    Conditions
                        BarricadeUp[3] Equal to True
                        ((Ordered unit) is in (Units in Room01   West Door <gen> owned by Player 12 (Brown))) Equal to True
            Then - Actions
                Unit - Order (Ordered unit) to Stop
                Unit Group - Pick every unit in (Units in Room01   West Door <gen> owned by Player 12 (Brown)) and do (Unit - Order (Picked unit) to Attack Barricade[3])
            Else - Actions
                Do nothing

Thing is, this trigger used to be fine with an old Zombie AI trigger that I was using. Problem with the old trigger was that it worked by frequently telling the zombies to attack a random enemy unit.

I wanted to change their AI to instead attack move to an average point between players, and every time the trigger ran to prioritize targets closer to them.

After saving my changes though and testing it out, I started getting the game crashes I described above. :banghead:

This is the new Zombie AI trigger:

Code:
Zombie AI
    Events
    Conditions
    Actions
        For each (Integer A) from 1 to 6, do (Actions)
            Loop - Actions
                Set ZombieAI_PlayerPT[(Integer A)] = (Position of PlayerUnit[(Integer A)])
                Set ZombieAI_PlayerPT_X_Real[(Integer A)] = (X of ZombieAI_PlayerPT[(Integer A)])
                Set ZombieAI_PlayerPT_Y_Real[(Integer A)] = (Y of ZombieAI_PlayerPT[(Integer A)])

                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        Or - Any (Conditions) are true
                            Conditions
                                ((Player((Integer A))) slot status) Equal to Is unused
                                ((Player((Integer A))) slot status) Equal to Has left the game
                    Then - Actions
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                (Player 1 (Red) slot status) Equal to Is playing
                            Then - Actions
                                Set ZombieAI_PlayerPT[(Integer A)] = (Position of PlayerUnit[1])
                                Set ZombieAI_PlayerPT_X_Real[(Integer A)] = (X of ZombieAI_PlayerPT[1])
                                Set ZombieAI_PlayerPT_Y_Real[(Integer A)] = (Y of ZombieAI_PlayerPT[1])
                            Else - Actions

                                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    If - Conditions
                                        (Player 2 (Blue) slot status) Equal to Is playing
                                    Then - Actions
                                        Set ZombieAI_PlayerPT[(Integer A)] = (Position of PlayerUnit[2])
                                        Set ZombieAI_PlayerPT_X_Real[(Integer A)] = (X of ZombieAI_PlayerPT[2])
                                        Set ZombieAI_PlayerPT_Y_Real[(Integer A)] = (Y of ZombieAI_PlayerPT[2])
                                    Else - Actions

                                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                            If - Conditions
                                                (Player 3 (Teal) slot status) Equal to Is playing
                                            Then - Actions
                                                Set ZombieAI_PlayerPT[(Integer A)] = (Position of PlayerUnit[3])
                                                Set ZombieAI_PlayerPT_X_Real[(Integer A)] = (X of ZombieAI_PlayerPT[3])
                                                Set ZombieAI_PlayerPT_Y_Real[(Integer A)] = (Y of ZombieAI_PlayerPT[3])
                                            Else - Actions
                                                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                                    If - Conditions
                                                        (Player 4 (Purple) slot status) Equal to Is playing
                                                    Then - Actions
                                                        Set ZombieAI_PlayerPT[(Integer A)] = (Position of PlayerUnit[4])
                                                        Set ZombieAI_PlayerPT_X_Real[(Integer A)] = (X of ZombieAI_PlayerPT[4])
                                                        Set ZombieAI_PlayerPT_Y_Real[(Integer A)] = (Y of ZombieAI_PlayerPT[4])
                                                    Else - Actions
                                                   
                                                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                                            If - Conditions
                                                                (Player 5 (Yellow) slot status) Equal to Is playing
                                                            Then - Actions
                                                                Set ZombieAI_PlayerPT[(Integer A)] = (Position of PlayerUnit[5])
                                                                Set ZombieAI_PlayerPT_X_Real[(Integer A)] = (X of ZombieAI_PlayerPT[5])
                                                                Set ZombieAI_PlayerPT_Y_Real[(Integer A)] = (Y of ZombieAI_PlayerPT[5])
                                                            Else - Actions
                                                                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                                                    If - Conditions
                                                                        (Player 6 (Orange) slot status) Equal to Is playing
                                                                    Then - Actions
                                                                        Set ZombieAI_PlayerPT[(Integer A)] = (Position of PlayerUnit[6])
                                                                        Set ZombieAI_PlayerPT_X_Real[(Integer A)] = (X of ZombieAI_PlayerPT[6])
                                                                        Set ZombieAI_PlayerPT_Y_Real[(Integer A)] = (Y of ZombieAI_PlayerPT[6])
                                                                    Else - Actions
                                                                        Do nothing
                    Else - Actions
                        Do nothing
        Set ZombieAI_AvgPlayerPT_X = ((((((ZombieAI_PlayerPT_X_Real[1] + ZombieAI_PlayerPT_X_Real[2]) + ZombieAI_PlayerPT_X_Real[3]) + ZombieAI_PlayerPT_X_Real[4]) + ZombieAI_PlayerPT_X_Real[5]) + ZombieAI_PlayerPT_X_Real[6]) / 6.00)
        Set ZombieAI_AvgPlayerPT_Y = ((((((ZombieAI_PlayerPT_Y_Real[1] + ZombieAI_PlayerPT_Y_Real[2]) + ZombieAI_PlayerPT_Y_Real[3]) + ZombieAI_PlayerPT_Y_Real[4]) + ZombieAI_PlayerPT_Y_Real[5]) + ZombieAI_PlayerPT_Y_Real[6]) / 6.00)
        Set ZombieAI_AvgPlayerPT = (Point(ZombieAI_AvgPlayerPT_X, ZombieAI_AvgPlayerPT_Y))

        Set TempUnitGroup = (Units owned by Player 12 (Brown))
        Unit Group - Pick every unit in TempUnitGroup and do (Actions)
            Loop - Actions
                Set TempPoint = (Position of (Picked unit))
                Unit - Order (Picked unit) to Attack-Move To ZombieAI_AvgPlayerPT
                Set ZombieAI_Victims = (Units within 125.00 of TempPoint matching (((Matching unit) belongs to an enemy of Player 12 (Brown)) Equal to True))
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (ZombieAI_Victims is empty) Equal to False
                    Then - Actions
                        Unit - Order (Picked unit) to Attack (Random unit from ZombieAI_Victims)
                    Else - Actions
                        Set ZombieAI_Victims = (Units within 200.00 of TempPoint matching (((Matching unit) belongs to an enemy of Player 12 (Brown)) Equal to True))
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                (ZombieAI_Victims is empty) Equal to False
                            Then - Actions
                                Unit - Order (Picked unit) to Attack (Random unit from ZombieAI_Victims)
                            Else - Actions
                                Set ZombieAI_Victims = (Units within 350.00 of TempPoint matching (((Matching unit) belongs to an enemy of Player 12 (Brown)) Equal to True))
                                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    If - Conditions
                                        (ZombieAI_Victims is empty) Equal to False
                                    Then - Actions
                                        Unit - Order (Picked unit) to Attack (Random unit from ZombieAI_Victims)
                                    Else - Actions
                                        Set ZombieAI_Victims = (Units within 500.00 of TempPoint matching (((Matching unit) belongs to an enemy of Player 12 (Brown)) Equal to True))
                                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                            If - Conditions
                                                (ZombieAI_Victims is empty) Equal to False
                                            Then - Actions
                                                Unit - Order (Picked unit) to Attack (Random unit from ZombieAI_Victims)
                                            Else - Actions
                                                Do nothing
        Wait 0.01 seconds
        -------- Leak Clean up: --------
        Custom script:   call RemoveLocation (udg_TempPoint) 
        Custom script:   call DestroyGroup (udg_TempUnitGroup)
        Custom script:   call DestroyGroup (udg_ZombieAI_Victims)
        Set TempUnit = No unit

As it turns out, it still has a few problems... Namely, if the zombies kill a barricade, then they dance around for a few seconds, and if there isn't an enemy within 500 range, they go home to wherever they spawned from.
 

Uszi

New Member
Reaction score
5
Oh and like I said, I have a couple of triggers that force zombies to attack barricades. The problem trigger is the "Unit - A unit Is issued an order targeting a point,"

I also have ones for the "Unit - A unit is attacked," to fix an issue where players would draw aggro from the zombies if they killed one of the zombies attacking the barricades.

Another is "Unit - a unit is issued an order targeting an object" for any zombies in the "door" area that are issued an order to attack any unit that isn't a barricade while they are in the area.

Let me know if you guys think it might be some sort of ... interaction between those triggers or something that's crashing the game.
 
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

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top