Force cancel issue

Level 12
Joined
Dec 2, 2016
Messages
725
I'm trying to cancel the upgrade at the end there. But it selects the unit and doesn't seem to cancel the upgrade. What am I doing wrong here?

  • Untitled Trigger 004
    • Events
      • Unit - A unit Begins an upgrade
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Blood Tower
    • Actions
      • Unit Group - Pick every unit in (Units owned by (Owner of (Triggering unit))) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Or - Any (Conditions) are true
                • Conditions
                  • (Unit-type of (Picked unit)) Equal to Unholy Blood Tower
            • Then - Actions
              • Game - Display to (Player group((Owner of (Triggering unit)))) the text: You are only allowe...
              • Selection - Select (Triggering unit) for (Owner of (Triggering unit))
              • Game - Force (Owner of (Triggering unit)) to press Escape/Cancel
            • Else - Actions
 
Level 1
Joined
Jun 9, 2019
Messages
2
It looks like your trying to cancel the upgrade on "unholy blood towers", but its still a "blood tower" until the construction is complete. Just change the picked unit to "blood tower" instead of the upgrade. I think that will solve your issue
 
Level 22
Joined
Feb 27, 2007
Messages
3,784
Selecting a unit for a player doesn’t immediately change the UI for them so forcing the esc key fill fail if done immediately after. From my testing it seems to take anywhere from 1-5 frames before a key becomes forceable, and it’s not at all consistent every time.

The only way I’ve found to get around this is to delay the force key action by like 0.10 seconds with a timer. It’s a pain in the butt.

A better solution for your situation would be to give the upgrade another unit requirement for some uninteractable dummy unit. Create one of these units for all players at map init. When a player creates the upgraded tower simply remove that player’s unit. When the tower dies/is removed give them a new one.
 
Level 8
Joined
May 21, 2019
Messages
435
A better solution for your situation would be to give the upgrade another unit requirement for some uninteractable dummy unit. Create one of these units for all players at map init. When a player creates the upgraded tower simply remove that player’s unit. When the tower dies/is removed give them a new one.

This is a really clever solution. I've never really used the techtree options in the editor, can any unit be used or does it have to be a structure?
Also, what is the easiest way to make a dummy unit completely undetectable to the player owning it? Just using a hide trigger action and setting collision/food to 0, or are there other things that need to be cleared?
 
Level 22
Joined
Feb 27, 2007
Messages
3,784
I know abilities can be selectively disabled with a unit as a requirement; I imagine it does not have to be a structure in either case. The best way to hide the unit would be to remove food/points/sight radius/attacks/minimap display/model and give it locust. You could also pause and hide the unit which would take care of all of that except food and minimap.
 
Level 12
Joined
Dec 2, 2016
Messages
725
I know abilities can be selectively disabled with a unit as a requirement; I imagine it does not have to be a structure in either case. The best way to hide the unit would be to remove food/points/sight radius/attacks/minimap display/model and give it locust. You could also pause and hide the unit which would take care of all of that except food and minimap.
Thanks!
 
Top