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

How to damage unit once

Status
Not open for further replies.
Level 18
Joined
May 11, 2012
Messages
2,103
How do I damage enemy units once?

Like here: when the dummy comes near enemy, I want to damage the enemy only once, not 33 times...

  • Mortal Soul Moving
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • For each (Integer TempInt) from 1 to 5, do (Actions)
        • Loop - Actions
          • Set TempPoint = (Position of MortalSoul_Dummy[TempInt])
          • Set TempPoint2 = (TempPoint offset by 10.00 towards (Facing of MortalSoul_Dummy[TempInt]) degrees)
          • Unit - Move MortalSoul_Dummy[TempInt] instantly to TempPoint2, facing (Facing of MortalSoul_Dummy[TempInt]) degrees
          • Set TempUnitGroup = (Units within 200.00 of TempPoint matching ((((Matching unit) is A structure) Equal to False) and ((((Matching unit) is dead) Equal to False) and (((Matching unit) belongs to an enemy of (Owner of MortalSoul_TrigUnit)) Equal to True))))
          • Unit Group - Pick every unit in TempUnitGroup and do (Actions)
            • Loop - Actions
              • Unit - Cause MortalSoul_TrigUnit to damage (Picked unit), dealing MortalSoul_DealingDamage damage of attack type Spells and damage type Normal
          • Custom script: call RemoveLocation(udg_TempPoint)
          • Custom script: call RemoveLocation(udg_TempPoint2)
          • Custom script: call DestroyGroup(udg_TempUnitGroup)
          • Custom script: set udg_TempPoint = null
          • Custom script: set udg_TempPoint2 = null
          • Custom script: set udg_TempUnitGroup = null
 
Level 28
Joined
Mar 25, 2008
Messages
2,955
You can always add a custom value after the picked unit is hit and check for the custom value in a new condition inside the loop.
You can add some invisible buff too to revert the custom value back to zero so it'll be hit once it comes near the unit again or if the abilty already is an aura just check it's buff.
 
ok. also every spell may look different but all u have to do is break them down to the basics. once u learn that they will all be very easy to make them MUI. An alternative to only damaging the unit once, would be to damage it every time but instead of doing 200 damage a shot divide that over then length of the spell and damage them that amount. for example: u have a spell that lasts 2 seconds, u do 500 damage to them.
ur loop is .03 so about 33.3 times per second. so u will damage the units 66.6 times so take 500 diveded by 66 and u get 7.58 damage per loop period. now u dont need the thing to store units and check if they have been damaged already.
 
Level 18
Joined
May 11, 2012
Messages
2,103
ok. also every spell may look different but all u have to do is break them down to the basics. once u learn that they will all be very easy to make them MUI. An alternative to only damaging the unit once, would be to damage it every time but instead of doing 200 damage a shot divide that over then length of the spell and damage them that amount. for example: u have a spell that lasts 2 seconds, u do 500 damage to them.
ur loop is .03 so about 33.3 times per second. so u will damage the units 66.6 times so take 500 diveded by 66 and u get 7.58 damage per loop period. now u dont need the thing to store units and check if they have been damaged already.

that's what I though of doing...
But shouldn't that lag PC? cuz that's pretty many actions for every unit in unit group...
 
Status
Not open for further replies.
Top