• 🏆 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!

[Trigger] Mass Banish

Status
Not open for further replies.
Level 2
Joined
Nov 9, 2008
Messages
14
I was trying to make a spell to banish every unit within range of the caster, but it does not seem to be working. Is it that I am not using the correct settings on channel (the base ability), or are my triggers faulty?

  • Events
    • Unit - A unit Starts the effect of an ability
  • Conditions
    • Ability - (Ability being cast) Equal to Mass Banish
  • Actions
    • Unit Group - Pick every unit within (500.00 = (100.00 x Real(Level of Mass Banish for (Triggering unit)))) and do (Actions)
      • Loop - Actions
        • Unit - Order (Triggering unit) to Human Blood Mage - Banish (Picked unit)
 
Level 8
Joined
Apr 30, 2009
Messages
338
You have to pick every unit in the AOE of the spell, and for each picked unit you must create 1 dummy unit with the banish spell and order the dummy unit to cast banish on the picked unit.

A dummy unit is a unit that is invisble (model path is none.mdl), and has dummy abilities. You have to make a new spell based on banish, make it a unit (non-hero) ability, and give it to your dummy unit.
 
Level 2
Joined
Nov 9, 2008
Messages
14
So how would I get the dummy to cast said banish spell? The only commands I can find are the hero abilities.
 
Level 8
Joined
Apr 30, 2009
Messages
338
Your dummy spell has a line called "Text-Order String-Use/Turn On" that has the name of a normal spell, and you need to trigger the unit to cast this spell. So if you based your dummy spell on Banish then you make the dummy unit cast "Human Bloodmage - Banish." The order string doesn't matter that much, but you have to make sure all the spells on one unit have different strings.

Here's a good tutorial with a section on triggered spells: http://www.hiveworkshop.com/forums/...als-279/basics-trigger-enhancing-spells-7334/
 
Level 16
Joined
May 1, 2008
Messages
1,605
Seas =)

  • Mass Banish
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Dummy Ability
    • Actions
      • Set Temp_Loc = (Position of (Triggering unit))
      • Set Temp_UnitGroup = (Units within 500.00 of Temp_Loc matching (((Matching unit) belongs to an enemy of (Owner of (Triggering unit))) Equal to True))
      • Unit Group - Pick every unit in Temp_UnitGroup and do (Actions)
        • Loop - Actions
          • Set Temp_Loc2 = (Position of (Picked unit))
          • Unit - Create 1 Banish Dummy for (Owner of (Triggering unit)) at Temp_Loc2 facing (Position of (Picked unit))
          • Unit - Order (Last created unit) to Human Blood Mage - Banish (Picked unit)
          • Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
          • Custom script: call RemoveLocation(udg_Temp_Loc2)
      • Custom script: call DestroyGroup(udg_Temp_UnitGroup)
      • Custom script: call RemoveLocation(udg_Temp_Loc)
