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

[Trigger] Creep Spawn System. Problem: Units fleeing from the Lane

Status
Not open for further replies.
Level 1
Joined
Mar 2, 2020
Messages
1
Hey everybody,

I had some time to experiment with lanes etc and I used the tutorial of DoOs_101 and played around with it a bit.
here is the Link: Multiple Creep Spawn System

I only did the code for one lane to test it and will do the others afterwards. Basically it should become a castle defense in the end, with 3 lane for each side :)
There is still a lot to do but first I want to concentrate on the Lanes.
Here is my plan so far:
[/B]
Plan.png

If the image should not load, here is a link: Plan | HIVE

I´ve done only the left line to experiment with the Triggers.
1. timer window.
Endless timer that repeats every 60 s
Check
2. the spawn of the creeps according to timer expiration:
When Barracks Two is destroyed, spawn the creeps at Barracks 1. (red arrow)
Then they are moving to the enemy player's Barracks 1 (with Attack-move)
That works both already :)
3. after a number of rounds the creeps get stronger.
Round 1-15: Spawn the monsters stored under level 1
Round 16-30: Spawn the monsters stored in Level 2
Round 30+ : Spawn the monsters stored in Level 3
Works too.

So now my first problem:
At the moment i manage to send the creeps from one barracks to the other to the enemy barracks, but after that they have to go on to the castle which i can't do. Rather i have solved it very badly at the moment.
The first movement while spawning lets the creeps run to the enemy barracks 1 and attack everything on the way, directly after spawning.
Then I put a huge region over the enemy barrack 1 and surroundings, which makes units from a certain player (only the creps) how enter the region run to the enemy castle, so that other players dont get the order to move to the castle.
Unfortunately I can't let them run directly to the castle, because otherwise they will go directly to the middle line. Since there are a lot of gaps for player units for a quick lane change.
If anyone has an awesome tutorial for Lanes... i will be very grateful

Second, my main problem.
The stupid creeps are fleeing towards there starting position or barracks, after they get some hits from the enemy defense tower. I figured that out when I placed the starting position at different positions.
I have tried to separate the buildings (player green) and the spawned monsters (player dark green), so at least I have prevented the creeps from retreating to the barracks, because they belong to player green and the units are from dark green.
But the real problem is in the map initialization where one point is "Run meele AI Script (for all Computer players)". Because in the AI for Computer player the fleeing of units is included, I can switch it off manually in the AI editor, but then it is for all computer players off. I also have normal computer players who build buildings, run around and have to flee sometimes... i don't know how i can make that only from a certain player(green) the units don't flee and the other computer players behave normally.
For the humans the player (brown) should not flee:/

I hope somebody has a solution for this:D
For other general trigger improvements I am also always grateful :)

And here are the triggers I've been using:

First the Variables iam using so far

loc --> Array/ Variable Type: Point
RoundWindow --> Variable Type: Timer
lvlnum --> Variable Type: Integer
unit_amount_var_1 --> Array/ Variable Type: Integer
unit_amount_var_2 --> Array/ Variable Type: Integer
unit_amount_var_3 --> Array/ Variable Type: Integer
unit_amount_var_4 --> Array/ Variable Type: Integer
unit_type_var_1_human --> Array/ Variable Type: Unit-Type
unit_type_var_2_human --> Array/ Variable Type: Unit-Type
unit_type_var_3_human --> Array/ Variable Type: Unit-Type
unit_type_var_4_human --> Array/ Variable Type: Unit-Type
unit_type_var_1_undead --> Array/ Variable Type: Unit-Type
unit_type_var_2_undead --> Array/ Variable Type: Unit-Type
unit_type_var_3_undead --> Array/ Variable Type: Unit-Type
unit_type_var_4_undead --> Array/ Variable Type: Unit-Type

