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

Add or Remove Classification

Status
Not open for further replies.
Level 33
Joined
Mar 27, 2008
Messages
8,035
As you all know there is a function which enables (really?) unit(s) to have an additional classification, or none at all (well, if you remove them all, right?)

As I tried this trigger, it won't work at all;
  • Actions
    • Unit - Add classification of A flying unit to Blood Mage 0000 <gen>
    • Unit Group - Pick every unit in (Units in (Playable map area) matching (((Matching unit) is A flying unit) Equal to True)) and do (Actions)
      • Loop - Actions
        • Unit - Kill (Picked unit)
This does not work too;
  • Actions
    • Unit - Remove classification of A ground unit from Blood Mage 0000 <gen>
    • Unit Group - Pick every unit in (Units in (Playable map area) matching (((Matching unit) is A ground unit) Equal to True)) and do (Actions)
      • Loop - Actions
        • Unit - Kill (Picked unit)
Well, it "works" by killing the Blood Mage (but hey, I already removed the Ground Unit classification from you, you Bloody Mage)

Am I doing it the wrong way or does it really does... nothing ?
 
Level 8
Joined
Sep 18, 2011
Messages
195
It seems that a ground unit has the movement of foot or something, and the flying unit has the fly movement, and it doesn't retrieve the unit classification if it's a ground or flying.
That's what I think...

Try it! change the blood mage movement in the first trigger, if it worked, it would mean what I said.
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
I mean, go to Object Editor select a unit and try changing "movement - type" field, each time and try it to see if it works.
How does this makes a difference ?
It would make Blood Mage a flying unit, but if I add Ground Units classification to it, it will still be treated as flying units, there are no big difference.
 
Level 8
Joined
Sep 18, 2011
Messages
195
Matching unit is a flying unit is the same as this in Jass:

IsUnitType(gg_unit_hfoo_0000, UNIT_TYPE_FLYING

If you have the movement type set to "fly", then you will get TRUE because UNIT_TYPE_FLYING means movement is fly

adding these two classifications (for A flying unit / A ground unit) particularly doesn't work as I tested.

I believe you can't change these two classifications (unit types) in triggers..
348semv.png

because you cant change them in object editor
thus they are set initially by the movement type.
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
I believe you can't change these two classifications (unit types) in triggers..
This is the main reason I created this thread...

I want to know why does those functions existed if they can do... nothing ?
Not even add/remove classification, would affect the gameplay/trigger-interpretation by the game system.

I know how to change Ground Units -> Fly Units and vice-versa, I only wanna know why does those functions existed, does Blizzard trolling us @.@"
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
I know how to "trick" the system, I can even use Unit Group to separate Flying Units/Ground Units.

I just...
I want to know why does those functions existed if they can do... nothing ?
Not even add/remove classification, would affect the gameplay/trigger-interpretation by the game system.

I know how to change Ground Units -> Fly Units and vice-versa, I only wanna know why does those functions existed, does Blizzard trolling us @.@"

I hope Troll-Brain or DSG or even WaterKnight could come to this thread and explains everything >.>"

And I also heard, there are some Blizzard functions that actually does nothing/does not work, and some says Blizzard really is trolling us all haha.
 
Level 8
Joined
Sep 18, 2011
Messages
195
I know that you know how to trick the system.

but the functions DO SOMETHING! :O

I tried it with Mechanical and displaying some texts, here is the result:

Unit - Is not mechanical
Adding mechanical
Unit - Is mechanical
Removing mechanical
Unit - Is not mechanical


Using

  • Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Footman 0000 <gen> is Mechanical) Equal to True
      • Then - Actions
        • Game - Display to (All players) the text: is mechanical
      • Else - Actions
        • Game - Display to (All players) the text: is not mechanical
    • Unit - Add classification of Mechanical to Footman 0000 <gen>
    • Game - Display to (All players) the text: adding mechanical
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Footman 0000 <gen> is Mechanical) Equal to True
      • Then - Actions
        • Game - Display to (All players) the text: is mechanical
      • Else - Actions
        • Game - Display to (All players) the text: is not mechanical
    • Unit - Remove classification of Mechanical from Footman 0000 <gen>
    • Game - Display to (All players) the text: removing mechanical
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Footman 0000 <gen> is Mechanical) Equal to True
      • Then - Actions
        • Game - Display to (All players) the text: is mechanical
      • Else - Actions
        • Game - Display to (All players) the text: is not mechanical
Just the fly/ground doesn't work, PARTICULARLY as I said and as far as I tested

Conclusion:
  • The functions work except for "flying/ground" for what I tested
  • Blizzard isn't trolling us (this time)
 
