Stopping Research

Status
Not open for further replies.
Level 4
Joined
Jun 12, 2009
Messages
57
I need help with this trigger. Whenever a unit picks up an item it increases their integer called vacuole_integer. Then this is displayed on their multiboard. I am basically creating a custom currency called vacuole( I am making a cell type game). Then they can research an ability if they have enough vacuoles they can research or evolve into a better unit. The problem is how do i stop a unit from researching if they don't have at least that integer amount? Here is my trigger so far. As for the displaying on the multiboard that is working.

  • Events
    • Unit - A unit owned by Player 1 (Red) Begins research
  • Conditions
    • (Researched tech-type) Equal to Upgrade (Night Elf)
  • Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • Vacuoleinterger[1] Less than 4
      • Then - Actions
        • //Here is where I want it to stop the upgrading
      • Else - Actions
        • Set Vacuoleinterger[1] = (Vacuoleinterger[1] - 4)
        • For each (Integer A) from 0 to Vacuoleinterger[1], do (Actions)
          • Loop - Actions
            • Multiboard - Set the text for (Last created multiboard) item in column 2, row 2 to (String((Integer A)))
 
Level 16
Joined
Jul 21, 2008
Messages
1,121
Just use this:

  • Actions
    • Wait 0.03 seconds
    • Game - Force (Owner of (Researching unit)) to press Escape/Cancel
    • Game - Force (Owner of (Researching unit)) to press Escape/Cancel
    • Game - Force (Owner of (Researching unit)) to press Escape/Cancel
    • Game - Force (Owner of (Researching unit)) to press Escape/Cancel
    • Game - Force (Owner of (Researching unit)) to press Escape/Cancel
    • Game - Force (Owner of (Researching unit)) to press Escape/Cancel
    • Game - Force (Owner of (Researching unit)) to press Escape/Cancel
Note that ''Force UI Cancel'' has to be added 7 times because of queue.

Player won't loose any gold/lumber.
 
Level 14
Joined
Mar 4, 2009
Messages
1,156
BTW guys i found a faster way
  • cancle training of unit
    • Events
      • Unit - A unit Begins training a unit
    • Conditions
      • (Your conditions...)
    • Actions
      • Set INTEGER = (Player number of (Owner of (Triggering unit)))
      • Unit - Change ownership of (Triggering unit) to Neutral Passive and Retain color
      • Unit - Change ownership of (Triggering unit) to (Player(INTEGER)) and Retain color
      • Selection - Add (Triggering unit) to selection for (Player(INTEGER))
EDIT : and player will not lose gold and lumber :D better than i tough so

i just tried with cancel but if i select another unit fast enough it will not force me to cancel
 
Status
Not open for further replies.
Top