HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Specific Unit Spawn In Region? HELP

11-27-2003, 07:15 PM#1
Dark_Army
I am trying to make a trigger that will have a building spawn specific units that are in a region.

Events
Unit - A unit enters Bloodwinter Clan Unit Spawn <gen>

Units that enter that region will be spawned/created every 30 seconds at a barracks. Unlimited units can be put in the region, just as long as they fit inside it.

I am not really sure how I would do this?

Can anyone help
11-27-2003, 07:31 PM#2
AllPainful
I think I know what your looking for... this might be it:

2 Variables (per player if you have multiple players that need this):
Spawn = Unit-type array
Spawncount = Integer.

Triggers:

Code:
Add to spawn
Events
  Unit enters region (Spawner)
Conditions
Actions
  set variable spawncount = spawncound +1
  set Spawn[spawncound] = entering unit

Remove from spawn
Events
  Unit leaves region (Spawner)
Conditions
Actions
  Do loop for integer A from 1 to spawncount
    If spawn[integerA] = leaving unit
       Set variable spawn[integerA] = spawn[spawncout]
       Set variable spawncount = spawncount-1
    Else
       Do nothing

Spawning units
Events
  Every 30 seconds
Conditions
  Number of units in region (Spawner) greater than 0
Actions
  Pick all units of type (barracks)
    Loop for integer B from 1 to spawncount
      Create unit spawn[integerB] for player (owner of picked unit) at location of (picked unit)

If you want info on exactly how this works, just let me know.


EDIT:

Quote:
Dark_Army wrote on 27-11-2003 12:58 PM:
But I can't figure out how to do this line with that code:

If spawn[integerA] = leaving unit
Set variable spawn[integerA] = spawn[spawncout]
Set variable spawncount = spawncount-1
Else
Do nothing

Any ideas?

Um....

Code:
If [color=red] Make sure to choose the "Multiple Fuctions" one[/color]
 Coditions
   ((Entering unit) is in (Units of type spawn[(Integer A)])) Equal to True [color=red]Boolean comparison, unit group comparison, unit of type.[/color]
  Actions
   Set variable spawn[integerA] = spawn[spawncout]
   Set variable spawncount = spawncount-1
  Else
   Do nothing
EDIT2 (if anyone is wondering why I keep editing like this, its in case someone else is having the same problems as Dark_Army):

Quote:
Dark_Army wrote on 27-11-2003 14:19 PM:
Actions
Pick all units of type (barracks)
Loop for integer B from 1 to spawncount
Create unit spawn[integerB] for player (owner of picked unit) at location of (picked unit)

Having trouble with this line, can't create it, this is as close as I got:

Actions
Unit Group - Pick every unit in (Units of type Bloodwinter Clan Fortress) and do (Actions)
Loop - Actions
For each (Integer B) from 1 to bloodwintercount, do (Actions)
Loop - Actions
Unit - Create a bloodwinterspawn[(Integer B)] corpse for (Owner of (Picked unit)) at (Position of (Picked unit))

which as you can see isn't right. Could you explain how to do this and I will get out of your hair :ggani:

Hmmm....
Code:
Unit Group - Pick every unit in (Units of type Barracks) and do (Actions)
    Loop - Actions
        For each (Integer B) from 1 to spawncount, do (Actions)
            Loop - Actions
                Unit - Create 1 Spawn[(Integer B)] for Player 1 (Red) at (Position of (Picked unit)) facing (Position of (Picked unit))
When spawning units you must do the one that says "Creat units facing point" or "Create unit facing angle" the one above is "Facing Point" but it doesn't matter which one you use.
11-27-2003, 11:20 PM#3
676
what he said
11-28-2003, 02:07 AM#4
Dark_Army
Yah sorry, I am pretty bad with triggers and I have a hard time simply figuring out what trigger to use even when told lol. I am getting better... slowly :WD:
11-28-2003, 02:22 AM#5
AllPainful
Well practice makes perfect Dark_Army. Everyone had to learn some time. :ggani:

Need any further assist feel free to ask, I am glad to help.
11-28-2003, 02:32 AM#6
QuatreDan
It sounds to me that you're making one of those "MADNESS"-type games like back in SC (good times =D) where you can select out of a few different types of units to spawn. Um...in madness games...there have never really been limits to how many units you can spawn. It would just keep going until it pretty much didn't let you spawn any more. Blizzard usually has its own built-in limits in their games, so don't bother making your own. When they reach the ultimate limit, Blizzard's built-in limit thing will kick in and prevent any more units from being created. You've never experienced that limit in a StarCraft Madness game before?

P.S. They also already have a built-in thing for when units trying to be created won't fit into where they're going. Which is what you're trying to do. So, seriously, Blizzard, for once, has you covered.
11-28-2003, 03:38 AM#7
Ligature
Hang on... why do you need to have a unit array and all that jazz to basically copy all units in a region to some point every 30 seconds? Can't you just do this:

Code:
Event - Every 30 seconds of game time

Condition - Unit Group (units in Bloodwinter Clan Unit Spawn <gen>) is empty is equal to False

Action - pick each unit in Unit Group (units in Bloodwinter Clan Unit Spawn <gen>) and do: create 1 (unit-type of picked unit) at (wherever you want the spawn)

?? It doesn't use any variables at all, and it's just one trigger...
11-28-2003, 03:42 AM#8
Dark_Army
Yah, but would that work if there is multiple units of the same type?
11-28-2003, 03:44 AM#9
Ligature
Sure thing.

(EDIT) Wait what do you mean by multiple units of the same type - multiple units of the same type in the "Bloodwinter Clan Spawn etc?"
11-28-2003, 03:46 AM#10
Dark_Army
I mean like two white wolves, like two of the same unit. Would that just create 1 white wolf or two?
11-28-2003, 03:47 AM#11
Ligature
If there were two white wolves in the spawn region, it would pick each of them and for each one create a unit of the unit-type of the picked unit - meaning it would create two.
11-28-2003, 03:51 AM#12
Dark_Army
Ok, would it still create the units, even if they leave the region? If there is nothing in the region, it shouldn't create anything right?

The complicated trigger given is kind of buggy. Like if a unit leaves and enters then leaves and enters it will double and create 4 if there is only like 2.
11-28-2003, 03:54 AM#13
Ligature
All the trigger I wrote does is this:

Every 30 seconds:
If there are units in the spawn region:
Copy each unit in the spawn region to some point.

So yeah, if the units leave the region before the spawn, it won't copy 'em.
11-28-2003, 04:02 AM#14
AllPainful
Ligature's trigger is correct, and will work. And its much less complicated. Sorry, I am used to using variables because I like to use them because then everything is right there in the variable. Ligature's solution is the simple and correct way to do what you want, I had just finished making a complex trigger, and I think that is why the complex way to do it is what popped into my mind. LOL. Go Ligature.
11-28-2003, 04:07 AM#15
Dark_Army
Lol, yours worked fine :D

But one problem I am running into with Ligature's is that I have a circle of power that I don't want to spawn. I want the circle of power but I don't want it to spawn with the units obviously :ggani:

Anyway around this?