maze problem

LoveTD's

New Member
Reaction score
34
hey all, I have a problem. I want to have 15 creeps spawn from the top of a place, move them down, but I want them to randomly not spawn 2 creeps so it will be like this:


Code:
-x- -x- -x- -x- -|- -x- -x- -x- -x- -x- -x- -|- -x- -x- -x-
-x- -x- -|- -x- -x- -x- -x- -x- -x- -x- -x- -|- -x- -x- -x-
-x- -|- -x- -x- -x- -x- -x- -x- -x- -|- -x- -x- -x- -x- -x-

you get the point right?

eather way, what i have so far is: I putted all the regions I made into variable arrays and started of with a loop, but then i thought I need to make something with random integers, the problem then is is that it can spawn more than 1 creep in 1 region, how do I make it so that it would spawn the way I want?
 
Reaction score
86
GUI huh? :( That stinks, well what you need to do is to have to integer variables, a random number from 1-15 for the first one. Then make a forloop that will never finish, ex. 1 to 0 then. In the for loop>>Pick a random integer from 1 -15 for the other one. do an if statement, if integer is NOT equal to the first one then Custom script "exitwhen true" . Now for the random spawns. You do the same thing. So, if you have the spawn system worked out and this is only dependent on the region, than you do the same thing. A loop that goes on forever. (Another integer needed), set the integer from 1 - 15. If the integer is NOT equal to integer 1 AND NOT equal to integer 2 then exitwhen true. Then just spawn the unit at that region.

Code:
Quick Outline:
Actions-
set integer1 = Random int from 1 - 15
For loop from 1 to 0 and do actions-
-----Set integer2 = random int from 1 -15
-----if integer2 not equal to integer1 then
-----------Custom Script "exitwhen true"
-----endif
<<If you want to make it spawn 15 times, then start a for loop here and loop through the rest of this snippet 15 times.
For loop from 1 to 0 and do actions-
-----set integer3 = random int from 1-15
-----if integer3 not equal to integer2 and integer3 not equal to integer1 then
--------Custom Script "exitwhen true" << Just in case you didn't know, this immediately exits out of a for loop :D
-----endif
set location = Center of regionArray[integer3]
Unit create 1 Footmen for player 1 at location
Custom script call RemoveLocation(udg_location)
 
Reaction score
86
It spawns 15 creeps if you want it to o_O, what it does is that is doesn't spawn the creeps at 2 random regions. It also can spawn more than one unit at any region. Reason why it looks complicated is because you need to make sure that both the random regions aren't the same ones, and you need to make sure that the region each creep spawns from isn't one of the 2 random regions.
 

Tiber

Member
Reaction score
4
but I want them to randomly not spawn 2 creeps
I don't quite understand this. You want all of them to be spawned randomly or do you want two creeps to be spawned at the same spot?
 

LoveTD's

New Member
Reaction score
34
@Tiber: I want them to spawn 15 units - 2 units from a random place... so you have 2 spots where you can go through...
as you can see in the first post, I made an example... the x means there spawns a unit and the | means there is a open spot...

@infinitegde: I made the trigger, but it doesn't work because i can't find the spot where to add the endif :D

Code:
creeps 2 big part 1
    Events
        Time - Every 2.00 seconds of game time
    Conditions
    Actions
        Set Randomint[1] = (Random integer number between 1 and 15)
        For each (Integer A) from 1 to 0, do (Actions)
            Loop - Actions
                Set Randomint[2] = (Random integer number between 1 and 15)
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        Randomint[2] Not equal to Randomint[1]
                    Then - Actions
                        Custom script:   exitwhen true
                    Else - Actions
        For each (Integer B) from 1 to 0, do (Actions)
            Loop - Actions
                Set Randomint[3] = (Random integer number between 1 and 15)
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Randomint[3] Not equal to Randomint[2]) and (Randomint[3] Not equal to Randomint[1])
                    Then - Actions
                        Custom script:   exitwhen true
                    Else - Actions
        Set temp_loc = Creeps2spawn[Randomint[3]]
        Unit - Create 1 Creeps for Player 12 (Brown) at temp_loc facing Default building facing degrees
        Custom script:   call RemoveLocation(udg_temp_loc)

It also can spawn more than one unit at any region.

can or can't 0_o?? nevermind i got your point :p but i'm still having a problem with the endif ^^
 