In Warcraft III, there are a lot of bugs and natives that barely work.
I'll investigate this.

edit

JASS:
struct Test extends array

    private static method onInit takes nothing returns nothing
        local unit u = CreateUnit(Player(0), 'hpea', 0, 0, 0)
        
        if UnitAddType(u, UNIT_TYPE_FLYING) then
            call BJDebugMsg("Added flying type to unit.")
        else
            call BJDebugMsg("Failed to add flying type to unit.")
        endif
        
        if IsUnitType(u, UNIT_TYPE_FLYING) then
            call BJDebugMsg("Unit is flying type")
        else
            call BJDebugMsg("Unit is not flying type")
        endif
    endmethod

endstruct

Okay, this displays that it failed to add the type and that the unit is not of that type.
I think I know how I can make this work.
One moment.

edit
Well, adding 'Arav' didn't work.
One moment.

edit
Well, that didn't work.
I tried removing the ground type assuming that the flying type can't be added unless we remove, and I tried 'Amrf' instead of 'Arav' just to be sure.
I also added waits in between everything so I can assure that it works because sometimes, things don't happen instantly.

Adding 'Amrf' only gives you the ability to change the height of a unit, and I assumed that it would modify some type
boolean inside the game, but I was wrong.
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
Mag, I tried too adding all sorts of "Flying Abilities" such as Storm Crow Form, Crow Form, etc, but it fails too.

Also, if you add those abilities and yes, your units can fly, Ground Units still treat the unit as Ground Unit, no error message saying "Unable to target air units."

@KnnO
So basically just those 2 functions don't work well ?
Flying/Ground Units ?
 
Level 8
Joined
Sep 18, 2011
Messages
195
I tried what magtheridon96 tried, except for the boolean check that it actually add the type.

@Magtheridon96: did UnitAddType(u, UNIT_TYPE_FLYING) return false? because it is either not adding this type like what I assumed from the first time, or there is a bug which it pretends it added the type to the unit.

I will edit this
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
Conclusion:
The functions work except for "flying/ground" for what I tested
WRONG, here's the full list of what's working and what's not (I tested it with Paladin)

WORKS:
Summoned
Undead
Mechanical
Ancient
Peon-type unit
Town-hall-type unit
Sapper

DOES NOT WORK:
Structure
Flying unit
Able to attack flying units
Ranged Attacker
Plagued
Snared
Stunned
Poisoned
Polymorphed
Sleeping
Resistant
Ethereal
Magic immune

You must be wondering why I did not include Hero / Ground Unit / Able to attack ground units / A melee attacker, right ?

Well, it's basically because Paladins have all that attributes naturally so there is no need to test it out, it will work as positive test.

This is my basic trigger to test out those functions working or not;
  • Untitled Trigger 001
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Unit - Add classification of Magic Immune to Paladin 0001 <gen>
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Paladin 0001 <gen> is Magic Immune) Equal to True
        • Then - Actions
          • Game - Display to (All players) the text: Works
        • Else - Actions
          • Game - Display to (All players) the text: Does not work
 
Level 8
Joined
Sep 18, 2011
Messages
195
Looping through ConvertUnitType(i) from 0 to 26 and got this:

0 - 8 can't be added
9 - 20 can be added and removed
21 - 26 can't be added

Tried it with different units (building/flying/ground unit/hero)

You had me to it first! almost the same thing we tested

Also I knew there were more stuff that don't work so that why I said "for what I tested" with [u][/u] tags :D (I shall never be wrong :p)
 
Level 29
Joined
Mar 10, 2009
Messages
5,016
UnitAddType maybe works only on post#2 (the image which KnnO posted), so we can't do anyting unless Blizzard fix it...

let's not be surprised by these bugs coz remember the return bug which was fixed after (5 yrs?)...

the only way to deal with this (if it's really a bug) is to use other methods, like the 'trick' I have mentioned,
like hashtables also, you can have only 255 HT in a map but Bribe and Vexorian finds a way to hash the hash
in which you can declare near to unlimited hash in a map...

EDIT:
using Arav and Amrf doesnt mean that you modified already the 'Movement - Type' in the object editor coz it's only an ability and
you can remove it, WC3 can't access objects in triggers except LUA object merger...
 
you can have only 255 HT in a map but Bribe and Vexorian finds a way to hash the hash
in which you can declare near to unlimited hash in a map...

Actually, it's pretty much just one hashtable in which we're using one of the keys as 'this', so we only have one other key :p (because you often only need 1 key)

TableArrays let you have 2 keys and they're just arrays of the Tables that you declare.
 
Status
Not open for further replies.
Top