Limit unit depending on building

gbubic2

Active Member
Reaction score
0
Is it posible to make trigger like this, and how?:

To limit 4 footman unit on one barracks
8 footman on 2 barracks
and so on... :banghead: :nuts:

Thanks
 

waaaks!

Zinctified
Reaction score
255
i didnt remember all the events and actions, and i dont have WE, so ill give u an idea

E: time every 0.01 second of game time
C:
A:set group1 = unit group pick every footman in playable map area owned by player 1
set group2 = unit group pick every barracks in playable map area owned by player 1
if number of units in group1 equal to 4 * number of units in group2 then Player - disable training of footman for player 1

also u need to enable the training of the footman by a trigger that checks if a barracks is created
 
M

Mr.Banankaka

Guest
Why use the event every 00.1 seconds... That is 100 times per second! I would do like this:

E: A unit is constructed
C: Unit-type of constructed unit equal to barracks
A Set var_barracks equal to 4

E: A unit is created
C: Unit-type of created unit equal to footman
A: Set var_footman equal to var_footman+1
A: If, then, else
C: If var_footman equal to var_barracks
A: Player - Make Footman Unavailable for training/construction by (Owner of (Trained unit))
A: Do nothing
 

AceHart

Your Friendly Neighborhood Admin
Reaction score
1,495
> every 0.01 second

???


Code:
Events
    Unit - A unit Finishes construction
Conditions
    (Unit-type of (Triggering unit)) Equal to Barracks
Actions
    Set TempInteger = (Player number of (Owner of (Triggering unit)))
    Set Footman[TempInteger] = (Footman[TempInteger] + 4)
    Player - Limit training of Footman to Footman[TempInteger] for (Owner of (Triggering unit))
Code:
Events
    Unit - A unit Dies
Conditions
    (Unit-type of (Triggering unit)) Equal to Barracks
Actions
    Set TempInteger = (Player number of (Owner of (Triggering unit)))
    Set Footman[TempInteger] = (Footman[TempInteger] - 4)
    Player - Limit training of Footman to Footman[TempInteger] for (Owner of (Triggering unit))

Required variables:
Footman, of type integer, array, size 12
TempInteger, of type integer
 

gbubic2

Active Member
Reaction score
0
I can figure out this set group 1 and 2. I can find same thing what you told me. Can you tell me what is original acton funcin for that?

Thanks
 
M

Mr.Banankaka

Guest
Made some mistakes before. I´ve fixed them now and here they are:

Code:
Untitled Trigger 002
    Events
        Unit - A unit Finishes construction
    Conditions
        (Unit-type of (Constructed structure)) Equal to Barracks
    Actions
        Set Var_Barracks[(Player number of (Owner of (Constructed structure)))] = (Var_Barracks[(Player number of (Owner of (Trained unit)))] + 4)

Code:
Untitled Trigger 001
    Events
        Unit - A unit Finishes training a unit
    Conditions
        (Unit-type of (Trained unit)) Equal to Footman
    Actions
        Player - Make Footman Unavailable for training/construction by (Owner of (Trained unit))
        Set Var_Footman[(Player number of (Owner of (Trained unit)))] = (Var_Footman[(Player number of (Owner of (Trained unit)))] + 1)
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                Var_Footman[(Player number of (Owner of (Trained unit)))] Equal to Var_Barracks[(Player number of (Owner of (Trained unit)))]
            Then - Actions
                Player - Make Footman Unavailable for training/construction by (Owner of (Trained unit))
            Else - Actions
                Do nothing

:p
 

gbubic2

Active Member
Reaction score
0
Can you please tell me how to mak var_barracks and var_footman i dont get this things.
This variable is killing me
Thanks
 

Seannny

Why GUI when you can Jass?
Reaction score
46
in the trigger editor theres a big gold X at the top.

This is variables, click that and then select New Variable. Type in the name, and scroll down the list to integer variables... thats what you want. if you want help with variables. feel free to pm me and ill give you the behind the scenes
 
General chit-chat
Help Users

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top