• 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.
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!
  • ✅ The POLL for Hive's Texturing Contest #34 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!
  • ✅ The POLL for Hive's Techtree Contest #20 is OPEN! Vote for the TOP 3 FACTIONS! 🔗Click here to cast your vote!

[Trigger] Bug! it replaces one unit with more than one

Status
Not open for further replies.

Ham

Ham

Level 5
Joined
Jan 16, 2009
Messages
132
anyone knows why this bugs and it replaces 1 unit with more than 1??

here:

  • 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
          • Trigger - Add to Ressurect2 <gen> the event (Unit - (Picked unit)'s mana becomes Greater than or equal to 1.00)
      • 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 (Picked unit) to Mana%
      • Custom script: call DestroyGroup (udg_Ethereal)
1.jpg
2.jpg
3.jpg

:confused:
 
It's because your periodic trigger is continually adding events to your trigger, and if the same event is added twice, then the trigger will run twice. If it's added 3 times, then same thing goes.

So the solution: Make a unit group variable called DontAdd or something. Then do this with your trigger:

  • 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:
            • (Picked unit) is in DontAdd Equal to False
          • Then:
            • 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:
  • Custom script: call DestroyGroup (udg_HumanImpaled)
Trigger looks a little messy cause I handwrote it but hope that helps.
 
Thanks this really worked, but now the replaced unit's is not taking the value of the impaled human's mana :S
 
  • 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 (Picked 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 (Picked unit) to Mana%
      • Custom script: call DestroyGroup (udg_Ethereal)
 
Unit - Set mana of (Picked unit) to Mana%

this was the trouble, it's not picked, it's last replaced ^^

EDIT: ok now that i've tested it with two friends, and when both of them has an ImpaledBody (unit) the trigger picks both units and not the owners one :S why?
 
Last edited:
Status
Not open for further replies.
Back
Top