• Check out the results of the Techtree Contest #19!
  • 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.
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!

limiting

Status
Not open for further replies.
Level 4
Joined
Apr 25, 2008
Messages
60
I need trigger to prevent summoning a building 7th time. So that unit/player could only summon it 6 times.

This limit trigger don't work for me:
  • Events
    • Map initialization
  • Conditions
  • Actions
  • Player - Limit training of Footman to 6 for (Matching player)
+rep

Thanks,
MaskGT
 
One way would be to use a variable to track the number of times a player summons a unit:
  • Events:
  • A unit finishes being trained
  • Conditions:
  • Unit-Type of Trained Unit = footman
  • Actions:
  • Set FootmenTrained[(Player number of (owner of (trained unit)) = (FootmenTrained[(Player number of (owner of (trained unit)) +1)
  • If, Then, Else (Multiple funtions):
  • IF:
  • FootmenTrained is equal to 6
  • THEN:
  • Disable (Unit-Type, footmen) from being trained by (owner of trained unit)
  • ELSE:
I don't have the exact trigger names or anything, but something like that should work.

I used an array variable to distinguish between players just so you wouldn't have to replicate the trigger or variables
 
Oh... Yes if that's what he wants, he could do that no problem, just do:

  • Events:
  • A Unit dies
  • conditions:
  • Unit-Type is equal to footman
  • Actions:
  • Set FootmenTrained[(Player number of (owner of (dying unit))] = (FootmenTrained[(Player number of 9owner of (dying unit))] -1)
  • Enable training of footmen for (owner of (dying unit))
EDIT:

There is an option under players to disable training of units... I forget what it's called.
 
  • Events
    • Time - Every 1.00 seconds of game time
  • Conditions
  • Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Number of living Footman) units owned by Player 1 (Red)) Greater than or equal to 6
      • Then - Actions
      • Else - Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Number of living Footman units owned by Player 1 (Red)) Not equal to 6
      • Then - Actions
      • Else - Actions
So what exatly actions is called?
Maybe you mean this? But this don't work.
  • Player - Limit training of Footman to 6 for Player 1 (Red)
 
- make the footman require a dummy unit
- call the dummy unit "fewer than 6 footmen" or something
- use triggers to change the owner of that unit to and from the player who is making the footman

ie. player has 6 footman then change owner of dummy unit to neutral passive, player has less than 6 footman then change owner of dummy unit back to that player.
you'll have to make one dummy for each player and store them in an array for easy access.
 
Uhg... If only i had world editor in front of me... there is an oddly named trigger that disables training of units for players, under the players heading.
 
sorry dude, I'm at work.

visionary has a good way of doing it.

variables:
* an array of integers - call it footmen_count

increment the count when a footman is trained
decrement the count when a footman dies

index the variable based on the player number
 
  • Events
    • Map initialization
  • Actions
    • Player - Limit training of BUILDING to 6 for Player 1 (Red)
    • Player - Limit training of BUILDING2 to 6 for Player 1 (Red)
Well I tried this and it worked, maybe I have to create new trigger for each player? Because if I try to put everything in one trigger it don't works.

Anyway, +rep for your help.
 
Status
Not open for further replies.
Back
Top