• 🏆 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] Randomized Creature

Status
Not open for further replies.
Level 27
Joined
Sep 24, 2006
Messages
4,979
I tried to make a trigger so that when all players will be spawned one of them has a different unit than the others.

So i made a wisp and called it spawner, then set it so the spawner only spawns when players are ''equal to playing'' (So i also could test i with computers) and after spawning in the initialization the ''GetZombie'' trigger would pick random number between 1 and the(PlayerNumber) variable. The players are counted in the initialization...

It didn't work, nothing happend. So i added some text to make it confirm that he is counting the players and that works, when i test the map myself with 3 other computer player it says there are 4 players in the game. But whatever i believe the GetZombie trigger just doesn't work but that wouldn't make sense because i can't seem to find any mistake =/

It's just like it gets ignored.... very odd... and FRUSTRATING for a simple thing like this not to work.

  • GetZombie
    • Events
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • HasZombie Equal to False
        • Then - Actions
          • Set ZombieRoll = (Random integer number between 1 and PlayerNumber)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ZombieRoll Equal to 1
            • Then - Actions
              • If ((Player 1 (Red) slot status) Equal to Is playing) then do (Unit - Replace Player1 with a (Greater Zombie/Player) using The new unit's max life and mana) else do (Trigger - Run (This trigger) (checking conditions))
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Unit-type of Player1) Equal to (Greater Zombie/Player)
                • Then - Actions
                  • Unit - Replace Player2 with a (Rifleman/Player) using The new unit's max life and mana
                  • Unit - Replace Player3 with a (Rifleman/Player) using The new unit's max life and mana
                  • Unit - Replace Player4 with a (Rifleman/Player) using The new unit's max life and mana
                  • Unit - Replace Player5 with a (Rifleman/Player) using The new unit's max life and mana
                  • Unit - Replace Player6 with a (Rifleman/Player) using The new unit's max life and mana
                  • Unit - Replace Player7 with a (Rifleman/Player) using The new unit's max life and mana
                  • Unit - Replace Player8 with a (Rifleman/Player) using The new unit's max life and mana
                • Else - Actions
                  • Do nothing
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ZombieRoll Equal to 2
                • Then - Actions
                  • If ((Player 2 (Blue) slot status) Equal to Is playing) then do (Unit - Replace Player2 with a (Greater Zombie/Player) using The new unit's max life and mana) else do (Trigger - Run (This trigger) (checking conditions))
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Unit-type of Player2) Equal to (Greater Zombie/Player)
                    • Then - Actions
                      • Unit - Replace Player1 with a (Rifleman/Player) using The new unit's max life and mana
                      • Unit - Replace Player3 with a (Rifleman/Player) using The new unit's max life and mana
                      • Unit - Replace Player4 with a (Rifleman/Player) using The new unit's max life and mana
                      • Unit - Replace Player5 with a (Rifleman/Player) using The new unit's max life and mana
                      • Unit - Replace Player6 with a (Rifleman/Player) using The new unit's max life and mana
                      • Unit - Replace Player7 with a (Rifleman/Player) using The new unit's max life and mana
                      • Unit - Replace Player8 with a (Rifleman/Player) using The new unit's max life and mana
                    • Else - Actions
                      • Do nothing
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • ZombieRoll Equal to 3
                    • Then - Actions
                      • If ((Player 3 (Teal) slot status) Equal to Is playing) then do (Unit - Replace Player3 with a (Greater Zombie/Player) using The new unit's max life and mana) else do (Trigger - Run (This trigger) (checking conditions))
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Unit-type of Player3) Equal to (Greater Zombie/Player)
                        • Then - Actions
                          • Unit - Replace Player1 with a (Rifleman/Player) using The new unit's max life and mana
                          • Unit - Replace Player2 with a (Rifleman/Player) using The new unit's max life and mana
                          • Unit - Replace Player4 with a (Rifleman/Player) using The new unit's max life and mana
                          • Unit - Replace Player5 with a (Rifleman/Player) using The new unit's max life and mana
                          • Unit - Replace Player6 with a (Rifleman/Player) using The new unit's max life and mana
                          • Unit - Replace Player7 with a (Rifleman/Player) using The new unit's max life and mana
                          • Unit - Replace Player8 with a (Rifleman/Player) using The new unit's max life and mana
                        • Else - Actions
                          • Do nothing
                    • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • ZombieRoll Equal to 4
                        • Then - Actions
                          • If ((Player 4 (Purple) slot status) Equal to Is playing) then do (Unit - Replace Player4 with a (Greater Zombie/Player) using The new unit's max life and mana) else do (Trigger - Run (This trigger) (checking conditions))
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • (Unit-type of Player4) Equal to (Greater Zombie/Player)
                            • Then - Actions
                              • Unit - Replace Player1 with a (Rifleman/Player) using The new unit's max life and mana
                              • Unit - Replace Player2 with a (Rifleman/Player) using The new unit's max life and mana
                              • Unit - Replace Player3 with a (Rifleman/Player) using The new unit's max life and mana
                              • Unit - Replace Player5 with a (Rifleman/Player) using The new unit's max life and mana
                              • Unit - Replace Player6 with a (Rifleman/Player) using The new unit's max life and mana
                              • Unit - Replace Player7 with a (Rifleman/Player) using The new unit's max life and mana
                              • Unit - Replace Player8 with a (Rifleman/Player) using The new unit's max life and mana
                            • Else - Actions
                              • Do nothing
                        • Else - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • ZombieRoll Equal to 5
                            • Then - Actions
                              • If ((Player 5 (Yellow) slot status) Equal to Is playing) then do (Unit - Replace Player5 with a (Greater Zombie/Player) using The new unit's max life and mana) else do (Trigger - Run (This trigger) (checking conditions))
                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                • If - Conditions
                                  • (Unit-type of Player5) Equal to (Greater Zombie/Player)
                                • Then - Actions
                                  • Unit - Replace Player1 with a (Rifleman/Player) using The new unit's max life and mana
                                  • Unit - Replace Player2 with a (Rifleman/Player) using The new unit's max life and mana
                                  • Unit - Replace Player3 with a (Rifleman/Player) using The new unit's max life and mana
                                  • Unit - Replace Player4 with a (Rifleman/Player) using The new unit's max life and mana
                                  • Unit - Replace Player6 with a (Rifleman/Player) using The new unit's max life and mana
                                  • Unit - Replace Player7 with a (Rifleman/Player) using The new unit's max life and mana
                                  • Unit - Replace Player8 with a (Rifleman/Player) using The new unit's max life and mana
                                • Else - Actions
                                  • Do nothing
                            • Else - Actions
                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                • If - Conditions
                                  • ZombieRoll Equal to 6
                                • Then - Actions
                                  • If ((Player 6 (Orange) slot status) Equal to Is playing) then do (Unit - Replace Player6 with a (Greater Zombie/Player) using The new unit's max life and mana) else do (Trigger - Run (This trigger) (checking conditions))
                                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    • If - Conditions
                                      • (Unit-type of Player6) Equal to (Greater Zombie/Player)
                                    • Then - Actions
                                      • Unit - Replace Player1 with a (Rifleman/Player) using The new unit's max life and mana
                                      • Unit - Replace Player2 with a (Rifleman/Player) using The new unit's max life and mana
                                      • Unit - Replace Player3 with a (Rifleman/Player) using The new unit's max life and mana
                                      • Unit - Replace Player4 with a (Rifleman/Player) using The new unit's max life and mana
                                      • Unit - Replace Player5 with a (Rifleman/Player) using The new unit's max life and mana
                                      • Unit - Replace Player7 with a (Rifleman/Player) using The new unit's max life and mana
                                      • Unit - Replace Player8 with a (Rifleman/Player) using The new unit's max life and mana
                                    • Else - Actions
                                      • Do nothing
                                • Else - Actions
                                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    • If - Conditions
                                      • ZombieRoll Equal to 7
                                    • Then - Actions
                                      • If ((Player 7 (Green) slot status) Equal to Is playing) then do (Unit - Replace Player7 with a (Greater Zombie/Player) using The new unit's max life and mana) else do (Trigger - Run (This trigger) (checking conditions))
                                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                        • If - Conditions
                                          • (Unit-type of Player7) Equal to (Greater Zombie/Player)
                                        • Then - Actions
                                          • Unit - Replace Player1 with a (Rifleman/Player) using The new unit's max life and mana
                                          • Unit - Replace Player2 with a (Rifleman/Player) using The new unit's max life and mana
                                          • Unit - Replace Player3 with a (Rifleman/Player) using The new unit's max life and mana
                                          • Unit - Replace Player4 with a (Rifleman/Player) using The new unit's max life and mana
                                          • Unit - Replace Player5 with a (Rifleman/Player) using The new unit's max life and mana
                                          • Unit - Replace Player6 with a (Rifleman/Player) using The new unit's max life and mana
                                          • Unit - Replace Player8 with a (Rifleman/Player) using The new unit's max life and mana
                                        • Else - Actions
                                          • Do nothing
                                    • Else - Actions
                                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                        • If - Conditions
                                          • ZombieRoll Equal to 8
                                        • Then - Actions
                                          • If ((Player 8 (Pink) slot status) Equal to Is playing) then do (Unit - Replace Player8 with a (Greater Zombie/Player) using The new unit's max life and mana) else do (Trigger - Run (This trigger) (checking conditions))
                                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                            • If - Conditions
                                              • (Unit-type of Player8) Equal to (Greater Zombie/Player)
                                            • Then - Actions
                                              • Unit - Replace Player1 with a (Rifleman/Player) using The new unit's max life and mana
                                              • Unit - Replace Player2 with a (Rifleman/Player) using The new unit's max life and mana
                                              • Unit - Replace Player3 with a (Rifleman/Player) using The new unit's max life and mana
                                              • Unit - Replace Player4 with a (Rifleman/Player) using The new unit's max life and mana
                                              • Unit - Replace Player5 with a (Rifleman/Player) using The new unit's max life and mana
                                              • Unit - Replace Player6 with a (Rifleman/Player) using The new unit's max life and mana
                                              • Unit - Replace Player7 with a (Rifleman/Player) using The new unit's max life and mana
                                            • Else - Actions
                                              • Do nothing
                                        • Else - Actions
                                          • Do nothing
        • Else - Actions
          • Do nothing
 
Level 3
Joined
Mar 2, 2008
Messages
62
arent they all the same unit?

but id do it without if statements. id use one unit-type array, and a unit group.

note that im doing this without the editor, so the actions wont always be exactly the same as written in the editor

  • For (Integer A = 1 to NumberOf DifferentZombies)
  • -Create 1 ZombieType[For Loop Integer A] for Neutral Passive at Center of TemporaryRegion
  • -Unit Group - Add Last Created Unit to ZombieGroup
  • If (HasZombie Equal to false)
    • -For (Integer A = 1 to NumberOfPlayers)
      • -If ((Player Number (For Loop Integer A)) Status Equal to (Is Playing))
        • -Pick 1 Random Unit from ZombieGroup and Change Owner to Player Number(For Loop Integer A)
          • -Remove Picked Unit from ZombieGroup
something like that.

confusing? add every type of unit to a unit group, and randomly pick and remove units from it until everyone has a unit.
 
Level 16
Joined
Oct 12, 2008
Messages
1,570
Ok, first: This could be done very easily,,
Do you get the principle of 'For each integer A from (Integer1) to (Integer2) '?
Lets say this:
  • Events
  • Conditions
  • Actions
    • For each (Integer A) from 1 to 10,do (Actions)
      • Loop - Actions
        • Unit - Create 1 Footman for Player 1 (Red) at (Center of (Playable map area)) facing Default building facing degrees
It means it will do every action under it, for the integer value from 1, then 2, then 3, until it is at the second integer number,,
In this case: 10 footman will be spawned,,

I think Player1, Player2, and all those are variables? If you make them an array and do:
Set Player[1] = Player1Wisp
Set Player[2] = Player2Wisp
And so on,,

This would be the result in short and i think it would work:
  • Events
  • Conditions
  • Actions
    • For each (Integer A) from 1 to PlayerNumber, do (Actions)
      • Loop - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • ((Player((Integer A))) slot status) Equal to Is playing
          • Then - Actions
            • Unit - Replace Player[(Integer A)] with a (Greater Zombie\Player) using The new unit's max life and mana
          • Else - Actions
            • Trigger - Run (This trigger) (checking conditions)
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (Unit-type of Player[(Integer A)] Equal to (Greater Zombie\Player)
          • Then - Actions
            • For each (Integer B) from 1 to PlayerNumber, do (Actions)
              • Loop - Actions
                • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                  • If - Conditions
                    • (Integer A) Not equal to (Integer B)
                  • Then - Actions
                    • Unit - Replace Player[(Integer B)] with a (Rifleman\Player) using The new unit's max life and mana
                  • Else - Actions
          • Else - Actions
Get it? If not,, feel free to ask anything ;)
 
Level 10
Joined
Apr 13, 2005
Messages
630
Interger A/B r the same as they r loops they do a certain amount of triggers. As you want to spawn a unit fro each player use this
  • For each (Integer A) from 1 to 12, do (Actions)
    • Loop - Actions
      • Unit - Create 1 Footman for (Player((Integer A))) at (Center of (Playable map area)) facing Default building facing degrees
This will spawn for every player as the last # to the loop is 12. Basicly the 1 to ## is how many time the loop will run. Set it to any number you want. The frist number doesnt have to be set to 1 but any number as well. Its just the starting number the Loop will start at. There is also Integer variable which could be set to any variable that is an integer.

If you need anymore help just ask me k :p
 
Status
Not open for further replies.
Top