• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Limiting unit Production?

Status
Not open for further replies.
Level 7
Joined
Jul 1, 2008
Messages
1,025
Hi, I ahve a problem, I'm trying to limit the maximum numbers of units available in game at one time of a specific unit type: EG Druid of the Claw, thats easy enough just use player: Limit training of unit type Druid of the Claw to 4.

BUT

This won't take into account when Druid is in bear form so the player can basicaly produce and unlimited amount by using bear form. I've been trying to design another trigger but this won't work either, heres what I got so far:

  • Druid of the Claw Limits
    • Events
      • Unit - A unit owned by Player 8 (Pink) Finishes training a unit
    • Conditions
      • (Unit-type of (Trained unit)) Druid of the Claw
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of living Druid of the Claw (Bear Form) units owned by Player 8 (Pink)) Greater than or equal to 3
          • (Number of living Druid of the Claw units owned by Player 8 (Pink)) Greater than or equal to 4
        • Then - Actions
          • Player - Make Druid of the Claw Unavailable for training/construction by Player 8 (Pink)
        • Else - Actions
          • Player - Make Druid of the Claw Available for training/construction by Player 8 (Pink)
Anyone know a better way of doing this?
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
Theres another action called limit training of unit.
This won't take into account when Druid is in bear form so the player can basicaly produce and unlimited amount by using bear form. I've been trying to design another trigger but this won't work either, heres what I got so far:



Thanks for your help I'll have a go using the variable, but won't the "if dying unit =" trigger lag? The maps going to have large battles so with this firing everytime it might create lag?
It shouldn't cause any lag, no (the if (triggering unit) type = druid or bear) must be in the Conditions-section, so the trigger never really activates unless it's a druid or a bear.
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
  • Untitled Trigger 042
    • Events
      • Unit - A unit Finishes training a unit
    • Conditions
      • (Unit-type of (Trained unit)) Equal to Druid of the Talon (Night Elf Form)
    • Actions
      • Set i = (Player number of (Triggering player))
      • Set int[i] = (int[i] + 1)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • int[i] Equal to 4
        • Then - Actions
          • Player - Make Druid of the Talon (Night Elf Form) Unavailable for training/construction by (Triggering player)
        • Else - Actions
  • Untitled Trigger 043
    • Events
      • Unit - A unit Dies
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Unit-type of (Triggering unit)) Equal to Druid of the Talon (Night Elf Form)
          • (Unit-type of (Triggering unit)) Equal to Druid of the Claw (Night Elf Form)
    • Actions
      • Set i = (Player number of (Triggering player))
      • Set int[i] = (int[i] - 1)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • int[i] Less than 4
        • Then - Actions
          • Player - Make Druid of the Talon (Night Elf Form) Available for training/construction by (Triggering player)
        • Else - Actions
 
Level 7
Joined
Jul 1, 2008
Messages
1,025
Ok well I tried your trigger Maker but for some reason it's not working, I set the Variable as an integer with Array as instructed but it makes me input an "Index" value, thats why theres a 0 after my variable, could this be the problem?
How do I make the variable without an Index?

  • Druid of the Claw Make Unavailable
    • Events
      • Unit - A unit Finishes training a unit
    • Conditions
      • (Unit-type of (Trained unit)) Equal to Druid of the claw
    • Actions
      • Set HScount[0] = (Player number of (Triggering player))
      • Set HScount[0] = (HScount[0] + 1)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • HScount[0] Equal to 4
        • Then - Actions
          • Player - Make Druid of the Claw Unavailable for training/construction by Player 8 (Pink)
        • Else - Actions

  • Druid of the claw Make available
    • Events
      • Unit - A unit Dies
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Unit-type of (Triggering unit)) Equal to Druid of the claw
          • (Unit-type of (Triggering unit)) Equal to Druid of the claw (Bear Form)
    • Actions
      • Set HScount[0] = (Player number of (Triggering player))
      • Set HScount[0] = (HScount[0] - 1)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • HScount[0] Less than 4
        • Then - Actions
          • Player - Make Druid of the claw Available for training/construction by Player 8 (Pink)
        • Else - Actions
 
