• 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.
  • 💡 We're thrilled to announce that our upcoming texturing contest is in the works, and we're eager to hear your suggestions! Please take this opportunity to share your ideas in this theme discussion thread for the Texturing Contest #34!
  • 🏆 Hive's 7th HD Modeling Contest: Icecrown Creature is now open! The frozen wastes of Icecrown are home to some of Azeroth’s most terrifying and resilient creatures. For this contest, your challenge is to design and model a HD 3D monster that embodies the cold, undead, and sinister essence of Icecrown! 📅 Submissions close on April 13, 2025. Don't miss this opportunity to let your creativity shine! Enter now and show us your frozen masterpiece! 🔗 Click here to enter!

[Trigger] Need Help With Trampling Ability Please

Status
Not open for further replies.
Level 12
Joined
Sep 25, 2013
Messages
711
  • Sons of Rohan
    • Events
      • Time - Every 0.15 seconds of game time
    • Conditions
    • Actions
      • Set RohanRiderGroup = (Units of type Knight of Gondor)
      • Unit Group - Pick every unit in RohanRiderGroup and do (Actions)
        • Loop - Actions
          • Set RohanRider = (Picked unit)
          • Set RohanTrampleUnitPoint = (Position of RohanRider)
          • Set TrampledUnitsGroup = (Units within 130.00 of RohanTrampleUnitPoint matching ((((Matching unit) is A structure) Equal to False) and ((((Matching unit) belongs to an enemy of (Owner of (Picked unit))) Equal to True) and ((((Matching unit) is A Hero) Equal to False) and ((((Matching
          • Unit Group - Pick every unit in TrampledUnitsGroup and do (Actions)
            • Loop - Actions
              • Set RohanTrampleUnit = (Picked unit)
              • Set RohanTrampleUnitPointOffset = (RohanTrampleUnitPoint offset by 140.00 towards (Angle from RohanTrampleUnitPoint to (Position of RohanTrampleUnit)) degrees)
              • Unit - Move RohanTrampleUnit instantly to RohanTrampleUnitPointOffset, facing (Position of RohanRider)
      • Custom script: call DestroyGroup (udg_RohanRiderGroup)
      • Custom script: call DestroyGroup (udg_TrampledUnitsGroup)
      • Custom script: call RemoveLocation (udg_RohanTrampleUnitPoint)
      • Custom script: call RemoveLocation (udg_RohanTrampleUnitPointOffset)
I'm trying to make cavalry units push specific enemy units out of the way as they move. The issue I have is leakage. I'm not good with triggers and I want to know the best way to make a stable version of what I'm trying to do.

Also, is there a way to detect if a unit is moving or not moving? I would like to disable the trample effect when the cavalry units are not moving and enable it when they are. Thank you for your time :)
 
Level 24
Joined
Aug 1, 2013
Messages
4,658
Isn't the "Pick units of type" leaking on its own?

But next to that, you should move the remove location and group inside the loops.
  • Actions
    • Set RohanRiderGroup = (Units of type Knight of Gondor)
    • Unit Group - Pick every unit in RohanRiderGroup and do (Actions)
      • Loop - Actions
        • Set RohanRider = (Picked unit)
        • Set RohanTrampleUnitPoint = (Position of RohanRider)
        • Set TrampledUnitsGroup = (Units within 130.00 of RohanTrampleUnitPoint matching ((((Matching unit) is A structure) Equal to False) and ((((Matching unit) belongs to an enemy of (Owner of (Picked unit))) Equal to True) and ((((Matching unit) is A Hero) Equal to False) and ((((Matching
        • Unit Group - Pick every unit in TrampledUnitsGroup and do (Actions)
          • Loop - Actions
            • Set RohanTrampleUnit = (Picked unit)
            • Set RohanTrampleUnitPointOffset = (RohanTrampleUnitPoint offset by 140.00 towards (Angle from RohanTrampleUnitPoint to (Position of RohanTrampleUnit)) degrees)
            • Unit - Move RohanTrampleUnit instantly to RohanTrampleUnitPointOffset, facing (Position of RohanRider)
            • Custom script: call DestroyGroup (udg_TrampledUnitsGroup)
            • Custom script: call RemoveLocation (udg_RohanTrampleUnitPointOffset)
        • Custom script: call DestroyGroup (udg_RohanRiderGroup)
        • Custom script: call RemoveLocation (udg_RohanTrampleUnitPoint)
That should improve your performance a lot.
 
  • Sons of Rohan
    • Events
      • Time - Every 0.15 seconds of game time
    • Conditions
    • Actions
      • Set RohanRiderGroup = (Units of type Knight of Gondor)
      • Unit Group - Pick every unit in RohanRiderGroup and do (Actions)
        • Loop - Actions
          • Set RohanRider = (Picked unit)
          • Set RohanTrampleUnitPoint = (Position of RohanRider)
          • Set TrampledUnitsGroup = (Units within 130.00 of RohanTrampleUnitPoint matching ((((Matching unit) is A structure) Equal to False) and ((((Matching unit) belongs to an enemy of (Owner of (Picked unit))) Equal to True) and ((((Matching unit) is A Hero) Equal to False) and ((((Matching
          • Unit Group - Pick every unit in TrampledUnitsGroup and do (Actions)
            • Loop - Actions
              • Set RohanTrampleUnit = (Picked unit)
              • Set RohanTrampleUnitPointOffset = (RohanTrampleUnitPoint offset by 140.00 towards (Angle from RohanTrampleUnitPoint to (Position of RohanTrampleUnit)) degrees)
              • Unit - Move RohanTrampleUnit instantly to RohanTrampleUnitPointOffset, facing (Position of RohanRider)
              • Custom script: call RemoveLocation (udg_RohanTrampleUnitPointOffset)
          • Custom script: call RemoveLocation (udg_RohanTrampleUnitPoint)
          • Custom script: call DestroyGroup (udg_TrampledUnitsGroup)
      • Custom script: call DestroyGroup (udg_RohanRiderGroup)
I'm trying to make cavalry units push specific enemy units out of the way as they move. The issue I have is leakage. I'm not good with triggers and I want to know the best way to make a stable version of what I'm trying to do.

Also, is there a way to detect if a unit is moving or not moving? I would like to disable the trample effect when the cavalry units are not moving and enable it when they are. Thank you for your time :)

http://www.hiveworkshop.com/forums/spells-569/gui-unit-indexer-1-2-0-2-a-197329/

http://www.hiveworkshop.com/forums/spells-569/unit-moving-2-0-0-0-a-199189/
Isn't the "Pick units of type" leaking on its own?
like wietlol said, dont use this, use pick unit matching cond instead
zibi
 
Level 12
Joined
Sep 25, 2013
Messages
711
Isn't the "Pick units of type" leaking on its own? But next to that, you should move the remove location and group inside the loops.

Not sure why the remove location actions are inside the loops, they are outside of them on my map. When i pasted the trigger to the thread it must have changed the spacing a little or something. But thanks for helping, i dont really understand why there is a "pick units of type" option if it is inevitably going to leak, thats kinda dumb.

Should i use "pick unit in playable map area matching condition"? does the region thing cause any problem? and within that should the condition be unit of type or some other condition? i mean, is there a problem with the unit of type condition all together?
 
Status
Not open for further replies.
Top