Limit Numbers of Heroes

Raizn

New Member
Reaction score
2
Hi Helpers,

i want to limit the number of heroes each player can buy to 1. but for any kind of reason im to stupid to get this trigger work. the unit will not be added to the unit group.

Trigger:
  • RemovePickedHero
    • Events
      • Unit - A unit Sells a unit
    • Conditions
      • ((Sold unit) is A Hero) Equal to True
    • Actions
      • Game - Display to (All players) the text: (String((Number of units in HeroGroup[(Player number of (Triggering player))])))
      • Unit Group - Add (Sold unit) to HeroGroup[(Player number of (Triggering player))]
      • Player Group - Pick every player in (All players) and do (Actions)
        • Loop - Actions
          • Player - Make (Unit-type of (Sold unit)) Unavailable for training/construction by (Picked player)


Trigger:
  • Remove
    • Events
      • Unit - A unit enters (Playable map area)
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in HeroGroup[(Player number of (Owner of (Entering unit)))]) Greater than 1
        • Then - Actions
          • Unit - Remove (Entering unit) from the game
        • Else - Actions


bye
raizn
 

millz-

New Member
Reaction score
25
If you want to count a number of units, why don't you just use integer? Set a certain integer to the integer + 1 when the player buys a unit, instead of adding the bought unit to a unit group and then later count how many units are there in the unit group.
 

AsylumEscape

New Member
Reaction score
0
do this...

Trigger:
  • Untitled Trigger 001
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Player Group - Pick every player in (All players) and do (Actions)
        • Loop - Actions
          • Player - Limit training of Heroes to 1 for (Picked player)
 

Raizn

New Member
Reaction score
2
@Asylum will affect this sold units from taverns as well ?

if not the other solution from millz is working fine.

bye
raizn
 

bLu3_eYeS

New Member
Reaction score
31
If your map does not require wood ( if you make AoS[no need for any wood] ) give each player 1 lumber and set the hero to cost 1 lumber.
Its easyest solution [ without triggering ]
:thup:
 

Raizn

New Member
Reaction score
2
ye in my own map i used shades to pick units/heroes. but my friends map is a mix of melee and Hero Custom Map. So the wood solution will not work for this case^^

but anyway thanks

bye
raizn
 

HydraRancher

Truth begins in lies
Reaction score
197
There is no (Triggering Player) use (Owner of (Sold Unit)) for [(Player number of (Triggering player))]
 

Sui-cookie

You can change this now in User CP.
Reaction score
49
just use an integer or boolean variable that checks when they get a hero. :/

Trigger:
  • Untitled Trigger 003
    • Events
      • Unit - A unit Sells a unit
    • Conditions
      • ((Sold unit) is A Hero) Equal to (==) True
    • Actions
      • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Has_Hero[(Player number of (Owner of (Buying unit)))] Equal to (==) False
        • Then - Actions
          • Set Has_Hero[(Player number of (Owner of (Buying unit)))] = True
        • Else - Actions
      • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Has_Hero[(Player number of (Owner of (Buying unit)))] Equal to (==) True
        • Then - Actions
          • Unit - Explode (Sold unit)
          • Game - Display to (Player group((Owner of (Buying unit)))) the text: BITCH, I SEE THAT Other hero you're cheating on!
        • Else - Actions


seems like it would work as far as i've read. Though, too lazy to fix the force leak in an example trigger :/
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top