• 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.

[Trigger] Help with triggered spawns

Status
Not open for further replies.
Level 6
Joined
May 31, 2008
Messages
218
I'm trying to make so when unit is finished constructed it will be moved to a different spot, and the each 2 minutes in game the units will be teleported back to the house it was made in. I have figuerred alot about this but since i'm bad at triggers i have no idea about what can be done and so on.

First i thought that maybe the house production could be stopped and each 2 minutes the house can produce units.
Or units would be teleported to a area and when 2 minutes is out they will be teleported back.

The houses you make units in are there from start, you will be able to make a few more, and that is where everything gets complicated.

So if any1 could tell me on who to make this possible, and i might say that each race(12 races) have about 3-4 house from start, and you might be able to make another 3. So can i do this without extreme lagg or anything?

Might add that it's a map where you build big armies and stuff. Not just one unit
 
Last edited:
Level 6
Joined
May 31, 2008
Messages
218
is this removed unit anything spezial ? does it have item or so?
because u could simply remove it, and the create a new one after 2 mins there.

You might produce 4-10 units at a time, and different sorts of units, so can the system keep track of all the units being made? and if games is on for.... 1.5 hours you end up with 45, 2 minutes intervalls.
 
Level 10
Joined
Dec 13, 2008
Messages
222
  • Your Trigger
    • Events
      • Unit - A unit Finishes construction
    • Conditions
      • (Unit-type of (Constructed structure)) Equal to Your Structure
    • Actions
      • Set TempPoint = (Point where your structure will teleport)
      • Unit - Move (Constructed structure) instantly to TempPoint
      • Custom script: call RemoveLocation ( udg_TempPoint )
 
Level 6
Joined
May 31, 2008
Messages
218
  • Your Trigger
    • Events
      • Unit - A unit Finishes construction
    • Conditions
      • (Unit-type of (Constructed structure)) Equal to Your Structure
    • Actions
      • Set TempPoint = (Point where your structure will teleport)
      • Unit - Move (Constructed structure) instantly to TempPoint
      • Custom script: call RemoveLocation ( udg_TempPoint )

i don't want to move the house, just the units.
 
Level 8
Joined
Mar 23, 2007
Messages
302
you could go psycho advanced for this,

going JASS , or even vJASS, then u simply save the unit
with the CloneUnit function that is in the JASS Vault page to find.
then u could when the unit finished, clone and remove the unit, and on a given
time create the clone, that would be exactly the same unit.

but this , my friend, would need good knoledge of jass...
 
Level 6
Joined
May 31, 2008
Messages
218
you could go psycho advanced for this,

going JASS , or even vJASS, then u simply save the unit
with the CloneUnit function that is in the JASS Vault page to find.
then u could when the unit finished, clone and remove the unit, and on a given
time create the clone, that would be exactly the same unit.

but this , my friend, would need good knoledge of jass...

and my knowledge with programming is.... very limited, i can barely make that "hello world" thingy.

Damn : S

But then i guess this is rather hard to make with GUI?
 
Level 8
Joined
Mar 23, 2007
Messages
302
another way would be do create a Array of like lets say 8000 vaule

then whenever a unit finished bulding somthing, store this unit in the array,
set the next array 1 higher, after 2 mins return that creature back,

this would be simple but woul limit the usability of this system to only 8000 per game.
 
Level 6
Joined
May 31, 2008
Messages
218
another way would be do create a Array of like lets say 8000 vaule

then whenever a unit finished bulding somthing, store this unit in the array,
set the next array 1 higher, after 2 mins return that creature back,

this would be simple but woul limit the usability of this system to only 8000 per game.

Can't i make more arrays? just divide it so each 6 races can use one each.
Not that great on trigger, especially storing numbers and stuff, but basic triggers are easy since you can guess alot of it and get right(with the possibility you end up with huge laggs or crashes.)
 
Level 12
Joined
Aug 22, 2008
Messages
911
  • TRIGGER1
  • Events
    • A unit finishes training a unit
  • Conditions
    • Unit-type of (Training Unit... or something xD) equal to (YourUnitType)
  • Actions
    • Unit - Move (Trained Unit) to (WhatEverPosition you like)
    • Countdown Timer - Add an expiration timer to (Trained Unit) that will expire in 120.00 seconds
    • Unit - Add to the unit the classifation Tauren (or anything else)
  • TRIGGER2
  • Events - A unit dies
  • Conditions - Classifation of (Triggering Unit) equal to Tauren
  • Actions -
