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

Random Spawn System Problem

Status
Not open for further replies.
Level 4
Joined
Apr 23, 2011
Messages
42
Hi Guys..

this is my random spawn region system:

http://uupload.ir/files/hrbs_2.jpg

and

http://uupload.ir/files/go4_3.jpg

I have This Problem :

i dont want repeat regions

i want use region only 1 time...what can i do?

for example: if create 1 randombase in townhall 1 (between 0 and 11)..remove this line like this (0 and 10)

srry for my bad english ..i can't speak english good

please help me..tnx
 
Level 13
Joined
Oct 12, 2016
Messages
769
I have a better suggestion: use player start locations.
Go to Scenario -> Player Properties, and don't check off "Fixed Start Location"
Then, do something like this:
  • Melee Initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 11, do (Actions)
        • Loop - Actions
          • Set TempPoint = ((Player((Integer A))) start location)
          • Unit - Create 1 Town Hall for (Player((Integer A))) at TempPoint facing Default building facing degrees
          • Custom script: call RemoveLocation(udg_TempPoint)
Place the start locations where you want players to randomly start.
 
Level 4
Joined
Apr 23, 2011
Messages
42
hi. tnx man

i create RandomBase = point
and rename that : Custom script: call RemoveLocation(udg_RandomBase)

i don't check "Fixed Start Location" === random work but create 2 town hall
i check "Fixed Start Location" === random dont work!!

i do all of this .. .. i want random start location from player 1 to 12

this trigger create town hall for all players ... i want create town hall for player controller and human race

Is there an idea?
 
Last edited:
Level 13
Joined
May 10, 2009
Messages
868
A few days ago someone had a problem almost like yours - that person needed a way of getting a random number, but such number shouldn't be picked again, which seems to be your case too. Please, read this thread a little bit, specially at this part. After reading some posts from that thread, you'll be able to understand what's going to happen from now on.


All right, if you're willing to use that unordered list in your map, your "initialization trigger" should be set up like this:
  • Initialize Rects and List
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set RandomBase[0] = Town Hall P01 <gen>
      • Set RandomBase[1] = Town Hall P02 <gen>
      • Set RandomBase[2] = Town Hall P03 <gen>
      • -------- ... --------
      • -------- Create an unordered list of numbers from 0 to 11 --------
      • For each (Integer List_Size) from 0 to 11, do (Actions)
        • Loop - Actions
          • Set List_Entry[List_Size] = List_Size
      • -------- NOTE: At this point List_Size variable is set to 12 --------
Create town halls using that list:
  • Create Town Halls
    • Events
      • Time - Elapsed game time is 1.00 seconds
    • Conditions
    • Actions
      • -------- Player Group (All Players) only enumerates player slots that aren't empty - that is, users and computers. --------
      • Player Group - Pick every player in (All players) and do (Actions)
        • Loop - Actions
          • Set tmp_player = (Picked player)
          • -------- *Sigh* We must take into account players that might leave the game before this trigger runs --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (tmp_player slot status) Equal to Is playing
            • Then - Actions
              • -------- Pick a random number from our list --------
              • Set List_RND = (Random integer number between 0 and (List_Size - 1))
              • Set Result = List_Entry[List_RND]
              • -------- Reduce the number of entries, and replace the chosen number with the last one on the list --------
              • Set List_Size = (List_Size - 1)
              • Set List_Entry[List_RND] = List_Entry[List_Size]
              • -------- Create town halls --------
              • Set tmp_point = (Center of RandomBase[Result])
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Race of tmp_player) Equal to Human
                • Then - Actions
                  • -------- Human --------
                  • Unit - Create 1 Town Hall for tmp_player at tmp_point facing Default building facing degrees
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Race of tmp_player) Equal to Orc
                    • Then - Actions
                      • -------- Orc --------
                      • Unit - Create 1 Great Hall for tmp_player at tmp_point facing Default building facing degrees
                    • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Race of tmp_player) Equal to Undead
                        • Then - Actions
                          • -------- Undead --------
                          • Unit - Create 1 Necropolis for tmp_player at tmp_point facing Default building facing degrees
                        • Else - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • (Race of tmp_player) Equal to Night Elf
                            • Then - Actions
                              • -------- Night Elf --------
                              • Unit - Create 1 Tree of Life for tmp_player at tmp_point facing Default building facing degrees
                            • Else - Actions
              • Camera - Pan camera for tmp_player to tmp_point over 0.00 seconds
              • Selection - Select (Last created unit) for tmp_player
              • -------- Prevent leaks --------
              • Custom script: call RemoveLocation(udg_tmp_point)
            • Else - Actions
That should do it. I also wanted to tweak the way how that list works a little bit, but I don't want to be inconsistent and confuse you.
 

Attachments

  • Random Spawn.w3x
    18.3 KB · Views: 25
Status
Not open for further replies.
Top