• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

How to remove Unit for owning player from player group

Status
Not open for further replies.
Since I don't know how you are supposed to hire heroes in your map (be it with trigger creation or selling event) and guessing that one hero is used per player, I'll use this:
  • Trigger
  • Events
    • Unit - A unit enters (Playable Map Area)
  • Conditions
    • ((Triggering unit) is a Hero) Equal to True
    • ((Triggering unit) is in HeroGroup) Equal to False
  • Actions
    • Unit Group - Add (Triggering unit) to HeroGroup
    • Set Hero[(Player number of (Triggering player))] = (Triggering unit)
  • Trigger1
  • Events
    • Unit - A unit dies
  • Conditions
    • (Triggering unit) Equal to Hero[(Player number of (Triggering player))]
  • Actions
    • Player Group - Remove (Triggering player) from YourForce
Variables used:

i) HeroGroup: Unit Group
ii) Hero[]: Unit, array ticked
iii) YourForce: Player Group, the one you want the owner of the unit to be removed from.
 
Status
Not open for further replies.
Top