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

[Trigger] Why does it pick all players?

Status
Not open for further replies.

Ham

Ham

Level 5
Joined
Jan 16, 2009
Messages
132
i have got this trigger so far to remplace units but it replaces all units of this type including other's player's units, why???

  • Ressurect
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Set HumanImpaled = (Units of type Human Impaled)
      • Unit Group - Pick every unit in HumanImpaled and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) is in DontAdd) Equal to False
            • Then - Actions
              • Unit Group - Add (Picked unit) to DontAdd
              • Trigger - Add to Ressurect2 <gen> the event (Unit - (Picked unit)'s mana becomes Greater than or equal to 1.00)
            • Else - Actions
      • Custom script: call DestroyGroup (udg_HumanImpaled)
  • Ressurect2
    • Events
    • Conditions
    • Actions
      • Set Mana = (Percentage mana of (Triggering unit))
      • Unit - Remove (Triggering unit) from the game
      • Set Ethereal = (Units of type Explorer (Ethereal))
      • Unit Group - Pick every unit in Ethereal and do (Actions)
        • Loop - Actions
          • Unit - Replace (Picked unit) with a Explorer (Corporeal) using The old unit's relative life and mana
          • Unit - Set mana of (Last replaced unit) to Mana%
      • Custom script: call DestroyGroup (udg_Ethereal)
thanks for taking a time looking at this post.
 
Level 6
Joined
Mar 20, 2008
Messages
208
When you set the group to units of type (X) I do believe it will include units outside of the groups original bounds, regardless of the original group and/or owner.

I would suggest checking that out, maybe instead of setting the group to units of Type, you could make an if check for the unit type and/or owner.

Other than that, you need to be a little bit more detailed about the problem.
 
  • Like
Reactions: Ham

Ham

Ham

Level 5
Joined
Jan 16, 2009
Messages
132
No where you check the units for who owns them? That is pretty obviously the reason. How is the game engine meant to no that you want only a specific player's units unless you tell it to.

this is obviosuly the reason, but how to solve it? i don't really know : /

In short words: use (Units owned by (Player X) of type Human Impaled) instead of (Units of type Human Impaled)

could i just do owned by "triggering player" ? or how pick players there? how would it regonize who it belongs to?
 

Ham

Ham

Level 5
Joined
Jan 16, 2009
Messages
132
ok what it is meant to do is, that when an human impaled gains 1 or more mana, it will remove players unit of type human impaled saving it's mana value in a variable, and then the owner of that human impaled that had mana replaces ethereal explorer (unit) with a corporeal explorer (unit) using relatives hp and mana from the variable mana
 
Level 6
Joined
Mar 20, 2008
Messages
208
you just have to check if the owner of the triggering unit is equal to the owner of the etheral unit.

Add a if-then-else multiple actions clause into the loop, and pop that condition into the condition
 

Ham

Ham

Level 5
Joined
Jan 16, 2009
Messages
132
i think this is working but not sure it's leakless tho

  • Ressurect2
    • Events
    • Conditions
    • Actions
      • Set Mana = (Percentage mana of (Triggering unit))
      • Unit - Remove (Triggering unit) from the game
      • Set Ethereal = (Units of type Explorer (Ethereal))
      • Unit Group - Pick every unit in Ethereal and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Owner of (Triggering unit)) Equal to (Owner of (Picked unit))
            • Then - Actions
              • Unit - Replace (Picked unit) with a Explorer (Corporeal) using The old unit's relative life and mana
              • Unit - Set mana of (Last replaced unit) to Mana%
            • Else - Actions
      • Custom script: call DestroyGroup (udg_Ethereal)
thanks everyone
 
Status
Not open for further replies.
Top