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

[General] Unit - Set Unit Weapon Integer Field

Status
Not open for further replies.
Level 3
Joined
Mar 18, 2020
Messages
20
Hey all,

I'm trying to create an ability that toggles between a unit being able to attack Wards or not.

I've based the ability off of "Defend", and am calling it based on the order ID.

The two very short triggers:
  • ToggleWardAttackOn
    • Events
      • Unit - A unit Is issued an order with no target
    • Conditions
      • (Issued order) Equal to (Order(defend))
    • Actions
      • Game - Display to (All players) the text: toggle on
      • Unit - Set Unit: (Ordered unit)'s Weapon Integer Field: Attack Targets Allowed ('ua1g')at Index: 1 to Value: ???
  • ToggleWardAttackOff
    • Events
      • Unit - A unit Is issued an order with no target
    • Conditions
      • (Issued order) Equal to (Order(undefend))
    • Actions
      • Game - Display to (All players) the text: toggle off
      • Unit - Set Unit: (Ordered unit)'s Weapon Integer Field: Attack Targets Allowed ('ua1g')at Index: 1 to Value: ???

I think this is what I'm looking for but I'm not entirely sure what ua1g's Value field refers to (???). I'm assuming Index refers to the Attack (Type 1 or 2).

Could anyone explain what the value actually refers to, and if my triggers can work in this way? Or suggest an alternate approach? I also tried adding a modified Orb of Fire attack ability with units allowed being Ward; it added/removed the ability just fine, but the attacks themselves just didn't work.

Thanks
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,570
Every single field in the Object Editor has a "raw" value. This is some 4 digit code like 'A000' or in your case 'ua1g'.

You can press Control + D to toggle between the standard view (see picture 1) and the raw data view (see picture 2).

So 'ua1g' is the rawcode for Attack Targets Allowed. Note that this rawcode isn't really important because there is only one Attack Targets Allowed field. If there were multiple Attack Targets Allowed field then they would each need to have their own unique rawcode in order to set themselves apart from one another.

If you don't understand what I mean, check out Storm Bolt's Damage field rawcode and compare it with Blizzard's Damage field rawcode.

Storm Bolt uses Damage 'Htb1' where as Blizzard uses Damage 'Hbz2'. Two different codes despite both having the name "Damage". This code is what sets them apart.

Now onto your specific problem. Attack Targets Allowed is not implemented correctly or if it is the implementation is extremely confusing. There's no way Blizzard intended us to use an integer value to represent SO MANY possible combinations.

Another thing that's important to note, Blizzard made the bright decision of Indexing these values starting at 0. What this means is that Index: 0 actually represents Attack Type 1 and Index: 1 represents Attack Type 2. This applies to all of these Weapon/Ability/Unit Field actions that were introduced in patch 1.31.


Anyway, a possible solution would be to use these triggers instead:
  • Enable Attack Type 2
    • Actions
      • Unit - Set Unit: (Triggering unit)'s Weapon Boolean Field: Attacks Enabled ('uaen')at Index:0 to Value: False
      • Unit - Set Unit: (Triggering unit)'s Weapon Boolean Field: Attacks Enabled ('uaen')at Index:1 to Value: True
  • Enable Attack Type 1
    • Actions
      • Unit - Set Unit: (Triggering unit)'s Weapon Boolean Field: Attacks Enabled ('uaen')at Index:1 to Value: False
      • Unit - Set Unit: (Triggering unit)'s Weapon Boolean Field: Attacks Enabled ('uaen')at Index:0 to Value: True
So the unit will have one Attack Type that can target Wards, and another that cannot.
 

Attachments

  • 1.png
    1.png
    87.1 KB · Views: 90
  • 2.png
    2.png
    76.7 KB · Views: 103
Last edited:
Level 3
Joined
Mar 18, 2020
Messages
20
Thanks Uncle, very helpful! Did the same triggers with the boolean swap and it works just fine :) +rep

Still curious about whatever Blizzard intended those values to be for, though.
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,570
Thanks Uncle, very helpful! Did the same triggers with the boolean swap and it works just fine :) +rep

Still curious about whatever Blizzard intended those values to be for, though.
A lot of these fields don't work yet so who knows... I guess their plan was something like:
1 = Air, 2 = Air, Alive, 3 = Air, Alive, Allied, etc...

That being said, maybe it does work and I just don't understand how to use it yet. I can say for certain that I've messed around with this field before and ended up getting some very strange results.
 
Status
Not open for further replies.
Top