Staredit Network > Forums > SC2 Assistance > Topic: Create Unit Every Sec only if Factory present
Create Unit Every Sec only if Factory present
Dec 24 2010, 6:30 am
By: jkavorski  

Dec 24 2010, 6:30 am jkavorski Post #1



I'm not familiar with SC2's map editor (I was pretty good with BW's), as I can't even figure out how to do many of the simplest tasks.

For instance, I want the trigger to create a tank every second, only if there is a factory present. I know how to make units periodically, but I don't know how to make it so that the factory has to be present. I think it should be an event, but I can't find an event that is to the effect of "player owns unit". Any help?

I appreciate it.



None.

Dec 24 2010, 6:39 am DevliN Post #2

OVERWATCH STATUS GO

You can do that in the Data Editor, which might be easier. Basically you could set up the Factory so that it creates a Tank every second. Or did you need the Tank created at a different location entirely?



\:devlin\: Currently Working On: \:devlin\:
My Overwatch addiction.

Dec 24 2010, 4:09 pm jkavorski Post #3



No, that should be a good solution. Now hopefully I can figure out the data editor...

EDIT: Nope. I miss BW :(



None.

Dec 24 2010, 5:17 pm jkavorski Post #4



Quote from jkavorski
No, that should be a good solution. Now hopefully I can figure out the data editor...

EDIT: Nope. I miss BW :(

Would anyone be able to tell me how to make a factory autotrain a tank every second?



None.

Dec 25 2010, 1:12 am doite Post #5



sigh... im so happy ppl atleast wait til going over to sc2mapster before asking these questions.
Ok so basicly i would like to say that u have to sstart WAAAAY more at the begining since this is a level 2 trigger (meaning it includes variables). It is better to do all things though data editor ( or atleast cleaner) but more LOGIC to do it in a trigger. And since its easier to understand i will explain triggerwise. before we start i would like you to not only do, but to try and understand.

Basicly, if i understand correctly u want to spawn a unit every sec IF (a condition) you have a factory (or a structure of some sort)

Since i dont have time with a fuckin guide ill just print out what i would do in 3 easy tiggers. First one (Player makes a factory) Second one (Spawn units) third (Factory dies)

Now first u need 2 varaibles:

Step 1: variables
First one- Call it.. FactoryExcist - (make it global (meaning your NOT making inside the trigger, but in the left spalt (where all your triggers and varaibles are)) should be a boolean type. Its auto made to false (which is ok). Under the type (as u just set to boolean) there is something called "array". check the box and set the array = numbers of players (if 2 players, then set it to 2).
This trigger is very usefull. It can be set as false and true and used in triggers to open let a specific player pass a condition, while another doesnt. (false, true.. very logic)
The SECOND - call it Factory unit - trigger should be a global one aswell (opposite would be if u made it WITHIN the trigger making it local - but dont do this). Make this global trigger a unit type of variable and set the array to number of players.
This trigger can store a specific unit (structures are counted as units, and be used to pin out what unit we refear to when telling the map where to.. for example spawn certain units).

Step 2: Building a factory

Events
Unit - Any Unit construction progress is Completed
Local Variables
Conditions
(Unit type of (Triggering unit)) == Factory
Actions
Variable - Set FactoryUnit[(Owner of (Triggering unit))] = (Triggering unit)
Variable - Set FactoryExcist[(Owner of (Triggering unit))] = true

Step 3: Spawning units (this trigger has to be under the first one in the list to the left)

Events
Unit - Any Unit construction progress is Completed
Local Variables
Conditions
(Unit type of (Triggering unit)) == Factory
Actions
General - Wait 2.0 Game Time seconds
General - While (Conditions) are true, do (Actions)
Conditions
FactoryExcist[(Owner of (Triggering unit))] == true
FactoryUnit[(Owner of (Triggering unit))] != No Unit
Actions
General - Wait 1.0 Game Time seconds
Unit - Create 1 Siege Tank (Tank Mode) for player (Owner of (Triggering unit)) at (Position of FactoryUnit[(Owner of (Triggering unit))]) facing 270.0 degrees (No Options)

Step 4: Factory dies..
Unit dies
Events
Unit - Any Unit dies
Local Variables
Conditions
(Unit type of (Triggering unit)) == Factory
Actions
Variable - Set FactoryExcist[(Owner of (Triggering unit))] = false
Variable - Set FactoryUnit[(Owner of (Triggering unit))] = No Unit

--------------------------------------------------------------------------------------
There.. Havent tried it but should work.. Now If the dude need help how to do the action and functions, please just help him..
As i said: This is a trigger way to do it, and often more simple to understand then data editor. But for next time, try reading guides..



None.

Dec 25 2010, 1:42 am Ahli Post #6

I do stuff and thingies... Try widening and reducing the number of small nooks and crannies to correct the problem.

@post above this
-You do things in the trigger editor because you can easier control/tweak them; but triggers cause more traffic than data editor's aspects I think (only noticeable, if you have bigger amounts of data changes)
-Your triggers will create a thread for every unit (which is a bad idea because the system is totally unefficient and you will hit the thread limit). Having one trigger that periodically creates the units would be the best trigger solution.
-You trigger can only support 1 factory because you store the units in 1 entry (you will overwrite factories before -> use dynamic storage system).
-You can do that in 1 trigger without any global variables in your design (without the thinking mistake described 1 lime above this line).

@topic
If I would trigger that, I would use 1 unit group for the factorys.
-1 trigger like his first one to add the building to it, if the constructed building is a factory.
-1 trigger that deletes dieing factorys out of the unit group
-1 trigger that periodically creates the spawned unit for every unit in the unit group at its position and its owner.




Options
  Back to forum
Please log in to reply to this topic or to report it.
Members in this topic: None.
[10:09 pm]
Ultraviolet -- let's fucking go on a madmen rage bruh
[10:01 pm]
Vrael -- Alright fucks its time for cake and violence
[2024-5-07. : 7:47 pm]
Ultraviolet -- Yeah, I suppose there's something to that
[2024-5-06. : 5:02 am]
Oh_Man -- whereas just "press X to get 50 health back" is pretty mindless
[2024-5-06. : 5:02 am]
Oh_Man -- because it adds anotherr level of player decision-making where u dont wanna walk too far away from the medic or u lose healing value
[2024-5-06. : 5:01 am]
Oh_Man -- initially I thought it was weird why is he still using the basic pre-EUD medic healing system, but it's actually genius
[2024-5-06. : 3:04 am]
Ultraviolet -- Vrael
Vrael shouted: I almost had a heart attack just thinking about calculating all the offsets it would take to do that kind of stuff
With the modern EUD editors, I don't think they're calculating nearly as many offsets as you might imagine. Still some fancy ass work that I'm sure took a ton of effort
[2024-5-06. : 12:51 am]
Oh_Man -- definitely EUD
[2024-5-05. : 9:35 pm]
Vrael -- I almost had a heart attack just thinking about calculating all the offsets it would take to do that kind of stuff
[2024-5-05. : 9:35 pm]
Vrael -- that is insane
Please log in to shout.


Members Online: Uphdca06, Roy