• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

[Trigger] AoS Trigger doesn't work.

Status
Not open for further replies.
Level 10
Joined
Jun 1, 2008
Messages
485
I've making a mini AoS map. I already know how to make it and finish the trigger. In my mini AoS, the race of Army (Player that spawn unit and have base) can changed. I add gold mine to mined by Army player.
But, I've got some problem.
1. At first, all thing are working correctly, but when i change the race, the worker of second Army (The enemy) didn't gather gold.
2. When i change race to Undead and make gold mine haunted (Create Haunt Gold mine), the acolyte didn't gather gold.
3. When spawn unit, only first wave work correctly, it didn't create second wave and so on.
4. When unit unit reach "middle region" i order it to move to enemy base, but it come back to it's own base.

Here's the trigger. It's somewhat long.
  • Game Initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- Set Race --------
      • Set Game_RaceNow = Human
      • -------- Set Player --------
      • Set Game_ArmyPlayer[1] = Player 11 (Dark Green)
      • Set Game_ArmyPlayer[2] = Player 12 (Brown)
      • -------- Set Spawn Location --------
      • Set Game_SpawnPoint[1] = (Center of Spawn Point Top 1 <gen>)
      • Set Game_SpawnPoint[2] = (Center of Spawn Point Bottom 1 <gen>)
      • Set Game_SpawnPoint[3] = (Center of Spawn Point Top 2 <gen>)
      • Set Game_SpawnPoint[4] = (Center of Spawn Point Bottom 2 <gen>)
      • -------- Set Attack Location --------
      • Set Game_AttackPoint[1] = (Center of Attack Point Top <gen>)
      • Set Game_AttackPoint[2] = (Center of Attack Point Bottom <gen>)
      • Set Game_AttackPoint[3] = (Center of Base 1 <gen>)
      • Set Game_AttackPoint[4] = (Center of Base 2 <gen>)
      • -------- Initialize Race Available --------
      • Set Game_RaceDefault[1] = Human
      • Set Game_RaceDefault[2] = Orc
      • Set Game_RaceDefault[3] = Undead
      • Set Game_RaceDefault[4] = Night Elf
      • -------- Set Race Number --------
      • Set Game_RaceNumber = 1
      • -------- Run the Initialize Unit trigger --------
      • Trigger - Run Initialize Unit <gen> (ignoring conditions)
      • -------- Order Worker to Work --------
      • For each (Integer Game_Loop[6]) from 1 to 2, do (Actions)
        • Loop - Actions
          • Custom script: set bj_wantDestroyGroup = true
          • Unit Group - Pick every unit in (Units owned by Game_ArmyPlayer[Game_Loop[6]] of type Peasant) and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Game_Loop[6] Equal to 1
                • Then - Actions
                  • Unit - Order (Picked unit) to Harvest Gold Mine 0007 <gen>
                • Else - Actions
                  • Unit - Order (Picked unit) to Harvest Gold Mine 0004 <gen>
      • -------- Turn Bounty On --------
      • For each (Integer Game_Loop[9]) from 1 to 2, do (Actions)
        • Loop - Actions
          • Player - Turn Gives bounty On for Game_ArmyPlayer[Game_Loop[9]]
      • -------- Set Gold Mine Resource --------
      • For each (Integer Game_Loop[7]) from 1 to 2, do (Actions)
        • Loop - Actions
          • Neutral Building - Set Unit_GoldMine[Game_Loop[7]] to 10000 gold
  • Initialize Unit
    • Events
    • Conditions
    • Actions
      • -------- Initialize Main Building --------
      • Set Unit_CityHall[1] = Town Hall
      • Set Unit_CityHall[2] = Great Hall
      • Set Unit_CityHall[3] = Necropolis
      • Set Unit_CityHall[4] = Tree of Life
      • -------- Initialize Worker --------
      • Set Unit_Peasant[1] = Peasant
      • Set Unit_Peasant[2] = Peon
      • Set Unit_Peasant[3] = Acolyte
      • Set Unit_Peasant[4] = Wisp
      • -------- Initialize Tower Building --------
      • Set Unit_Tower[1] = Guard Tower
      • Set Unit_Tower[2] = Watch Tower
      • Set Unit_Tower[3] = Spirit Tower
      • Set Unit_Tower[4] = Ancient Protector
      • -------- Initialize Unit-Creating Building --------
      • Set Unit_Barrack[1] = Barracks
      • Set Unit_Barrack[2] = Barracks
      • Set Unit_Barrack[3] = Crypt
      • Set Unit_Barrack[4] = Ancient of War
      • -------- Initialize Wood Resource or Upgrading Building --------
      • Set Unit_Wood[1] = Lumber Mill
      • Set Unit_Wood[2] = War Mill
      • Set Unit_Wood[3] = Graveyard
      • Set Unit_Wood[4] = Hunter's Hall
      • -------- Initialize Shop Building --------
      • Set Unit_Shop[1] = Arcane Vault
      • Set Unit_Shop[2] = Voodoo Lounge
      • Set Unit_Shop[3] = Tomb of Relics
      • Set Unit_Shop[4] = Ancient of Wonders
      • -------- Initialize Food-Producing Building --------
      • Set Unit_Food[1] = Farm
      • Set Unit_Food[2] = Orc Burrow
      • Set Unit_Food[3] = Ziggurat
      • Set Unit_Food[4] = Moon Well
      • -------- Initialize Gold Mine --------
      • Set Unit_GoldMine[1] = Gold Mine 0007 <gen>
      • Set Unit_GoldMine[2] = Gold Mine 0004 <gen>
      • -------- Initialize Spawn Unit --------
      • Set Unit_Melee[1] = Footman
      • Set Unit_Melee[2] = Grunt
      • Set Unit_Melee[3] = Ghoul
      • Set Unit_Melee[4] = Treant
      • -------- Initialize Spawn Unit part 2 --------
      • Set Unit_Range[1] = Sorceress
      • Set Unit_Range[2] = Shaman
      • Set Unit_Range[3] = Banshee
      • Set Unit_Range[4] = Druid of the Talon (Night Elf Form)
  • Spawn Unit
    • Events
      • Time - Every 20.00 seconds of game time
    • Conditions
    • Actions
      • Game - Display to (All players) the text: Spawn
      • -------- Create Unit Through Loop --------
      • For each (Integer Game_Loop[1]) from 1 to 2, do (Actions)
        • Loop - Actions
          • For each (Integer Game_Loop[2]) from 1 to 2, do (Actions)
            • Loop - Actions
              • Game - Display to (All players) the text: (Spawn Unit + ((String(Game_Loop[1])) + (String(Game_Loop[2]))))
              • Set Game_TempPoint[1] = Game_SpawnPoint[(((Game_Loop[1] - 1) x 2) + Game_Loop[2])]
              • Unit - Create 3 Unit_Melee[Game_RaceNumber] for Game_ArmyPlayer[Game_Loop[1]] at Game_TempPoint[1] facing Default building facing degrees
              • Unit - Create 1 Unit_Range[Game_RaceNumber] for Game_ArmyPlayer[Game_Loop[1]] at Game_TempPoint[1] facing Default building facing degrees
              • Custom script: call RemoveLocation(udg_Game_TempPoint[1])
      • -------- For Addition, Set Gold Mine Resource --------
      • For each (Integer Game_Loop[8]) from 1 to 2, do (Actions)
        • Loop - Actions
          • Game - Display to (All players) the text: Gold Mine refresh
          • Neutral Building - Set Unit_GoldMine[Game_Loop[8]] to 10000 gold
  • Order Spawn Unit
    • Events
      • Unit - A unit enters Spawn Point Top 1 <gen>
      • Unit - A unit enters Spawn Point Bottom 1 <gen>
      • Unit - A unit enters Spawn Point Top 2 <gen>
      • Unit - A unit enters Spawn Point Bottom 2 <gen>
      • Unit - A unit enters Attack Point Top <gen>
      • Unit - A unit enters Attack Point Bottom <gen>
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Owner of (Triggering unit)) Equal to Player 11 (Dark Green)
          • (Owner of (Triggering unit)) Equal to Player 12 (Brown)
    • Actions
      • -------- Order to attack its Attack Point --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Owner of (Triggering unit)) Equal to Player 11 (Dark Green)
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Spawn Point Top 1 <gen> contains (Triggering unit)) Equal to True
            • Then - Actions
              • Unit - Order (Triggering unit) to Attack-Move To Game_AttackPoint[1]
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Spawn Point Bottom 1 <gen> contains (Triggering unit)) Equal to True
                • Then - Actions
                  • Unit - Order (Triggering unit) to Attack-Move To Game_AttackPoint[2]
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • Or - Any (Conditions) are true
                        • Conditions
                          • (Attack Point Top <gen> contains (Triggering unit)) Equal to True
                          • (Attack Point Bottom <gen> contains (Triggering unit)) Equal to True
                    • Then - Actions
                      • Unit - Order (Triggering unit) to Attack-Move To Game_AttackPoint[3]
                    • Else - Actions
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Spawn Point Top 2 <gen> contains (Triggering unit)) Equal to True
            • Then - Actions
              • Unit - Order (Triggering unit) to Attack-Move To Game_AttackPoint[1]
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Spawn Point Bottom 2 <gen> contains (Triggering unit)) Equal to True
                • Then - Actions
                  • Unit - Order (Triggering unit) to Attack-Move To Game_AttackPoint[2]
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • Or - Any (Conditions) are true
                        • Conditions
                          • (Attack Point Top <gen> contains (Triggering unit)) Equal to True
                          • (Attack Point Bottom <gen> contains (Triggering unit)) Equal to True
                    • Then - Actions
                      • Unit - Order (Triggering unit) to Attack-Move To Game_AttackPoint[4]
                    • Else - Actions
  • Change Race
    • Events
      • Player - Player 1 (Red) types a chat message containing -race as A substring
    • Conditions
    • Actions
      • -------- Check if race before is Night Elf or Undead --------
      • -------- If yes, destroy Haunted Gold Mine and Entangled Gold Mine --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Game_RaceNow Equal to Night Elf
        • Then - Actions
          • For each (Integer Game_Loop[4]) from 1 to 2, do (Actions)
            • Loop - Actions
              • Custom script: set bj_wantDestroyGroup = true
              • Unit Group - Pick every unit in (Units owned by Game_ArmyPlayer[Game_Loop[4]] of type Entangled Gold Mine) and do (Actions)
                • Loop - Actions
                  • Unit - Kill (Picked unit)
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Game_RaceNow Equal to Undead
            • Then - Actions
              • For each (Integer Game_Loop[5]) from 1 to 2, do (Actions)
                • Loop - Actions
                  • Custom script: set bj_wantDestroyGroup = true
                  • Unit Group - Pick every unit in (Units owned by Game_ArmyPlayer[Game_Loop[5]] of type Haunted Gold Mine) and do (Actions)
                    • Loop - Actions
                      • Unit - Kill (Picked unit)
            • Else - Actions
      • -------- Get the race number --------
      • Set Game_Integer = (Integer((Substring((Entered chat string), 7, 1))))
      • -------- Change Game Race --------
      • Set Game_RaceNow = Game_RaceDefault[Game_Integer]
      • -------- Change Army Unit --------
      • For each (Integer Game_Loop[3]) from 1 to 2, do (Actions)
        • Loop - Actions
          • Custom script: set bj_wantDestroyGroup = true
          • Unit Group - Pick every unit in (Units owned by Game_ArmyPlayer[Game_Loop[3]]) and do (Actions)
            • Loop - Actions
              • -------- Change Tower Building --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Unit-type of (Picked unit)) Equal to Unit_Tower[Game_RaceNumber]
                • Then - Actions
                  • Unit - Replace (Picked unit) with a Unit_Tower[Game_Integer] using The old unit's relative life and mana
                • Else - Actions
                  • -------- Change Main Building --------
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Unit-type of (Picked unit)) Equal to Unit_CityHall[Game_RaceNumber]
                    • Then - Actions
                      • Unit - Replace (Picked unit) with a Unit_CityHall[Game_Integer] using The old unit's relative life and mana
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • Game_RaceNow Equal to Night Elf
                        • Then - Actions
                          • Unit - Order (Last replaced unit) to Night Elf Tree Of Life - Entangle (Instant) Unit_GoldMine[Game_Loop[3]]
                        • Else - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • Game_RaceNow Equal to Undead
                            • Then - Actions
                              • Neutral Building - Haunt Unit_GoldMine[Game_Loop[3]] for Game_ArmyPlayer[Game_Loop[3]]
                            • Else - Actions
                    • Else - Actions
                      • -------- Change Worker --------
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Unit-type of (Picked unit)) Equal to Unit_Peasant[Game_RaceNumber]
                        • Then - Actions
                          • Unit - Replace (Picked unit) with a Unit_Peasant[Game_Integer] using The old unit's relative life and mana
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • (Owner of (Picked unit)) Equal to Player 11 (Dark Green)
                            • Then - Actions
                              • Unit - Order (Picked unit) to Harvest Gold Mine 0007 <gen>
                            • Else - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • (Owner of (Picked unit)) Equal to Player 12 (Brown)
                            • Then - Actions
                              • Unit - Order (Picked unit) to Harvest Gold Mine 0004 <gen>
                            • Else - Actions
                        • Else - Actions
                          • -------- Change Unit-Creating Building --------
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • (Unit-type of (Picked unit)) Equal to Unit_Barrack[Game_RaceNumber]
                            • Then - Actions
                              • Unit - Replace (Picked unit) with a Unit_Barrack[Game_Integer] using The old unit's relative life and mana
                            • Else - Actions
                              • -------- Change Shop Building --------
                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                • If - Conditions
                                  • (Unit-type of (Picked unit)) Equal to Unit_Shop[Game_RaceNumber]
                                • Then - Actions
                                  • Unit - Replace (Picked unit) with a Unit_Shop[Game_Integer] using The old unit's relative life and mana
                                • Else - Actions
                                  • -------- Change Wood Drop/Upgrading Building --------
                                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    • If - Conditions
                                      • (Unit-type of (Picked unit)) Equal to Unit_Wood[Game_RaceNumber]
                                    • Then - Actions
                                      • Unit - Replace (Picked unit) with a Unit_Wood[Game_Integer] using The old unit's relative life and mana
                                    • Else - Actions
                                      • -------- Change Food Producing Building --------
                                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                        • If - Conditions
                                          • (Unit-type of (Picked unit)) Equal to Unit_Food[Game_RaceNumber]
                                        • Then - Actions
                                          • Unit - Replace (Picked unit) with a Unit_Food[Game_Integer] using The old unit's relative life and mana
                                        • Else - Actions
      • -------- Set Race Number --------
      • Set Game_RaceNumber = Game_Integer
