- Joined
- Jul 22, 2015
- Messages
- 3,485
Hello again everybody! I know I just recenty made a post for some insight on a trigger I made, but the information I learned from that post was so useful, I couldn't help but ask for more insight on a system that is currently WiP.
Here is how the system works:
The system makes lumber income work like an Entangled Gold Mine. A unit is loaded into the "lumber mill", and the player recieves lumber from the resources that unit collected in intervals. Below you can see all the triggers that are currently running the system.
To make this sytem work, I had to make it so that whenever a unit enters the lumber mill, it creates a dummy tree within a set region of the lumber mill (this makes it so that the lumber it retrieved from the tree appears as text over the lumber mill), then it creates a dummy harvester (uses the Wisp Harvest ability) on the location of the recently created tree, and then orders the dummy harvest to harvest that tree. However, I am stuck on trying to figure out how to make it so that if a unit were to leave the lumber mill, the tree and unit are removed. So far with what I have, it only works for 1 peasant, and every peasant after that leaves, the dummies are not removed. I have spent already 2 days trying out different functions, but now I'm just pooped. Any help is appreciated, and if you need any more questions/concerns about this system, feel free to ask!
Here is how the system works:
The system makes lumber income work like an Entangled Gold Mine. A unit is loaded into the "lumber mill", and the player recieves lumber from the resources that unit collected in intervals. Below you can see all the triggers that are currently running the system.
-
Harvest Lumber Core
-
Events
-
Unit - A unit Is loaded into a transport
-
-
Conditions
-
(Unit-type of (Triggering unit)) Equal to Worker
-
(Unit-type of (Transporting unit)) Equal to Lumber Mill
-
-
Actions
-
Set HarvestLumber_Index = (HarvestLumber_Index + 1)
-
Set HarvestLumber_Unit[HarvestLumber_Index] = (Triggering unit)
-
Set HarvestLumber_Location[HarvestLumber_Index] = (Position of (Transporting unit))
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
HarvestLumber_Index Equal to 1
-
-
Then - Actions
-
Trigger - Turn on Harvest Lumber Loop <gen>
-
-
Else - Actions
-
-
-
-
Harvest Lumber Loop
-
Events
-
Time - Every 0.03 seconds of game time
-
-
Conditions
-
Actions
-
For each (Integer HarvestLumber_LoopInteger) from 1 to HarvestLumber_Index, do (Actions)
-
Loop - Actions
-
Unit Group - Add HarvestLumber_Unit[HarvestLumber_LoopInteger] to HarvestLumber_Group[HarvestLumber_LoopInteger]
-
Destructible - Create a Harvest Lumber Dummy Tree at (Random point in (Region centered at HarvestLumber_Location[HarvestLumber_LoopInteger] with size (900.00, 900.00))) facing (Random angle) with scale 1.00 and variation 0
-
Unit - Create 1 Harvest Lumber Dummy for (Owner of HarvestLumber_Unit[HarvestLumber_LoopInteger]) at (Position of (Last created destructible)) facing Default building facing degrees
-
Unit - Order (Last created unit) to Harvest (Last created destructible)
-
Unit Group - Add (Last created unit) to HarvestLumberl_DummyGroup[HarvestLumber_LoopInteger]
-
Trigger - Add to Harvest Lumber Check <gen> the event (Unit - A unit Is issued an order with no target)
-
Set HarvestLumber_DummyUnit[HarvestLumber_LoopInteger] = (Random unit from HarvestLumberl_DummyGroup[HarvestLumber_LoopInteger])
-
Set HarvestLumber_Unit[HarvestLumber_LoopInteger] = HarvestLumber_Unit[HarvestLumber_Index]
-
Set HarvestLumber_Location[HarvestLumber_LoopInteger] = HarvestLumber_Location[HarvestLumber_Index]
-
Set HarvestLumber_Index = (HarvestLumber_Index - 1)
-
Set HarvestLumber_LoopInteger = (HarvestLumber_LoopInteger - 1)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
HarvestLumber_Index Equal to 0
-
-
Then - Actions
-
Trigger - Turn off (This trigger)
-
-
Else - Actions
-
-
-
-
-
-
Harvest Lumber Check
-
Events
-
Conditions
-
(Issued order) Equal to (Order(stop))
-
-
Actions
-
Unit Group - Remove HarvestLumber_Unit[HarvestLumber_LoopInteger] from HarvestLumber_Group[HarvestLumber_LoopInteger]
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Number of units in HarvestLumber_Group[HarvestLumber_LoopInteger]) Less than (Number of units in HarvestLumberl_DummyGroup[HarvestLumber_LoopInteger])
-
-
Then - Actions
-
Destructible - Pick every destructible within 32.00 of (Position of HarvestLumber_DummyUnit[HarvestLumber_LoopInteger]) and do (Actions)
-
Loop - Actions
-
Destructible - Kill (Picked destructible)
-
Unit - Add a 0.01 second Generic expiration timer to HarvestLumber_DummyUnit[HarvestLumber_LoopInteger]
-
Unit Group - Remove HarvestLumber_DummyUnit[HarvestLumber_LoopInteger] from HarvestLumberl_DummyGroup[HarvestLumber_LoopInteger]
-
-
-
-
Else - Actions
-
-
-
Last edited: