• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Help with spawning units

Status
Not open for further replies.
Level 5
Joined
Jun 18, 2004
Messages
136
how do i make units spawn from a building like in footman wars? and then how do i make it spawn a different unit after somthing has been researched? what triggers would i use?
 
Level 3
Joined
Jun 28, 2004
Messages
32
To make them spawn every X seconds, do:

Events:
Map initialization
Conditions:
Nothing(Or Player X owns Z building)
Actions:
Create 1 UNIT for player X at Region Y
Wait 2.00 Seconds
 
Level 22
Joined
May 11, 2004
Messages
2,863
If you assign units to spawn in a region, you can put that region anywhere, like under a building for example, so it will give the effect that the unit is spawning from the building, or you can trigger the units to spawn at a position of a unit, such as a building. As for the changing units, you need to a spawn trigger for each unit type, and all of them turned off except the one spawning the initial unit typ. When you research, you'd have to turn off the current spawn trigger and turn on another.

Trigger examples:Event: Every ??? seconds of game time
Action: UNit-create a (unit-type) for (player) at Region-center of region (x)
-or-
Action Unit-create a (unit-type) for (player) at Unit-position of (unit)

Research:
Action: player finishes research
Condition: Player- triggering player is equal to (player) red?
Action: Turn off "red's footman spawn tigger"
Turn on "red's knight spawn trigger" (just example)

-VGsatomi
 
Level 8
Joined
Apr 3, 2004
Messages
507
The way I did it was a periodic trigger, much like this:
Code:
Spawn tier 1
    Events
        Time - Every 15.00 seconds of game time
    Conditions
    Actions
        Player Group - Pick every player in playergroupArraySpawn[1] and do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        ((Picked player) Food used) Less than 36
                    Then - Actions
                        Unit - Create 1 unittypeArraySpawn[(Player number of (Picked player))] for (Picked player) at (Center of regionArrayStart[(Player number of (Picked player))]) facing (Position of Fae Toadstool 0012 <gen>)
                        Set unitArrayDebugSpawn[(Player number of (Picked player))] = (Last created unit)
                        AI - Ignore unitArrayDebugSpawn[(Player number of (Picked player))]'s guard position
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                booleanArrayRallyUnit[(Player number of (Picked player))] Equal to False
                                booleanArrayRallyPoint[(Player number of (Picked player))] Equal to True
                            Then - Actions
                                AI - Ignore unitArrayDebugSpawn[(Player number of (Picked player))]'s guard position
                                Unit - Order (Last created unit) to Attack-Move To pointArrayRallyPoint[(Player number of (Picked player))]
                            Else - Actions
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                booleanArrayRallyUnit[(Player number of (Picked player))] Equal to True
                                booleanArrayRallyPoint[(Player number of (Picked player))] Equal to True
                            Then - Actions
                                AI - Ignore unitArrayDebugSpawn[(Player number of (Picked player))]'s guard position
                                Unit - Order (Last created unit) to Right-Click unitArrayRallyUnit[(Player number of (Picked player))]
                            Else - Actions
                    Else - Actions
Actually, it was exactly like that. This is part of a spawning system that can make units at different rates, with a periodic trigger for each rate. There's also a trigger that moves people to a different rate when they get an upgrade, and something that removes them from all the spawn groups when they die.

As far as upgrading units, you could either give your Footman unit a Chaos ability which would change him to a Knight and give it a tech requirement of your upgrade, or you could change the unit-type that's spawned based on the level of upgrade for the player. In the trigger I pasted, unittypeArraySpawn[] is different for each race. You could make it different for each level of an upgrade.

The event that you'd use for when a research is gotten is "Unit - A unit Finishes research". It's a "Generic Unit Event".
 
Status
Not open for further replies.
Top