• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Fear Trap Optimization

Status
Not open for further replies.
Level 6
Joined
Aug 12, 2007
Messages
201
  • FearTrap
    • Events
      • Unit - A unit Finishes casting an ability
    • Conditions
      • (Ability being cast) Equal to Fear Trap
    • Actions
      • Set TempFearTrapLocation = (Position of (Casting unit))
      • Set FearUnitsMap = (Units within 512.00 of TempFearTrapLocation)
      • Unit Group - Pick every unit in FearUnitsMap and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) has buff Fear Trap ) Equal to True
            • Then - Actions
              • Selection - Remove (Picked unit) from selection for (Owner of (Picked unit))
              • Unit - Order (Picked unit) to Move To (TempFearTrapLocation offset by 1200.00 towards (Angle from TempFearTrapLocation to (Position of (Picked unit))) degrees)
            • Else - Actions
      • Custom script: call DestroyGroup(udg_FearUnitsMap)
      • Custom script: call RemoveLocation(udg_TempFearTrapLocation)
Not sure if this is the most efficient way of doing this GUI, also I have having trouble stopping the player from simply reselecting the guy and orderspamming him at my fear trap. I still want him to be selectable so I don't really like the 'If player selects him, then deselect him' method, because it is annoying.

  • FearOverridePervention
    • Events
      • Player - Player 1 (Red) Selects a unit
      • Player - Player 2 (Blue) Selects a unit
    • Conditions
      • ((Triggering unit) has buff Fear Trap ) Equal to True
    • Actions
      • Selection - Remove (Triggering unit) from selection
That's what I have to stop orderspam but I don't like how it works, I think there is a better implementation somehow. Any ideas are appreciated.
 
Yes, that is your best way in GUI. You can also use
  • Custom script: call UnitAddAbility (GetEnumUnit(), 'Aloc')
This is a custom script that adds the Locust ability to the unit, since GUI doesn't let you do that (Locust isn't displayed in the Abilities).
To remove the locust, there is a trick. Even if you use "UnitRemoveAbility", the locust effect of selection-inability will retain itself, so you need this:
  • Unit - Hide (Picked unit)
  • Custom script: call UnitRemoveAbility(GetEnumUnit(), 'Aloc')
  • Unit - Unhide (Picked unit)
This still is not efficient, even if the unit is still selectable, it's selectable with drag selection, which is bad. So, your only way is the one you have up there.
In the second trigger, use "Selection - Remove (Triggering unit) from selection for (Triggering player)".
 
Level 6
Joined
Aug 12, 2007
Messages
201
Locust is okay, I've used it before, but I had more in the mind that ordering them to move would simply do nothing rather then you be physically unable to order them. Like, Event Unit is Orders, Condition has Buff, Then Re-order it to do the last order it had before the new one sort of thing. Just can't figure out how to implement that.
 

Dr Super Good

Spell Reviewer
Level 63
Joined
Jan 18, 2005
Messages
27,192
As the even probably runs before the order is actually issued, you need to use a timer with 0 delay (yes 0 is a delay) to get the timing right when the order is to be issued. Using hashtables for this is not a problem as the numbers involved are so small it does not matter really how efficent it is as long as it does not strain the map constantly.
 
Status
Not open for further replies.
Top