Am i do something wrong?

I attach the map, it's for Hero Contest #2.
Tomorrow I'll attach the map
Ok, now I'm attach the map.
 

Attachments

  • Hero Contest #2.w3x
    231.5 KB · Views: 43
Last edited:
Level 10
Joined
Jun 1, 2008
Messages
485
Nobody will want to look at this. I mean nobody. It's too long.

Sorry.
Wew, I know it long, I attach the map to make it easier.
I really want to shorter it, but i think this is the shorter it can be.

1&2

havent read it all but maybe you should order them to gather gold?

3

have no idea nor time to read this

4

check your reagion variables and points
1. Ok, I'll try
2. Don't mind.
3. I've recheck it many time and try to swap the variable, but still not work.

Well, I know the trigger is Extremely Long, so i add the map so you can test it by yourself.
 
Level 10
Joined
Jun 1, 2008
Messages
485
Ok.... now when i recheck it, i realize i did some thing wrong.
on this one
  • Set Game_TempPoint[1] = Game_SpawnPoint[(((Game_Loop[1] - 1) x 2) + Game_Loop[2])]
  • Unit - Create 3 Unit_Melee[Game_RaceNumber] for Game_ArmyPlayer[Game_Loop[1]] at Game_TempPoint[1] facing Default building facing degrees
  • Unit - Create 1 Unit_Range[Game_RaceNumber] for Game_ArmyPlayer[Game_Loop[1]] at Game_TempPoint[1] facing Default building facing degrees
  • Custom script: call RemoveLocation(udg_Game_TempPoint[1])
