• 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.

Limit of heroes trained

Status
Not open for further replies.
Level 2
Joined
Nov 1, 2012
Messages
12
I have an altar-type building in my map that has four separate heroes, and once one is trained, the others should be untrainable (Their icons disappear from the altar). So how do I do this? Also, how do I make so that only one of that hero can be trained?

Also, if I have three separate altars for 3 different players, and each can train the same heroes, how do I make it so that each hero can only be selected by one player? So that once a hero is picked by one player, that hero disappears from the other two players altars. (With the first player only being able to train one of that hero, like above)

Thanks.
 

Kusanagi Kuro

Hosted Project: SC
Level 10
Joined
Mar 11, 2012
Messages
708
First, to limit the amount of hero can be trained by 1 player, do this:
  • Limit Hero Train
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Player Group - Pick every player in (All Players) and do (Actions)
        • Loop - Actions
          • Player - Limit training of Paladin to 1 for (Picked player)
          • ------For every type of hero, u need to create 1 line of the above action-----
To make the other Player cannot buy that unit, do this:
  • Untitled Trigger 001
    • Events
      • Unit - A unit Sells a unit
    • Conditions
      • ((Sold unit) is A Hero) Equal to True
    • Actions
      • Set PlayerForce = (All players matching ((Owner of (Sold unit)) Not equal to (Matching player)))
      • Player Group - Pick every player in PlayerForce and do (Actions)
        • Loop - Actions
          • Player - Make (Unit-type of (Sold unit)) Unavailable for training/construction by (Picked player)
      • Custom script: call DestroyForce(udg_PlayerForce)
 
Last edited:
Level 12
Joined
Sep 11, 2011
Messages
1,176
First, to limit the amount of hero can be trained by 1 player, do this:
  • Limit Hero Train
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set PlayerForce = (All players)
      • Player Group - Pick every player in PlayerForce and do (Actions)
        • Loop - Actions
          • Player - Limit training of Paladin to 1 for (Picked player)
          • ------For every type of hero, u need to create 1 line of the above action-----
      • Custom script: call DestroyForce(udg_PlayerGroup)

don't ever set all players to variable and destroy it, because later you won't be able to use it anymore. trust me.

just do it like this

  • Player Group - Pick every player in (all players) and do (Actions)
    • Loop - Actions
      • //do your actions//
all players don't leak.

To make the other Player cannot buy that unit, do this:
  • Untitled Trigger 001
    • Events
      • Unit - A unit Sells a unit
    • Conditions
      • ((Sold unit) is A Hero) Equal to True
    • Actions
      • Set PlayerForce = (All players matching ((Owner of (Sold unit)) Not equal to (Matching player)))
      • Player Group - Pick every player in PlayerForce and do (Actions)
        • Loop - Actions
          • Player - Make (Unit-type of (Sold unit)) Unavailable for training/construction by (Picked player)
      • Custom script: call DestroyForce(udg_PlayerGroup)

you're destroying a wrong player group variable. it should be

  • Custom script : call DestroyForce(udg_PlayerForce)
 
Status
Not open for further replies.
Top