( Everyone said this - just want create the trigger for him ... and wondering why this shouldn't be possible )
 
Level 15
Joined
Dec 18, 2007
Messages
1,098
Its like that saying about the fish. You could get him to do it himself, and learn, or you could give him a trigger and he'll copy it (most people do that).

If you looked through the tutorial, the trigger is there. It just isn't cleaned :S

Anyway, good luck with your map (I assume you are making one).
 
Level 19
Joined
Feb 25, 2009
Messages
2,004
  • Unit - Create 1 Banish Dummy for (Owner of (Triggering unit)) at Temp_Loc2 facing (Position of (Picked unit))
Leaks

  • Set Temp_UnitGroup = (Units within 500.00 of Temp_Loc matching (((Matching unit) belongs to an enemy of (Owner of (Triggering unit))) Equal to True))
This doesn't filter dead units, mechanical, immune
 
Level 2
Joined
Nov 9, 2008
Messages
14
After looking through the above suggested, I came up with this trigger (which still refuses to work):

  • Events
    • Unit - A unit Starts the effect of an ability
  • Conditions
    • (Ability being cast) Equal to Mass Banish
  • Actions
    • Set PointA = Position of (Triggering unit)
    • Set GroupA = (Units within (300.00 + (100.00 x (Real((Level of Mass Banish for (Triggering unit)))))) of (Position of (Triggering unit)))
    • Unit Group - Pick every unit in GroupA and do (Multiple actions)
      • Loop - Actions
        • Set PointB = Position of (Picked unit)
        • Unit - Create 1 Dummy Caster for (Owner of (Triggering unit)) at PointB facing Default building facing degrees
        • Set UnitA = (Last created unit)
        • If (All conditions are true) then do (Then actions) else do (Else actions)
          • Conditions
            • ((Picked unit) Is a structure) Equal to False
            • ((Picked unit) Is mechanical) Equal to False
          • Then - Actions
            • Unit - Add Dummy Banish to (UnitA)
            • Unit - Order UnitA to Human Blood Mage - Banish (Picked unit)
            • Unit - Add a 1.00 second Generic expiration timer to UnitA
          • Else - Actions
        • Custom script: call RemoveLocation(udg_PointB)
        • Custom script: call RemoveUnit(udg_UnitA)
    • Custom script: call RemoveLocation(udg_PointA)
    • Custom script: call DestroyGroup(udg_GroupA)
I assume flaws in the code are the cause for repetitive failures, rather than the objects. As a noob, I probably can't figure this out myself.
 
Level 9
Joined
Sep 8, 2004
Messages
633
After looking through the above suggested, I came up with this trigger (which still refuses to work):

I assume flaws in the code are the cause for repetitive failures, rather than the objects. As a noob, I probably can't figure this out myself.

It's indeed not yet perfect. I fixed it for you. this should work just fine.

  • Events
    • Unit - A unit Starts the effect of an ability
  • Conditions
    • (Ability being cast) Equal to Mass Banish
  • Actions
    • Set Caster = (Triggering Unit)
    • Set PointA = Position of (Caster)
    • Set GroupA = (Units within (300.00 + (100.00 x (Real((Level of Mass Banish for (Caster)))))) of (Position of (Caster)))
    • Unit Group - Pick every unit in GroupA and do (Multiple actions)
      • Loop - Actions
        • If (All conditions are true) then do (Then actions) else do (Else actions)
          • Conditions
            • ((Picked unit) Is a structure) Equal to False
            • ((Picked unit) Is mechanical) Equal to False
          • Then - Actions
            • Set PointB = Position of (Picked unit)
            • Unit - Create 1 Dummy Caster for (Owner of (Caster)) at PointB facing Default building facing degrees
            • Set UnitA = (Last created unit)
            • Custom script: call RemoveLocation(udg_PointB)
            • Unit - Order UnitA to Human Blood Mage - Banish (Picked unit)
            • Unit - Add a 1.00 second Generic expiration timer to UnitA
          • Else - Actions
    • Custom script: call RemoveLocation(udg_PointA)
    • Custom script: call DestroyGroup(udg_GroupA)
You don't need to add the ability through a trigger. Just prepare the dummy unit with the ability in the object editor. Don't forget to remove any ability requirements, such as mana.
A good way to check your trigger is always to read it out loud. Sound silly, but it's easier to spot whether there's mistake that way.
You'll also notice I added a variable: Caster. It's a unit variable. Reason for this is to prevent using (Triggering Unit) more than once. It takes more time, thus this is a little bit more optimal. You could do the same for (Picked Unit), but you get the general idea.

Tell us what happens when you use the ability.
 
Level 2
Joined
Nov 9, 2008
Messages
14
Thank you. I have played with a few concepts, and here is my final:

  • Mass Banish
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Mass Banish
    • Actions
      • Set PointA = (Position of (Triggering unit))
      • Set GroupA = (Units within (300.00 + (100.00 x (Real((Level of Mass Banish for (Triggering unit)))))) of PointA matching ((((Matching unit) is A structure) Equal to False) and (((Matching unit) is Mechanical) Equal to False))
      • Unit Group - Pick every unit in GroupA and do (Actions)
        • Loop - Actions
          • Set PointB = (Position of (Picked unit))
          • Unit - Create 1 Dummy Caster for Player 1 (Red) at PointB facing 0.00 degrees
          • Unit - Add Dummy Banish to (Last created unit)
          • Unit - Set level of Dummy Banish for (Last created unit) to (Level of Mass Banish for (Triggering unit))
          • Unit - Order (Last created unit) to Human Blood Mage - Banish (Picked unit)
          • Unit - Add a 3.00 second Generic expiration timer to (Last created unit)
          • Custom script: call RemoveLocation( udg_PointB )
      • Custom script: call RemoveLocation( udg_PointA )
      • Custom script: call DestroyGroup( udg_GroupA )
This seems to work well enough, but I'm afraid it will cause lag if the cooldown is removed (not that I was going to remove it).
 
Level 9
Joined
Sep 8, 2004
Messages
633
No, this won't cause lag. Since the code is as clean as GUI gets (cleaning up variables, preventing memory leaks) it won't use too much memory. Unless you have 50 units cast the same thing at the same time, maybe.

Think of it as a home-brewn "blizzard" spell (Sorceress), it does damage and gives a debuff to units in a radius as well. You basically reproduced a similar spell here - no reason the engine should have any trouble with it.
 
Level 19
Joined
Feb 25, 2009
Messages
2,004
  • Set GroupA = (Units within (300.00 + (100.00 x (Real((Level of Mass Banish for (Triggering unit)))))) of PointA matching ((((Matching unit) is A structure) Equal to False) and (((Matching unit) is Mechanical) Equal to False))
It will still cause a dummy to be created if the unit is dead, also trigger out allies, cause if you have 10 dead units, 5 enemy, 7 allies it will make 22 dummies, thus causing intense lag and fps-drop for a small period of time.

Also I suggest you to use "Real" veriable to get the max. range of the ability, using the same math but outside the "Unit-Group" settings, making it more clear and small.
 
Status
Not open for further replies.
Top