发现塔正在进行关键升级,则编入单位组
[trigger]
Start
Events
Unit - A unit Begins an upgrade
Conditions
Or - Any (Conditions) are true
Conditions
(Unit-type of (Triggering unit)) Equal to Guard Tower
(Unit-type of (Triggering unit)) Equal to Cannon Tower
Actions
Unit Group - Add (Triggering unit) to UpgGroup[(Player number of (Triggering player))]
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Unit-type of (Triggering unit)) Equal to Guard Tower
Then - Actions
Player - Limit training of Cannon Tower to 0 for (Triggering player)
Else - Actions
Player - Limit training of Guard Tower to 0 for (Triggering player)
[/trigger]
撤销升级的话首先退出单位组,在看看里面是不是已经没单位了(也就是自己是最后一个退出的)
[trigger]
UCancel
Events
Unit - A unit Cancels an upgrade
Conditions
UpgLock[(Player number of (Triggering player))] Equal to False
((Triggering unit) is in UpgGroup[(Player number of (Triggering player))]) Equal to True
Actions
Unit Group - Remove (Triggering unit) from UpgGroup[(Player number of (Triggering player))]
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(UpgGroup[(Player number of (Triggering player))] is empty) Equal to True
Then - Actions
Player - Limit training of Guard Tower to -1 for (Triggering player)
Player - Limit training of Cannon Tower to -1 for (Triggering player)
Else - Actions
[/trigger]
建造完成的塔也需要退出,确保组中的单位全部是正在建造关键升级的单位
[trigger]
UFinish
Events
Unit - A unit Finishes an upgrade
Conditions
Or - Any (Conditions) are true
Conditions
(Unit-type of (Triggering unit)) Equal to Guard Tower
(Unit-type of (Triggering unit)) Equal to Cannon Tower
Actions
Set UpgLock[(Player number of (Triggering player))] = True
Unit Group - Remove (Triggering unit) from UpgGroup[(Player number of (Triggering player))]
[/trigger]