- Joined
- Aug 9, 2015
- Messages
- 18
hi there!
I'm struggling a bit with having my buildings training multiple units at once. Well not really, that part wasn't hard. What is though, is figuring out, how I get the additional units to behave just like the original, in regards to rally points:
I'm assuming there is no way to make a newly created unit "copy" the exact orders given to the "trained unit" so I am a bit lost tbh. The only thing that I could think of would be using an if/then/else function to check for destructibles in range or something and then redirect their order to harvest... That sounds pretty complicated though, so yea; I hope someone has a more efficient idea.
Any help would be highly appreciated, especially since this is one of the last few unfilled checkboxes on my road to have a functioning framework for the kind of map I want to create.
€: Ugh, I'm such a doofus. Literally 1 minute after posting I realised that there is a function for targeting the rally point as a destructible. The only problem remaining, is figuring out how to distinguish between what order the unit has to receive when being created, as just switching the right click order with the harvest one, stops them from moving when the rally point is not a tree... ugh... I'll see if I can figure this out and will keep you updated
Sorry for being a doofus.
€2: Just to clarify: What I am currently lacking, is a way to detect if the trained unit is being sent to a destructible or not, via the rally point of the training structure. I've tried checking for current order of last trained unit but apparently, a unit coming out of training that immediately starts harvesting, uses the "smart" (right click) order string, same as if it just moves to a point.
€3,5: Aight, here to finished, cleaned up (as far as i can tell) version of the trigger for anyone interested
I'm struggling a bit with having my buildings training multiple units at once. Well not really, that part wasn't hard. What is though, is figuring out, how I get the additional units to behave just like the original, in regards to rally points:
-
Run Mult Train
-
Events
-
Unit - A unit Finishes training a unit
-
-
Conditions
-
((Trained unit) is Mechanical) Not equal to True
-
(Unit-type of (Trained unit)) Not equal to Sharpshooter
-
(Unit-type of (Trained unit)) Not equal to Berserker
-
(Unit-type of (Trained unit)) Not equal to Reaver
-
(Unit-type of (Trained unit)) Not equal to Ancestor Spirit
-
(Unit-type of (Trained unit)) Not equal to Druid
-
(Unit-type of (Trained unit)) Not equal to Runepriest
-
-
Actions
-
Set TrainingUnitType = (Unit-type of (Trained unit))
-
Set TrainingPlayer = (Owner of (Triggering unit))
-
Set Temp_Point_Train_Rally = (Rally-Point of (Triggering unit) as a point)
-
Set Temp_Point_Train = (Position of (Triggering unit))
-
Unit - Create 1 TrainingUnitType for TrainingPlayer at Temp_Point_Train facing Default building facing degrees
-
Unit - Order (Last created unit) to Right-Click Temp_Point_Train_Rally
-
Unit - Create 1 TrainingUnitType for TrainingPlayer at Temp_Point_Train facing Default building facing degrees
-
Unit - Order (Last created unit) to Right-Click Temp_Point_Train_Rally
-
Custom script: call RemoveLocation (udg_Temp_Point_Train)
-
Custom script: call RemoveLocation (udg_Temp_Point_Train_Rally)
-
-
I'm assuming there is no way to make a newly created unit "copy" the exact orders given to the "trained unit" so I am a bit lost tbh. The only thing that I could think of would be using an if/then/else function to check for destructibles in range or something and then redirect their order to harvest... That sounds pretty complicated though, so yea; I hope someone has a more efficient idea.
Any help would be highly appreciated, especially since this is one of the last few unfilled checkboxes on my road to have a functioning framework for the kind of map I want to create.
€: Ugh, I'm such a doofus. Literally 1 minute after posting I realised that there is a function for targeting the rally point as a destructible. The only problem remaining, is figuring out how to distinguish between what order the unit has to receive when being created, as just switching the right click order with the harvest one, stops them from moving when the rally point is not a tree... ugh... I'll see if I can figure this out and will keep you updated
€2: Just to clarify: What I am currently lacking, is a way to detect if the trained unit is being sent to a destructible or not, via the rally point of the training structure. I've tried checking for current order of last trained unit but apparently, a unit coming out of training that immediately starts harvesting, uses the "smart" (right click) order string, same as if it just moves to a point.
€3,5: Aight, here to finished, cleaned up (as far as i can tell) version of the trigger for anyone interested
-
Run Mult Train
-
Events
-
Unit - A unit Finishes training a unit
-
-
Conditions
-
Actions
-
Set TrainingUnit = (Triggering unit)
-
Set TrainedUnit = (Trained unit)
-
Set TrainingUnitType = (Unit-type of (Trained unit))
-
Set TrainingPlayer = (Owner of TrainingUnit)
-
Set Temp_Point_Train_Rally = (Rally-Point of TrainingUnit as a point)
-
Set Temp_Destruct_Rally = (Rally-Point of TrainingUnit as a destructible)
-
Set Temp_Point_Train = (Position of TrainedUnit)
-
Unit - Create 1 TrainingUnitType for TrainingPlayer at Temp_Point_Train facing Default building facing degrees
-
Unit Group - Add (Last created unit) to RallyUnitGroup
-
Unit - Create 1 TrainingUnitType for TrainingPlayer at Temp_Point_Train facing Default building facing degrees
-
Unit Group - Add (Last created unit) to RallyUnitGroup
-
Unit Group - Pick every unit in RallyUnitGroup and do (Actions)
-
Loop - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
Temp_Destruct_Rally Equal to No destructible
-
-
Then - Actions
-
Unit - Order (Picked unit) to Right-Click Temp_Point_Train_Rally
-
-
Else - Actions
-
Unit - Order (Picked unit) to Harvest Temp_Destruct_Rally
-
-
-
-
-
Custom script: call RemoveLocation (udg_Temp_Point_Train)
-
Custom script: call RemoveLocation (udg_Temp_Point_Train_Rally)
-
Unit Group - Remove all units of RallyUnitGroup from RallyUnitGroup
-
-
Last edited: