• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[General] global unit limit

Status
Not open for further replies.
Level 7
Joined
Feb 14, 2008
Messages
289
I know you can limit the production of units to a single player.

But how would you limit the production of a unit across the entire game? I want a set of units to only be producible 1 time across the entire game. Also i want the person who produced it to not be able to produce anything else at all.

Ive tried it, but it fails when another player is also producing the same unit at the same time, and it fails when the player has multiple units queued when the player should only have 1 of them and not several.

basically u got unit a,b,c,d

i want it so that when a player builds unit a, he only gets 1 unit a, and cannot make b,c,d. also ALL players should not have access to unit a if he makes it.
 
Level 7
Joined
Feb 14, 2008
Messages
289
yes, but this failed when other players were already in the process of training the unit when the first was finished. Also it didnt keep the first player from putting 2-5 units in the queue when he should only have access to 1.
 
How many units does your structure train? Only this one?

Edit: If the structure trains only this specific unit, then use these triggers:
  • One
    • Events
      • Unit - A unit Is issued an order with no target
    • Conditions
      • (Issued order) Equal to (Order(footman))
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • DisableUnitType Equal to False
        • Then - Actions
          • Set DisableUnitType = True
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • DisableUnitType Equal to True
            • Then - Actions
              • Unit - Pause (Triggering unit)
              • Custom script: call IssueImmediateOrderById (GetTriggerUnit(), 0xD0008)
              • Unit - Order (Triggering unit) to Stop
              • Unit - Unpause (Triggering unit)
            • Else - Actions
  • Two
    • Events
      • Unit - A unit Finishes training a unit
      • Unit - A unit Cancels training a unit
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to YourStructure
    • Actions
      • Custom script: if GetTriggerEventId() == EVENT_PLAYER_UNIT_TRAIN_CANCEL then
      • Set DisableUnitType = False
      • Custom script: else
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Trained unit)) Equal to Footman
        • Then - Actions
          • Player Group - Pick every player in (All players) and do (Actions)
            • Loop - Actions
              • Player - Make (Unit-type of (Trained unit)) Unavailable for training/construction by (Picked player)
        • Else - Actions
      • Custom script: endif
 
Last edited:
Level 7
Joined
Feb 14, 2008
Messages
289
the building is capable of making 5 generals.

But i only want 1 general to be trained by the player, and for that 1 general to only be available 1 time on the map at all times.

does that answer your question? im sorry if i am not being clear
 
Status
Not open for further replies.
Top