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

order all units to move attack except peons?

Status
Not open for further replies.

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,198
Filter the unit group, either with a filter at creation time or with a conditional when processing each unit in the group.

You can perform classification tests. All workers, heroes and structures have their own classification. If it returns true for that classification then skip that unit.

An example filter...
  • ((Matching unit) is A structure) Equal to False
  • ((Matching unit) is A Hero) Equal to False
  • ((Matching unit) is A peon-type unit) Equal to False
 
Level 9
Joined
Mar 1, 2009
Messages
280
thax for getting back to me on this so quick.

unit cast spell then all units except peons, heroes, and structures attack move-to area

it will happen every time this spell is cast like in footmenvsGrunts

[wc3]
MM Rally
Events
Unit - A unit Begins casting an ability
Conditions
And - All (Conditions) are true
Conditions
(Unit-type of (Casting unit)) Equal to Command Center (All Players)
(Ability being cast) Equal to MM Rally
Actions
Set MMRally[(Player number of (Owner of (Casting unit)))] = (Target point of ability being cast)
Unit Group - Order (Units in (Playable map area) matching ((((Unit-type of (Matching unit)) is A structure) Equal to False) or ((((Unit-type of (Matching unit)) is A Hero) Equal to False) or (((Unit-type of (Matching unit)) is A peon-type unit) Equal to False)))) to Attack-Move To MMRally[(Player number of (Owner of (Casting unit)))]

[/wc3]

this doesn't work, peons still move-to attack the targeted area.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,198
As Amigoltu pointed out. It is meant to be "and", as I originally posted above, and not "or".

You will also want to fix the unit group leak. This is done by assigning the unit group to a group variable, using it and then destroying it with the DestroyGroup function.
 
Level 9
Joined
Mar 1, 2009
Messages
280
Ive tried that twice now, still peons are also included....
this is odd i feel like theirs something small that i am missing

[wc3]
Unit Group - Order (Units in (Playable map area) matching ((((Unit-type of (Matching unit)) is A peon-type unit) Equal to False) and ((((Unit-type of (Matching unit)) is A structure) Equal to False) and (((Unit-type of (Matching unit)) is A Hero) Equal to False)))) to Attack-Move To MMRally[(Player number of (Owner of (Casting unit)))]
[/wc3]

heroes are also effected
 
Last edited:
Level 39
Joined
Feb 27, 2007
Messages
5,011
Oh, the problem is you're checking if the unit types are structures/peons/heroes in some way that just isn't gonna work. For each of your comparisons you need to do: Boolean Comparison > Unit - Unit Classification Check to actually check if the unit itself is not one of those types. Should look like this:
  • ((Matching unit) is A peon-type unit) Equal to False
 
Level 9
Joined
Mar 1, 2009
Messages
280
Unit Group - Order (Units owned by (Owner of (Casting unit)) matching ((((Matching unit) is A peon-type unit) Equal to False) and ((((Matching unit) is A structure) Equal to False) and (((Matching unit) is A Hero) Equal to False)))) to Attack-Move To MMRally[(Player number of (Owner of (Casting unit)))]


Does not work, peons still effected
 
Level 39
Joined
Feb 27, 2007
Messages
5,011
That line is correct, so as I said before I suspect your peon units do not have the worker classification in the Object Editor. Or you have a duplicate trigger that's actually doing the ordering and the one you're quoting here is actually disabled in your map.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,198
I recall unit classification tests do not return boolean values, despite it being labelled as boolean hence cannot be compared normally.

Thanks to some computer science theory we can change the test from comparison with false to comparison with true.

(X is peon == false) and (X is structure == false) and (X is Hero == false)
not ((X is peon == true) or (X is structure == true) or (X is Hero == true))

If it still does not work, it is something else wrong with the trigger. You will have to post the full trigger or even the map itself.
 
Level 9
Joined
Mar 1, 2009
Messages
280
it was another trigger that was open another variation of the older tigger i had to started to design but had gotten distracted.... well f^^& me super sorry guys...

  • MM Rally
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • And - All (Conditions) are true
        • Conditions
          • (Unit-type of (Casting unit)) Equal to Command Center (All Players)
          • (Ability being cast) Equal to MM Rally
    • Actions
      • Set MMRally[(Player number of (Owner of (Casting unit)))] = (Target point of ability being cast)
      • Unit Group - Order (Units owned by (Owner of (Casting unit)) matching ((((Matching unit) is A peon-type unit) Equal to False) and ((((Matching unit) is A structure) Equal to False) and (((Matching unit) is A Hero) Equal to False)))) to Attack-Move To MMRally[(Player number of (Owner of (Casting unit)))]
this works, ty for the help, sry about my screw up.


this is the same trigger with out memory leak i think(do i have to destroy location or will that be replaced when the ability is cast a second time?)

  • MM Rally
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • And - All (Conditions) are true
        • Conditions
          • (Unit-type of (Casting unit)) Equal to Command Center (All Players)
          • (Ability being cast) Equal to MM Rally
    • Actions
      • Set MMRally[(Player number of (Owner of (Casting unit)))] = (Target point of ability being cast)
      • Set RallyUnitGroup[(Player number of (Owner of (Casting unit)))] = (Units owned by (Owner of (Casting unit)) matching ((((Matching unit) is A peon-type unit) Equal to False) and ((((Matching unit) is A structure) Equal to False) and (((Matching unit) is A Hero) Equal to False))))
      • Unit Group - Order RallyUnitGroup[(Player number of (Owner of (Casting unit)))] to Attack-Move To MMRally[(Player number of (Owner of (Casting unit)))]
      • Custom script: call DestroyGroup(udg_RallyUnitGroup[GetConvertedPlayerId(GetOwningPlayer(GetSpellAbilityUnit()))])
 
Last edited:
Level 39
Joined
Feb 27, 2007
Messages
5,011
You also need to remove the location if you are not going to use it for anything else. Also use the "Starts the effect of an ability" event, not "Begins casting"; the former only happens once mana/cooldown have been used, while the latter can be triggered without fully casting the spell.
 
Level 39
Joined
Feb 27, 2007
Messages
5,011
You're correct it sets the location variable = the new location, and the old location is just lost forever into the mists (still eating resources since it was never destroyed and now has no way to be referenced, hence a leak).
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,198
i didnt think i had to remove the location, thinking it would just be reset when the player used that same ability repeatedly resetting the location every time.
In JASS (which GUI compiles to on map save) locations (GUI point type) are complex objects with variables holding a reference to them in the form of a handle. JASS has no automatic garbage collector so one must explicitly destroy/remove such complex objects before all references to them are lost. Failing to do this results in a memory leak.
 
Status
Not open for further replies.
Top