• 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] Drain single Unit in a group

Status
Not open for further replies.
Level 2
Joined
Jun 12, 2010
Messages
7
Hey,
I've been trying to script a boss who drains units, which are below 25%/10% life while marking them with a question mark when they are below 50%.
My problem is that as soon as one unit is marked, others won't be.
The drain works good (won't say perfectly since I don't think it's very well done) on a single unit.

Here is the map: http://www.hiveworkshop.com/forums/attachment.php?attachmentid=112434&stc=1&d=1333121423


hoping for some help!
 

Attachments

  • BossTest.w3x
    303.4 KB · Views: 70
Level 11
Joined
Nov 15, 2007
Messages
800
You should just post the problematic triggers rather than the map. You usually get help faster that way. A lot of Hive users might be browsing the forum at work or somewhere else where they don't have access to the editor, or just don't want to download the map and search for the problem.
 
Level 2
Joined
Jun 12, 2010
Messages
7
Okay will do it!


  • Feed
    • Events
      • Unit - A unit comes within 350.00 of Arichnopha <PH> 0006 <gen>
    • Conditions
      • Feeding Equal to 0
      • (Percentage life of (Triggering unit)) Less than 50.00
      • (Triggering unit) Not equal to Arichnopha <PH> 0006 <gen>
    • Actions
      • Set UnitDanger = (Triggering unit)
      • Special Effect - Create a special effect attached to the overhead of (Triggering unit) using Abilities\Spells\Other\TalkToMe\TalkToMe.mdl
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Triggering unit)) Equal to Icy Spiderling <PH>
          • (Percentage life of (Triggering unit)) Less than 25.00
        • Then - Actions
          • Set Feeding = 1
          • Trigger - Turn on FeedTimer <gen>
          • Special Effect - Destroy (Last created special effect)
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Percentage life of (Triggering unit)) Less than 10.00
              • (Unit-type of (Triggering unit)) Equal to TestUnit <PH>
            • Then - Actions
              • Set Feeding = 1
              • Trigger - Turn on FeedTimer <gen>
              • Special Effect - Destroy (Last created special effect)
            • Else - Actions



  • FeedTimer
    • Events
      • Time - Every 0.05 seconds of game time
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Distance between (Position of Arichnopha <PH> 0006 <gen>) and (Position of UnitDanger)) Less than or equal to 450.00
        • Then - Actions
          • Lightning - Destroy (Last created lightning effect)
          • Lightning - Create a Drain Life lightning effect from source (Position of Arichnopha <PH> 0006 <gen>) to target (Position of UnitDanger)
          • Set Feeding = (Feeding + 1)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Feeding Equal to 100
            • Then - Actions
              • Lightning - Destroy (Last created lightning effect)
              • Set Feeding = 0
              • Special Effect - Create a special effect at (Position of UnitDanger) using Abilities\Spells\Undead\Darksummoning\DarkSummonTarget.mdl
              • Floating Text - Create floating text that reads Arcihnopha <PH> dra... above Arichnopha <PH> 0006 <gen> with Z offset 10.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
              • Floating Text - Change (Last created floating text): Disable permanence
              • Floating Text - Change the lifespan of (Last created floating text) to 5.00 seconds
              • Unit - Kill UnitDanger
              • Player - Set the current research level of Boss Feed to ((Current research level of Boss Feed for Player 12 (Brown)) + 1) for Player 12 (Brown)
              • Wait 1.20 seconds
              • Special Effect - Destroy (Last created special effect)
              • Lightning - Destroy (Last created lightning effect)
              • Trigger - Turn off (This trigger)
            • Else - Actions
        • Else - Actions
          • Set Feeding = 0
          • Lightning - Destroy (Last created lightning effect)
          • Trigger - Turn off (This trigger)
 
Level 19
Joined
Aug 8, 2007
Messages
2,765
UnitDanger is overwritten every time someone comes near the guy.... it only checks the one variable. How do you expect it to work
 
Level 2
Joined
Jun 12, 2010
Messages
7
Alright, worked a bit on it and it's functional now
The only problem I have is that the question mark isn't deleted, when a unit gets healed.

Here is the new trigger:
  • FeedCheck
    • Events
      • Time - Every 2.00 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Units within 350.00 of (Position of Arichnopha <PH> 0006 <gen>)) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Picked unit) Not equal to Arichnopha <PH> 0006 <gen>
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Custom value of (Picked unit)) Equal to 0) and ((Percentage life of (Picked unit)) Less than or equal to 40.00)
                • Then - Actions
                  • Set UnitsInDanger = (UnitsInDanger + 1)
                  • Set UnitDanger[UnitsInDanger] = (Picked unit)
                  • Unit - Set the custom value of (Picked unit) to 1
                  • Special Effect - Create a special effect attached to the overhead of (Picked unit) using Abilities\Spells\Other\TalkToMe\TalkToMe.mdl
                  • Set UnitSpecialEffect[UnitsInDanger] = (Last created special effect)
                • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Custom value of (Picked unit)) Equal to 1) and ((Percentage life of (Picked unit)) Greater than or equal to 40.00)
                • Then - Actions
                  • Set UnitDanger[UnitsInDanger] = No unit
                  • Unit - Set the custom value of (Picked unit) to 0
                  • Special Effect - Destroy UnitSpecialEffect[UnitsInDanger]
                  • Set UnitsInDanger = (UnitsInDanger - 1)
                • Else - Actions
            • Else - Actions