Level 7
Joined
Jul 1, 2008
Messages
1,025
The "i" in Maker's trigger is another integer variable, which you must use as an index.
Or, instead of the "0" you got there, you could use "(Player number of (Triggering Player))" everywhere.

It's still not working :(
I set all the (0)s to "(Player number of (trigger player))". Should I be using two variables then? Atm im just using the one "HScount" should there be a seperate variable for used as an index? How do I set it as an index variable? Sorry if I'm asking stupid questions btw

  • Druid of the Claw Make Unavailable
    • Events
      • Unit - A unit Finishes training a unit
    • Conditions
      • (Unit-type of (Trained unit)) Equal to Druid of the Claw
    • Actions
      • Set HScount[(Player number of (Triggering player))] = (Player number of (Triggering player))
      • Set HScount[(Player number of (Triggering player))] = (HScount[(Player number of (Triggering player))] + 1)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • HScount[(Player number of (Triggering player))] Equal to 4
        • Then - Actions
          • Player - Druid of the Claw Unavailable for training/construction by Player 8 (Pink)
        • Else - Actions
 
Level 7
Joined
Jul 1, 2008
Messages
1,025
I'm sorry I sound like such a noob but its still not working :(

I can't even get it to limited unit production using the trigger you guys have given me, please tell me what im doing wrong:


  • Events
    • Unit - A unit Finishes training a unit
    • Conditions
      • (Unit-type of (Trained unit)) Equal to Druid
    • Actions
      • Set HScount[(Player number of (Triggering player))] = (HScount[(Player number of (Triggering player))] + 1)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • HScount[(Player number of (Triggering player))] Equal to 4
        • Then - Actions
          • Player - Make Druid Unavailable for training/construction by (Triggering player)
        • Else - Actions
 
Level 16
Joined
May 2, 2011
Messages
1,345
what do you think of this trigger guys?
  • druid of claw unavailable
    • Events
      • Unit - A unit Finishes training a unit
    • Conditions
      • (Unit-type of (Trained unit)) Equal to Druid of the Claw (Night Elf Form)
    • Actions
      • Set nb = (Number of units in (Units owned by (Owner of (Triggering unit)) matching (((Unit-type of (Picked unit)) Equal to Druid of the Claw (Night Elf Form)) or ((Unit-type of (Picked unit)) Equal to Druid of the Claw (Bear Form)))))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • nb Equal to 2
        • Then - Actions
          • Player - Make Druid of the Claw (Night Elf Form) Available for training/construction by (Owner of (Triggering unit))
        • Else - Actions
well I am not too sure of the (picked unit) thing ,maybe it works if we write pick every unit in map area matching ""picked unit =......""
the other trigger is
  • druid of claw available
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Unit-type of (Triggering unit)) Equal to Druid of the Claw (Bear Form)) or ((Unit-type of (Triggering unit)) Equal to Druid of the Claw (Night Elf Form))
    • Actions
      • Set nb = (Number of units in (Units owned by (Owner of (Triggering unit)) matching (((Unit-type of (Triggering unit)) Equal to Druid of the Claw (Night Elf Form)) or ((Unit-type of (Triggering unit)) Equal to Druid of the Claw (Bear Form)))))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in (Units in (Playable map area))) Equal to 2
        • Then - Actions
          • Player - Make Druid of the Claw (Night Elf Form) Available for training/construction by (Owner of (Triggering unit))
        • Else - Actions
 
Level 7
Joined
May 23, 2011
Messages
179
It shouldn't cause any lag, no (the if (triggering unit) type = druid or bear) must be in the Conditions-section, so the trigger never really activates unless it's a druid or a bear.
You are right Apocalypse..... But for me you can limit it using my "Inverse Jass LT" my system but it will be released this December..... its applicable to all kinds of Unit even items........
 
Status
Not open for further replies.
Top