Trigger Issue with training unit

Status
Not open for further replies.
Level 7
Joined
Feb 23, 2020
Messages
253
Hello, how do i make this trigger work? I'm just having an ordinary altar, so when someone starts training that unit-type, it should dissapear.

  • Hero Pick
    • Events
      • Unit - A unit Begins training a unit
    • Conditions
    • Actions
      • Player Group - Pick every player in (All players) and do (Actions)
        • Loop - Actions
          • Player - Make (Unit-type of (Trained unit)) Unavailable for training/construction by (Picked player)
 
Level 7
Joined
Feb 23, 2020
Messages
253
  • Player - Limit training of Mountain King to 1 for (Picked player)
Put it in a map initialization trigger.
Hm, i have around 30 heroes, i should do that with each one then?

Edit: No one should be able to pick the same Hero, so if someone picks XXX, then no one else should be able to pick him.
 
Level 2
Joined
Feb 16, 2020
Messages
9
If the goal is to stop people from picking the Hero after it's already been picked once then the trigger you posted should work, just change 'begins training' to 'finishes training'
 
Level 7
Joined
Feb 23, 2020
Messages
253
If the goal is to stop people from picking the Hero after it's already been picked once then the trigger you posted should work, just change 'begins training' to 'finishes training'
Yeah what you just said works perfectly fine. But if 2 people start the training at the same time, both will get it, which is not what i want.
 
Last edited:
Level 2
Joined
Feb 16, 2020
Messages
9
This will pick every altar on the map (modify it to your unit type) and cancel the unit currently being trained. If you want it to only cancel the unit type your after, you could use A unit begins training events to constantly update the unit type in a hashtable, as I don't think theres a way to detect this using conditions normally

  • Untitled Trigger 002
    • Events
      • Unit - A unit Finishes training a unit
    • Conditions
    • Actions
      • Set VariableSet TempGroup = (Units of type Altar of Kings)
      • Unit Group - Pick every unit in TempGroup and do (Actions)
        • Loop - Actions
          • Custom script: call IssueImmediateOrderById (GetEnumUnit(), 851976)
      • Custom script: call DestroyGroup(udg_TempGroup)
 
Last edited:
Level 7
Joined
Feb 23, 2020
Messages
253
This will pick every altar on the map (modify it to your unit type) and cancel the unit currently being trained. If you want it to only cancel the unit type your after, you could use A unit begins training events to constantly update the unit type in a hashtable, as I don't think theres a way to detect this using conditions normally

  • Untitled Trigger 002
    • Events
      • Unit - A unit Finishes training a unit
    • Conditions
    • Actions
      • Set VariableSet TempGroup = (Units of type Altar of Kings)
      • Unit Group - Pick every unit in TempGroup and do (Actions)
        • Loop - Actions
          • Custom script: call IssueImmediateOrderById (GetEnumUnit(), 851976)
      • Custom script: call DestroyGroup(udg_TempGroup)
This could actually work, thank you! ^^
 
Status
Not open for further replies.
Top