• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!

Unit-type per map

Status
Not open for further replies.
Level 5
Joined
May 15, 2008
Messages
105
I need a trigger that limits non-hero unit of specified type to 8 per map at once. The problem is:
EVENT_PLAYER_UNIT_TRAIN_CANCEL occurs when train order is removed from the queue
EVENT_PLAYER_UNIT_TRAIN_START occurs when unit is starting to be trained (so it is 1st in the queue)

That means every cancel from 2nd and further places in queue makes my current system useless.

I would strongly appreciate your help.
 

Chaosy

Tutorial Reviewer
Level 40
Joined
Jun 9, 2011
Messages
13,183
this would do
  • Untitled Trigger 001
    • Events
      • Unit - A unit enters (Playable map area)
    • Conditions
    • Actions
      • Custom script: set udg_integer_varaible [ GetUnitTypeId(GetTriggerUnit())] = udg_integer_variable [ GetUnitTypeId(GetTriggerUnit())] + 1
      • Custom script: if udg_integer_variable [ GetUnitTypeId(GetTriggerUnit()) >= 8] then
      • Unit - Remove (Triggering unit) from the game
      • Custom script: endif
 
Level 5
Joined
May 15, 2008
Messages
105
Thanks for the will of help.

I need it for a specified unit-type, not all unit-types. I cannot just "remove" units, people wouldn't be happy to loose invested gold.

I think I have found another solution. If I am wrong, I'll be back and write more.
 
Status
Not open for further replies.
Top