HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

I need either to queue orders better or a new method

01-14-2007, 04:19 PM#1
NmdSnprEnigma
So a TD... yeah, I know, but bear with me. The towers can all get individual speed damage range and splash upgrades which affect which towers that tower can upgrade to. Each tower at the next tier has a different combination of speed damage splash and range that it can research. Also, when a tower upgrades to a new one at the next tier, it retains whatever speed, damage range splash bonuses it had. This means the strength of the next tier is relative to the power of the current tier, so setting a constant unit cost for the upgrade won't work numbers-wise. I catch the order from a multiply leveled Charge Gold and Lumber (TowerAbilUsed[x]) and then actually build the towers using these:

Trigger:
Ghost Building Copy
Collapse Events
Unit - A unit Starts the effect of an ability
Conditions
Collapse Actions
Collapse For each (Integer A) from 1 to 16, do (Actions)
Collapse Loop - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Ability being cast) Equal to TowerAbilUsed[(Integer A)]
Collapse Then - Actions
Unit - Hide (Triggering unit)
Unit - Create 1 Circle of Power for (Owner of (Casting unit)) at (Position of (Casting unit)) facing Default building facing (270.0) degrees
Unit Group - Add (Triggering unit) to HiddenUnits
Collapse For each (Integer B) from 0 to 100, do (Actions)
Collapse Loop - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
OrderLoc[(Integer B)] Equal to OrderLoc[((Integer B) + 1)]
Collapse Then - Actions
Set OrderLoc[(Integer B)] = (Casting unit)
Set OrderCode[(Integer B)] = TowerToBuild[(Integer A)]
Custom script: exitwhen 1 == 1
Else - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(RunQueue <gen> is on) Equal to False
Collapse Then - Actions
Trigger - Run RunQueue <gen> (ignoring conditions)
Trigger - Turn on RunQueue <gen>
Else - Actions
Custom script: exitwhen 1 == 1
Else - Actions
Trigger:
RunQueue
Events
Conditions
Collapse Actions
Unit - Remove (Find the first unit next to (Position of OrderLoc[0]) that matches ((Unit-type of (Matching unit)) Equal to Circle of Power)) from the game
Unit - Order The Upgrade Fairy 0000 <gen> to (Order(OrderCode[0])) (Position of OrderLoc[0])
Wait until ((Order(OrderCode[0])) Not equal to (Current order of The Upgrade Fairy 0000 <gen>)), checking every 0.10 seconds
Collapse For each (Integer B) from 0 to 36, do (Actions)
Collapse Loop - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
OrderLoc[(Integer B)] Not equal to OrderLoc[((Integer B) + 1)]
Collapse Then - Actions
Set OrderCode[(Integer B)] = OrderCode[((Integer B) + 1)]
Set OrderLoc[(Integer B)] = OrderLoc[((Integer B) + 1)]
Collapse Else - Actions
Custom script: exitwhen 1 == 1
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
OrderLoc[0] Not equal to No unit
Collapse Then - Actions
Trigger - Run (This trigger) (ignoring conditions)
Collapse Else - Actions
Trigger - Turn off (This trigger)
Unit - Order The Upgrade Fairy 0000 <gen> to Move To ((Center of (Playable map area)) offset by (CirclePosX, CirclePosY))

This works as long as you don't issue multiple upgrade commands simulataneously, as in, select multiple units and click the upgrade button once. If you do them serially it's fine. So I either need to find a way to properly queue those simulataneous commands OR find a new way to charge varying amounts of money for the same upgrade. Lemme know if I wasn't clear enough. Thanks.