There are only starting units for the real Computer player/ player, not for the creep Computer green/dark green and Brown/Maroon

  • Melee Initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Melee Game - Use melee time of day (for all players)
      • Melee Game - Limit Heroes to 1 per Hero-type (for all players)
      • Melee Game - Give trained Heroes a Scroll of Town Portal (for all players)
      • Melee Game - Set starting resources (for all players)
      • Melee Game - Remove creeps and critters from used start locations (for all players)
      • Melee Game - Create Undead starting units for Player 1 (Red) at (Player 1 (Red) start location) (Include Heroes)
      • Melee Game - Create Undead starting units for Player 4 (Purple) at (Player 4 (Purple) start location) (Include Heroes)
      • Melee Game - Create Undead starting units for Player 3 (Teal) at (Player 3 (Teal) start location) (Include Heroes)
      • Melee Game - Create Human starting units for Player 5 (Yellow) at (Player 5 (Yellow) start location) (Include Heroes)
      • Melee Game - Create Human starting units for Player 2 (Blue) at (Player 2 (Blue) start location) (Include Heroes)
      • Melee Game - Create Human starting units for Player 6 (Orange) at (Player 6 (Orange) start location) (Include Heroes)
      • Melee Game - Run melee AI scripts (for computer players)
      • Melee Game - Enforce victory/defeat conditions (for all players)
  • InitTimer Start
    • Events
      • Time - Elapsed game time is 1.00 seconds
    • Conditions
    • Actions
      • Trigger - Run Timer <gen> (ignoring conditions)
  • Timer
    • Events
    • Conditions
    • Actions
      • Game - Display to (All players) the text: Die Belagerung begi...
      • Countdown Timer - Start RoundWindow as a Repeating timer that will expire in 60.00 seconds
      • Set VariableSet RoundWindow = (Last started timer)
      • Countdown Timer - Create a timer window for (Last started timer) with title Nächste Welle in:
  • Var
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set VariableSet lvlnum = 0
      • -------- Level 1 --------
      • Set VariableSet unit_type_var_1_Death[1] = Geringer Frost Diener
      • Set VariableSet unit_type_var_2_Death[1] = Geringer Skelettbogenschütze
      • Set VariableSet unit_type_var_3_Death[1] = Großer Frost Diener
      • Set VariableSet unit_typ_var_4_Death[1] = Frost Giant
      • Set VariableSet unit_type_var_1[1] = Fußsoldat
      • Set VariableSet unit_type_var_2[1] = Scharfschütze
      • Set VariableSet unit_type_var_3[1] = Hauptmann
      • Set VariableSet unit_typ_var_4[1] = Belagerungsgolem
      • Set VariableSet unit_amout_var_1[1] = 5
      • Set VariableSet unit_amount_var_2[1] = 4
      • Set VariableSet unit_amount_var_3[1] = 1
      • Set VariableSet unit_amount_var_4[1] = 0
      • -------- Level 2 --------
      • Set VariableSet unit_type_var_1_Death[2] = Frost Diener
      • Set VariableSet unit_type_var_2_Death[2] = Frost-Skelettschütze
      • Set VariableSet unit_type_var_3_Death[2] = Großer Frost Diener
      • Set VariableSet unit_typ_var_4_Death[2] = Frost Giant
      • Set VariableSet unit_type_var_1[2] = Elite-Fußsoldat
      • Set VariableSet unit_type_var_2[2] = Elite-Scharfschütze
      • Set VariableSet unit_type_var_3[2] = Hauptmann
      • Set VariableSet unit_typ_var_4[2] = Belagerungsgolem
      • Set VariableSet unit_amout_var_1[2] = 6
      • Set VariableSet unit_amount_var_2[2] = 5
      • Set VariableSet unit_amount_var_3[2] = 2
      • Set VariableSet unit_amount_var_4[2] = 1
      • -------- Level 3 --------
      • Set VariableSet unit_type_var_1_Death[3] = Frost Diener
      • Set VariableSet unit_type_var_2_Death[3] = Frost-Skelettschütze
      • Set VariableSet unit_type_var_3_Death[3] = Großer Frost Diener
      • Set VariableSet unit_typ_var_4_Death[3] = Frost Giant
      • Set VariableSet unit_type_var_1[3] = Elite-Fußsoldat
      • Set VariableSet unit_type_var_2[3] = Elite-Scharfschütze
      • Set VariableSet unit_type_var_3[3] = Hauptmann
      • Set VariableSet unit_typ_var_4[3] = Belagerungsgolem
      • Set VariableSet unit_amout_var_1[3] = 6
      • Set VariableSet unit_amount_var_2[3] = 5
      • Set VariableSet unit_amount_var_3[3] = 3
      • Set VariableSet unit_amount_var_4[3] = 2
  • SpawnLeft line
    • Events
      • Time - RoundWindow expires
    • Conditions
    • Actions
      • Set VariableSet lvlnum = (lvlnum + 1)
      • Game - Display to (All players) the text: Der Angriff startet
      • If ((Frost Crypt 0102 <gen> is alive) Equal to Wahr) then do (Set VariableSet loc[1] = (Center of Left Line Bottom Undead <gen>)) else do (Set VariableSet loc[1] = (Center of Left Line Top Undead <gen>))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • lvlnum Less than or equal to 15
        • Then - Actions
          • For each (Integer A) from 1 to unit_amount_var_4[1], do (Actions)
            • Loop - Actions
              • For each (Integer B) from 1 to 1, do (Actions)
                • Loop - Actions
                  • Unit - Create 1 unit_typ_var_4_Death[1] for Player 11 (Dark Green) at loc[1] facing Default building facing degrees
                  • Unit - Order (Last created unit) to Attack-Move To (Center of Attack left Undead <gen>)
              • Wait 0.75 game-time seconds
          • For each (Integer A) from 1 to unit_amount_var_2[1], do (Actions)
            • Loop - Actions
              • For each (Integer B) from 1 to 1, do (Actions)
                • Loop - Actions
                  • Unit - Create 1 unit_type_var_1_Death[1] for Player 11 (Dark Green) at loc[1] facing Default building facing degrees
                  • Unit - Order (Last created unit) to Attack-Move To (Center of Attack left Undead <gen>)
              • Wait 0.75 game-time seconds
          • For each (Integer A) from 1 to unit_amout_var_1[1], do (Actions)
            • Loop - Actions
              • For each (Integer B) from 1 to 1, do (Actions)
                • Loop - Actions
                  • Unit - Create 1 unit_type_var_2_Death[1] for Player 11 (Dark Green) at loc[1] facing Default building facing degrees
                  • Unit - Order (Last created unit) to Attack-Move To (Center of Attack left Undead <gen>)
              • Wait 0.75 game-time seconds
          • For each (Integer A) from 1 to unit_amount_var_3[1], do (Actions)
            • Loop - Actions
              • For each (Integer B) from 1 to 1, do (Actions)
                • Loop - Actions
                  • Unit - Create 1 unit_type_var_3_Death[1] for Player 11 (Dark Green) at loc[1] facing Default building facing degrees
                  • Unit - Order (Last created unit) to Attack-Move To (Center of Attack left Undead <gen>)
              • Wait 0.75 game-time seconds
          • Custom script: call RemoveLocation( udg_loc[1] )
        • Else - Actions
          • Do nothing
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (lvlnum Greater than 15) and (lvlnum Less than or equal to 30)
        • Then - Actions
          • For each (Integer A) from 1 to unit_amount_var_4[2], do (Actions)
            • Loop - Actions
              • For each (Integer B) from 1 to 1, do (Actions)
                • Loop - Actions
                  • Unit - Create 1 unit_typ_var_4_Death[2] for Player 11 (Dark Green) at loc[1] facing Default building facing degrees
                  • Unit - Order (Last created unit) to Attack-Move To (Center of Attack left Undead <gen>)
              • Wait 0.75 game-time seconds
          • For each (Integer A) from 1 to unit_amount_var_2[2], do (Actions)
            • Loop - Actions
              • For each (Integer B) from 1 to 1, do (Actions)
                • Loop - Actions
                  • Unit - Create 1 unit_type_var_1_Death[2] for Player 11 (Dark Green) at loc[1] facing Default building facing degrees
                  • Unit - Order (Last created unit) to Attack-Move To (Center of Attack left Undead <gen>)
              • Wait 0.75 game-time seconds
          • For each (Integer A) from 1 to unit_amout_var_1[2], do (Actions)
            • Loop - Actions
              • For each (Integer B) from 1 to 1, do (Actions)
                • Loop - Actions
                  • Unit - Create 1 unit_type_var_2_Death[2] for Player 11 (Dark Green) at loc[1] facing Default building facing degrees
                  • Unit - Order (Last created unit) to Attack-Move To (Center of Attack left Undead <gen>)
              • Wait 0.75 game-time seconds
          • For each (Integer A) from 1 to unit_amount_var_3[2], do (Actions)
            • Loop - Actions
              • For each (Integer B) from 1 to 1, do (Actions)
                • Loop - Actions
                  • Unit - Create 1 unit_type_var_3_Death[2] for Player 11 (Dark Green) at loc[1] facing Default building facing degrees
                  • Unit - Order (Last created unit) to Attack-Move To (Center of Attack left Undead <gen>)
              • Wait 0.75 game-time seconds
          • Custom script: call RemoveLocation( udg_loc[1] )
        • Else - Actions
          • For each (Integer A) from 1 to unit_amount_var_4[3], do (Actions)
            • Loop - Actions
              • For each (Integer B) from 1 to 1, do (Actions)
                • Loop - Actions
                  • Unit - Create 1 unit_typ_var_4_Death[3] for Player 11 (Dark Green) at loc[1] facing Default building facing degrees
                  • Unit - Order (Last created unit) to Attack-Move To (Center of Attack left Undead <gen>)
              • Wait 0.75 game-time seconds
          • For each (Integer A) from 1 to unit_amount_var_2[3], do (Actions)
            • Loop - Actions
              • For each (Integer B) from 1 to 1, do (Actions)
                • Loop - Actions
                  • Unit - Create 1 unit_type_var_1_Death[3] for Player 11 (Dark Green) at loc[1] facing Default building facing degrees
                  • Unit - Order (Last created unit) to Attack-Move To (Center of Attack left Undead <gen>)
              • Wait 0.75 game-time seconds
          • For each (Integer A) from 1 to unit_amout_var_1[3], do (Actions)
            • Loop - Actions
              • For each (Integer B) from 1 to 1, do (Actions)
                • Loop - Actions
                  • Unit - Create 1 unit_type_var_2_Death[3] for Player 11 (Dark Green) at loc[1] facing Default building facing degrees
                  • Unit - Order (Last created unit) to Attack-Move To (Center of Attack left Undead <gen>)
              • Wait 0.75 game-time seconds
          • For each (Integer A) from 1 to unit_amount_var_3[3], do (Actions)
            • Loop - Actions
              • For each (Integer B) from 1 to 1, do (Actions)
                • Loop - Actions
                  • Unit - Create 1 unit_type_var_3_Death[3] for Player 11 (Dark Green) at loc[1] facing Default building facing degrees
                  • Unit - Order (Last created unit) to Attack-Move To (Center of Attack left Undead <gen>)
              • Wait 0.75 game-time seconds
          • Custom script: call RemoveLocation( udg_loc[1] )
  • Move to Castle after left line finished
    • Events
      • Unit - A unit enters Attack left Undead <gen>
    • Conditions
    • Actions
      • If (((Owner of (Entering unit)) Equal to Player 11 (Dark Green)) and ((Kaserne 0114 <gen> is dead) Equal to Wahr)) then do (Unit - Order (Entering unit) to Attack-Move To (Center of Attack middle Undead <gen>)) else do (Do nothing)
 
Last edited:
Level 39
Joined
Feb 27, 2007
Messages
5,024
There is a data field for each unit in the OE called "Stats - Can Flee". You'll want to set this to false for all unit types controlled by this non-fleeing AI. If any of these unit types are shared by normal AI you'll have to make a copy and give the special non-fleeing version to the non-fleeing AI.
 
Level 12
Joined
Feb 5, 2018
Messages
521
For your first problem just add more regions. It doesn't matter if you have to add plenty for your needs.

If necessery you can add boolean checks (true/false) for the triggers in order to make the creeps move correctly.

If you feel like the regions are not enough you can check the X/Y coordinates in map editor with your cursor.

Then save the X/Y coordinates with variables as locations.
 
Status
Not open for further replies.
Top