Reaction score
86
o_O XD you don't need to add end if. Also, for
Code:
For each (Integer B) from 1 to 0, do (Actions)
            Loop - Actions
                Set Randomint[3] = (Random integer number between 1 and 15)
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Randomint[3] Not equal to Randomint[2]) and (Randomint[3] Not equal to Randomint[1])
                    Then - Actions
                        Custom script:   exitwhen true
                    Else - Actions
        Set temp_loc = Creeps2spawn[Randomint[3]]
        Unit - Create 1 Creeps for Player 12 (Brown) at temp_loc facing Default building facing degrees
        Custom script:   call RemoveLocation(udg_temp_loc)

Surround this in a for loop and do it from 1- 15. (For loop A because your using B inside of it.) should work fine :D
 

LoveTD's

New Member
Reaction score
34
Code:
creeps 2 big part 1
    Events
        Time - Every 2.00 seconds of game time
    Conditions
    Actions
        Set Randomint[1] = (Random integer number between 1 and 15)
        For each (Integer A) from 1 to 0, do (Actions)
            Loop - Actions
                Set Randomint[2] = (Random integer number between 1 and 15)
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        Randomint[2] Not equal to Randomint[1]
                    Then - Actions
                        Custom script:   exitwhen true
                    Else - Actions
        For each (Integer A) from 1 to 15, do (Actions)
            Loop - Actions
                For each (Integer B) from 1 to 0, do (Actions)
                    Loop - Actions
                        Set Randomint[3] = (Random integer number between 1 and 15)
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                (Randomint[3] Not equal to Randomint[2]) and (Randomint[3] Not equal to Randomint[1])
                            Then - Actions
                                Custom script:   exitwhen true
                            Else - Actions
        Set temp_loc = Creeps2spawn[Randomint[3]]
        Unit - Create 1 Creeps for Player 12 (Brown) at temp_loc facing Default building facing degrees
        Custom script:   call RemoveLocation(udg_temp_loc)

you mean like this 0_o? doesn't work :p sorry if I'm a pain in the @ss
 

Tiber

Member
Reaction score
4
You can go about it using random point in region, but that isn't very accurate to your requests.

Or you can do this:
Create 1 dummy unit ("Spawn dummy") at each spot you want your creeps to be spawned, you'll use them in a unit group ("Spawn_Group").
You need the initial region where the dummies are ("Spawn_Region")
You'll want an integer ("a").

Trigger:
Event -
Your event
Conditions -
Actions -
Set a = 0
Pick every unit in 'Spawn_Region'
..If -
....Unit type of picked unit is 'Spawn dummy'
..Then -
....Add picked unit to 'Spawn_Group'
..Else -
Pick every unit in Spawn_Group
..Set temp_unit = picked unit
..Pick every unit within 10 range of temp_unit
....If -
......Unit type of picked unit not equal to 'Spawn dummy'
......Unit type of picked unit not equal to [your other units that can reach the spawn spot]
......a less than or equal to 15
....Then -
......Unit create 1 creep for Neutral Hostile at position of picked unit
......Set a = a + 1
....Else -

EDIT: Sorry for all the edits, I'm pretty tired.
 
Reaction score
86
One, like that:

Code:
creeps 2 big part 1
    Events
        Time - Every 2.00 seconds of game time
    Conditions
    Actions
        Set Randomint[1] = (Random integer number between 1 and 15)
        For each (Integer A) from 1 to 0, do (Actions)
            Loop - Actions
                Set Randomint[2] = (Random integer number between 1 and 15)
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        Randomint[2] Not equal to Randomint[1]
                    Then - Actions
                        Custom script:   exitwhen true
                    Else - Actions
        For each (Integer A) from 1 to 15, do (Actions)
            Loop - Actions
                For each (Integer B) from 1 to 0, do (Actions)
                    Loop - Actions
                        Set Randomint[3] = (Random integer number between 1 and 15)
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                (Randomint[3] Not equal to Randomint[2]) and (Randomint[3] Not equal to Randomint[1])
                            Then - Actions
                                Custom script:   exitwhen true
                            Else - Actions
                   Set temp_loc = Creeps2spawn[Randomint[3]]
                   Unit - Create 1 Creeps for Player 12 (Brown) at temp_loc facing Default building facing degrees
                   Custom script:   call RemoveLocation(udg_temp_loc)

Two, o_O? How does it not work? Does anything happen at all? Is the trigger enabled?
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      • Ghan
        Administrator - Servers are fun

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top