Edit:
Ok I see the problem I have, but i don't know how to fix it!
The wrong UnitsInDanger Integer is used to delete the question mark. Any ideas on how I fix this?
 
Last edited:
Level 2
Joined
Jun 12, 2010
Messages
7
No idea why it isn't working.
Can someone tell me exactly where I made a mistake?


  • FeedCheck
    • Events
      • Time - Every 2.00 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Units within 350.00 of (Position of Arichnopha <PH> 0006 <gen>)) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) Not equal to Arichnopha <PH> 0006 <gen>) and ((Unit-type of (Picked unit)) Not equal to Egg <PH>)
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Custom value of (Picked unit)) Equal to 0) and ((Percentage life of (Picked unit)) Less than or equal to 40.00)
                • Then - Actions
                  • Set UnitDanger[UnitsInDanger] = (Picked unit)
                  • Unit - Set the custom value of (Picked unit) to 1
                  • Special Effect - Create a special effect attached to the overhead of (Picked unit) using Abilities\Spells\Other\TalkToMe\TalkToMe.mdl
                  • Set UnitSpecialEffect[UnitsInDanger] = (Last created special effect)
                  • Set UnitsInDanger = (UnitsInDanger + 1)
                • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Custom value of UnitDanger[UnitsInDanger]) Equal to 1) and ((Percentage life of UnitDanger[UnitsInDanger]) Greater than or equal to 40.00)
                • Then - Actions
                  • Unit - Set the custom value of UnitDanger[UnitsInDanger] to 0
                  • Special Effect - Destroy UnitSpecialEffect[UnitsInDanger]
                  • Set UnitDanger[UnitsInDanger] = No unit
                  • Set UnitsInDanger = (UnitsInDanger - 1)
                • Else - Actions
            • Else - Actions
      • Unit Group - Pick every unit in (Units in (Playable map area) matching ((Distance between (Position of Arichnopha <PH> 0006 <gen>) and (Position of (Picked unit))) Greater than or equal to 351.00)) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Matching unit) Not equal to Arichnopha <PH> 0006 <gen>) and ((Unit-type of (Matching unit)) Not equal to Egg <PH>)
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Custom value of (Matching unit)) Equal to 1) or ((Percentage life of (Matching unit)) Greater than or equal to 40.00)
                • Then - Actions
                  • Unit - Set the custom value of UnitDanger[UnitsInDanger] to 0
                  • Special Effect - Destroy UnitSpecialEffect[UnitsInDanger]
                  • Set UnitDanger[UnitsInDanger] = No unit
                  • Set UnitsInDanger = (UnitsInDanger - 1)
                • Else - Actions
            • Else - Actions
 
Level 2
Joined
Jun 12, 2010
Messages
7
Still need help...
Trigger at the moment:
  • FeedCheck
    • Events
      • Time - Every 2.00 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Units within 350.00 of (Position of Arichnopha <PH> 0006 <gen>)) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) Not equal to Arichnopha <PH> 0006 <gen>) and ((Unit-type of (Picked unit)) Not equal to Egg <PH>)
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Custom value of (Picked unit)) Equal to 0) and ((Percentage life of (Picked unit)) Less than or equal to 40.00)
                • Then - Actions
                  • Set UnitDanger[UnitsInDanger] = (Picked unit)
                  • Unit - Set the custom value of (Picked unit) to 1
                  • Special Effect - Create a special effect attached to the overhead of (Picked unit) using Abilities\Spells\Other\TalkToMe\TalkToMe.mdl
                  • Set UnitSpecialEffect[UnitsInDanger] = (Last created special effect)
                  • Set UnitsInDanger = (UnitsInDanger + 1)
                • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Custom value of UnitDanger[UnitsInDanger]) Equal to 1) and ((Percentage life of UnitDanger[UnitsInDanger]) Greater than or equal to 40.00)
                • Then - Actions
                  • Unit - Set the custom value of UnitDanger[UnitsInDanger] to 0
                  • Special Effect - Destroy UnitSpecialEffect[UnitsInDanger]
                  • Set UnitDanger[UnitsInDanger] = No unit
                  • Set UnitsInDanger = (UnitsInDanger - 1)
                • Else - Actions
            • Else - Actions
      • Unit Group - Pick every unit in (Units in (Playable map area) matching ((Distance between (Position of Arichnopha <PH> 0006 <gen>) and (Position of (Picked unit))) Greater than or equal to 351.00)) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Matching unit) Not equal to Arichnopha <PH> 0006 <gen>) and ((Unit-type of (Matching unit)) Not equal to Egg <PH>)
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Custom value of (Matching unit)) Equal to 1) or ((Percentage life of (Matching unit)) Greater than or equal to 40.00)
                • Then - Actions
                  • Unit - Set the custom value of UnitDanger[UnitsInDanger] to 0
                  • Special Effect - Destroy UnitSpecialEffect[UnitsInDanger]
                  • Set UnitDanger[UnitsInDanger] = No unit
                  • Set UnitsInDanger = (UnitsInDanger - 1)
                • Else - Actions
            • Else - Actions
 
Status
Not open for further replies.
Top