it must be this
  • Unit - Create 3 Unit_Melee[Game_RaceNumber] for Game_ArmyPlayer[Game_Loop[1]] at Game_SpawnPoint[(((Game_Loop[1] - 1) x 2) + Game_Loop[2])] facing Default building facing degrees
  • Unit - Create 1 Unit_Range[Game_RaceNumber] for Game_ArmyPlayer[Game_Loop[1]] at Game_SpawnPoint[(((Game_Loop[1] - 1) x 2) + Game_Loop[2])] facing Default building facing degrees
and this
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
  • If - Conditions
  • (Owner of (Picked unit)) Equal to Player 11 (Dark Green)
  • Then - Actions
  • Unit - Order (Picked unit) to Harvest Gold Mine 0007 <gen>
  • Else - Actions
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
  • If - Conditions
  • (Owner of (Picked unit)) Equal to Player 12 (Brown)
  • Then - Actions
  • Unit - Order (Picked unit) to Harvest Gold Mine 0004 <gen>
  • Else - Actions
it must be this
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
  • If - Conditions
  • (Owner of (Last Replaced Unit)) Equal to Player 11 (Dark Green)
  • Then - Actions
  • Unit - Order (Last Replaced Unit) to Harvest Gold Mine 0007 <gen>
  • Else - Actions
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
  • If - Conditions
  • (Owner of (Last Replaced Unit)) Equal to Player 12 (Brown)
  • Then - Actions
  • Unit - Order (Last Replaced Unit) to Harvest Gold Mine 0004 <gen>
  • Else - Actions
This thread can be closed now....
Thanks and +rep to people try to help me...
 
Last edited:
Status
Not open for further replies.
Top