• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Trigger] Random not random...\ too many player spawns

Status
Not open for further replies.
Ok in my map I have a whole bunch of towns that some randomly upgrade to villages and some of those villages upgrade into cities.

Problem is the same cities upgrade each and every time. Why are my random triggers not bringing random results?!

  • Town Upgrades
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set Towns = (Units of type Town)
      • For each (Integer A) from 1 to ((Number of units in Towns) / 2), do (Actions)
        • Loop - Actions
          • Unit Group - Add (Random unit from Towns) to Villages
          • Unit Group - Pick every unit in Villages and do (Actions)
            • Loop - Actions
              • Unit Group - Remove (Picked unit) from Towns
      • For each (Integer B) from 1 to ((Number of units in Villages) / 2), do (Actions)
        • Loop - Actions
          • Unit Group - Add (Random unit from Villages) to Citys
          • Unit Group - Pick every unit in Citys and do (Actions)
            • Loop - Actions
              • Unit Group - Remove (Picked unit) from Villages
      • Unit Group - Pick every unit in Citys and do (Actions)
        • Loop - Actions
          • Unit - Replace (Picked unit) with a City using The old unit's relative life and mana
          • Unit - Set level of Gold Mine ability plus for (Picked unit) to 3
          • Neutral Building - Add 12500 gold to (Picked unit)
          • Neutral Building - Add 12500 gold to (Picked unit)
      • Unit Group - Pick every unit in Villages and do (Actions)
        • Loop - Actions
          • Unit - Replace (Picked unit) with a Village using The old unit's relative life and mana
          • Unit - Set level of Gold Mine ability plus for (Picked unit) to 2
          • Neutral Building - Add 12500 gold to (Picked unit)
-----

Also I have triggers that choose a random player and makes him bad, and then it creates the base units for all players that are playing, problem is it creates units for players who arent playing, and I dont know if it chooses a random start location at the beggining of the map though,

Here are the triggers for that

  • RuntBad
    • Events
    • Conditions
    • Actions
      • Player Group - Pick every player in (All players controlled by a User player) and do (Actions)
        • Loop - Actions
          • Player Group - Add (Picked player) to Good
          • For each (Integer A) from 1 to 10, do (Actions)
            • Loop - Actions
              • Player - Make (Picked player) treat (Player((Integer A))) as an Ally
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of players in Good) Greater than 2
        • Then - Actions
          • Player Group - Add (Random player from Good) to Bad
          • Player Group - Pick every player in Bad and do (Actions)
            • Loop - Actions
              • Player Group - Remove (Picked player) from Good
        • Else - Actions
      • Game - Display to Good the text: You are |cff00ff00g...
      • Game - Display to Bad the text: You are |cffff0000b...
      • Player Group - Pick every player in (All players controlled by a User player) and do (Actions)
        • Loop - Actions
          • Unit - Create 1 Camp for (Picked player) at ((Picked player) start location) facing Default building facing degrees
          • Unit - Create 3 Worker for (Picked player) at ((Picked player) start location) facing Default building facing degrees
          • Unit - Create 2 Spearman for (Picked player) at ((Picked player) start location) facing Default building facing degrees
          • Unit - Create 1 Spear Thrower for (Picked player) at ((Picked player) start location) facing Default building facing degrees
 
Level 7
Joined
Sep 5, 2006
Messages
334
Don't see the problem in the 2nd trigger, but if you use the world editer test buttom, random will be fixed. Don't world editer and use warcarft to test.
P.S. Try the player thing somewhere in world editer, there is a fixed player starting loction somewhere there.
OMG, someone just beat me at answering.
 
Ok few issues here, I updated the triggers, and I have been using warcraft to test maps, I have NewGen and since new patch came out it has not been working so I swaped newer files of world edit with older ones, since then the test button has not been working.

The new triggers for the town upgrade are:
  • Town Upgrades
    • Events
      • Map initialization
    • Conditions
    • Actions
      • For each (Integer A) from 1 to ((Number of units in (Units of type Town)) / 2), do (Actions)
        • Loop - Actions
          • Unit - Replace (Random unit from (Units of type Town)) with a Village using The old unit's relative life and mana
      • Wait 0.10 seconds
      • For each (Integer A) from 1 to ((Number of units in (Units of type Village)) / 2), do (Actions)
        • Loop - Actions
          • Unit - Replace (Random unit from (Units of type Village)) with a City using The old unit's relative life and mana
      • Unit Group - Pick every unit in (Units of type Village) and do (Actions)
        • Loop - Actions
          • Unit - Set level of Gold Mine ability plus for (Picked unit) to 2
          • Neutral Building - Set (Picked unit) to 25000 gold
      • Unit Group - Pick every unit in (Units of type City) and do (Actions)
        • Loop - Actions
          • Unit - Set level of Gold Mine ability plus for (Picked unit) to 3
          • Neutral Building - Set (Picked unit) to 50000 gold
and the new triggers for the unit spawn are:

  • RuntBad
    • Events
    • Conditions
    • Actions
      • Player Group - Pick every player in (All players) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked player) slot status) Equal to Is playing
            • Then - Actions
              • Player Group - Add (Picked player) to Good
              • For each (Integer A) from 1 to 10, do (Actions)
                • Loop - Actions
                  • Player - Make (Picked player) treat (Player((Integer A))) as an Ally
            • Else - Actions
      • For each (Integer A) from 1 to 10, do (Actions)
        • Loop - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of players in Good) Greater than 2
        • Then - Actions
          • Player Group - Add (Random player from Good) to Bad
          • Player Group - Pick every player in Bad and do (Actions)
            • Loop - Actions
              • Player Group - Remove (Picked player) from Good
        • Else - Actions
      • Game - Display to Good the text: You are |cff00ff00g...
      • Game - Display to Bad the text: You are |cffff0000b...
      • For each (Integer A) from 1 to ((Number of players in Bad) + (Number of players in Good)), do (Actions)
        • Loop - Actions
          • Player Group - Pick every player in (All players matching (((Player((Integer A))) slot status) Equal to Is playing)) and do (Actions)
            • Loop - Actions
              • Unit - Create 1 Camp for (Picked player) at ((Picked player) start location) facing Default building facing degrees
              • Unit - Create 3 Worker for (Picked player) at ((Picked player) start location) facing Default building facing degrees
              • Unit - Create 2 Spearman for (Picked player) at ((Picked player) start location) facing Default building facing degrees
              • Unit - Create 1 Spear Thrower for (Picked player) at ((Picked player) start location) facing Default building facing degrees
Now the issues are, its only making 1 town into a different building, and its the same one, and it goes to a city. There should be 4 towns, 2 villages, and 1 city.

Also with the unit spawning its giving everyone twice the units.

----

btw fixed random is off.
 
Level 7
Joined
Sep 5, 2006
Messages
334
I think its became you would have 7 town at the start but when 7 is divide by 2 it give a 3.5, then more unknown problem is cause.
 
Status
Not open for further replies.
Top