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

[Solved] All Random!?

Status
Not open for further replies.
Level 5
Joined
Jul 30, 2012
Messages
93
  • Rastgele Modu
    • Events
      • Player - Player 1 (Red) types a chat message containing -tr as An exact match
      • Player - Player 1 (Red) types a chat message containing -tümürastgele as An exact match
    • Conditions
      • rastgele_used[(Player number of (Triggering player))] Equal to False
    • Actions
      • For each (Integer A) from 1 to HeroSayisi, do (Actions)
        • Loop - Actions
          • Player Group - Pick every player in (All players) and do (Actions)
            • Loop - Actions
              • Player - Make rastgelehero[(Integer A)] Unavailable for training/construction by (Triggering player)
      • Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
        • Loop - Actions
          • Set rastgele_used[(Player number of (Triggering player))] = True
          • Set integerrandom = (Random integer number between 1 and HeroSayisi)
          • Set Temp_Point2 = ((Picked player) start location)
          • Player - Add -1 to (Picked player) Current lumber
          • Wait 1.00 seconds
          • Unit - Create 1 rastgelehero[integerrandom] for (Picked player) at Temp_Point2 facing Default building facing degrees
          • Camera - Pan camera for (Picked player) to Temp_Point over 0.00 seconds
          • Selection - Select (Last created unit) for (Picked player)
          • Custom script: call RemoveLocation(udg_Temp_Point)
          • Custom script: set udg_Temp_Point = null
      • Player Group - Pick every player in (All players) and do (Actions)
        • Loop - Actions
          • Player - Make rastgelehero[integerrandom] Unavailable for training/construction by (Picked player)
      • Set rastgelehero[integerrandom] = rastgelehero[HeroSayisi]
      • Set HeroSayisi = (HeroSayisi - 1)
i wanna complete my all random system... where i'm wrong ??
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
1) You cannot use waits in a unit-group loop (you'll have to remove that).
2) It should be a player-group loop ("pick every player in (all players)", or a player-group variable in case you've got that).
--> This means that all actions inside the unit-group loop should be moved into the player-group loop (right below that), and the unit-group loop should be removed.

Edit: just noticed this:
  • Player - Make rastgelehero[(Integer A)] Unavailable for training/construction by (Triggering player)
Should be "Picked player".

Edit 2:
And in case you want each player to random a different hero (no duplicate heroes allowed), then these actions:
  • Set rastgelehero[integerrandom] = rastgelehero[HeroSayisi]
  • Set HeroSayisi = (HeroSayisi - 1)
should be at the end of the player-group loop (but still inside it).

If you do NOT want that (there can be 2 or more of the same hero), then remove those actions.
 
Status
Not open for further replies.
Top