Here you will need to If/Then/Else the different unit- types that you have in your map, and that each unit-type will be spawned in its own building. Counting that you said that your programming knoledge is little, here is the general idea:

  • Actions
    • If (All Conditions) Then (Multiple Actions) Else (Multiple Actions)
      • If - Conditions
        • Unit type of (Triggering unit equal to value)
      • Then - Actions
        • Unit - Create 1 (Unit type of (Triggering Unit)) at (Position of (TheBuildingThatTrainedIt)) facing (whatever) degrees or whatever
        • Unit - Set life of (Last created unit) to (Life of (Triggering Unit))
        • Unit - Remove (Triggering Unit) from the game
      • Else - Actions
Thus shall repeat itself with different Unit-types and building locations. Hope you understand :)
 
Level 6
Joined
May 31, 2008
Messages
218
  • TRIGGER1
  • Events
    • A unit finishes training a unit
  • Conditions
    • Unit-type of (Training Unit... or something xD) equal to (YourUnitType)
  • Actions
    • Unit - Move (Trained Unit) to (WhatEverPosition you like)
    • Countdown Timer - Add an expiration timer to (Trained Unit) that will expire in 120.00 seconds
    • Unit - Add to the unit the classifation Tauren (or anything else)
  • TRIGGER2
  • Events - A unit dies
  • Conditions - Classifation of (Triggering Unit) equal to Tauren
  • Actions -
Here you will need to If/Then/Else the different unit- types that you have in your map, and that each unit-type will be spawned in its own building. Counting that you said that your programming knoledge is little, here is the general idea:

  • Actions
    • If (All Conditions) Then (Multiple Actions) Else (Multiple Actions)
      • If - Conditions
        • Unit type of (Triggering unit equal to value)
      • Then - Actions
        • Unit - Create 1 (Unit type of (Triggering Unit)) at (Position of (TheBuildingThatTrainedIt)) facing (whatever) degrees or whatever
        • Unit - Set life of (Last created unit) to (Life of (Triggering Unit))
        • Unit - Remove (Triggering Unit) from the game
      • Else - Actions
Thus shall repeat itself with different Unit-types and building locations. Hope you understand :)

hmm, i might have understood that a bit. If i don't get it after.... 2 hours i post here for help once more^^


but about unit dying, since this is a map where you fight with armies and shit, a exact type of unit might die same time? Wont that mess it up?
 
Level 7
Joined
Jul 20, 2008
Messages
377
Does it matter if the units teleport back to the exact structure that made them or just a general area where these structures are? If the latter, just add all these units you produce to an unit group (one unit group per player, I suggest using an array here), and when the timer is up, teleport them back to the correlating player's house area.

EDIT: Checking if they are alive, of course.
 
Level 6
Joined
May 31, 2008
Messages
218
Does it matter if the units teleport back to the exact structure that made them or just a general area where these structures are? If the latter, just add all these units you produce to an unit group (one unit group per player, I suggest using an array here), and when the timer is up, teleport them back to the correlating player's house area.

Well, you will have different bases all over the map so they need to come to the right place. If i can i will also make it so you can make more bases around the map.
 
Level 7
Joined
Jul 20, 2008
Messages
377
Okay, that does make things a little more complicated, but only an itty bit. You could use a custom value system where you assign an unique custom value to each unit counting from 0. You would have a large unit array (named "home" for this example), and when you build an unit, assign an unique custom value to that unit (it might also help to cycle the custom value counter back to 0 if you go too big), then in home[custom value of unit] assign that structure that made it.

Now, when it's time to move everything back, just teleport it to the position of home[custom value of unit]. You'll still need them in an unit group for easy looping.
 
Level 6
Joined
May 31, 2008
Messages
218
Okay, that does make things a little more complicated, but only an itty bit. You could use a custom value system where you assign an unique custom value to each unit counting from 0. You would have a large unit array (named "home" for this example), and when you build an unit, assign an unique custom value to that unit (it might also help to cycle the custom value counter back to 0 if you go too big), then in home[custom value of unit] assign that structure that made it.

Now, when it's time to move everything back, just teleport it to the position of home[custom value of unit]. You'll still need them in an unit group for easy looping.

like i mentioned in a post further up, i just know triggers(without using any nifty values)so i will have a really hard time to accomplish this without any more guidlines : (

I tried to do almost a smae thing from what another person said, but i didn't get a shit.

But can't i do something like you make a area for each house, then when they are trained they are teleported to that area, and back to the house when 2 minutes are out. I was thinking of making the buildable houses a bit different, instead of buying what units will spawn each 2 minutes, you just choose one specific unit type that will spawn each 2 min. Guess that will make things easier.
 
Status
Not open for further replies.
Top