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

Question about target triggers

Status
Not open for further replies.
Level 25
Joined
Sep 26, 2009
Messages
2,378
Yes, it is possible to some degree.

You need to use the "Unit - Set Unit integer field" action
  • Unit - Set Unit: Peasant 0002 <gen>'s Integer Field: Targeted as ('utar') to Value: X
As to which value to use instead of "X", see the table below

From common.j
Code:
    // Target Flag
    constant targetflag     TARGET_FLAG_NONE                = ConvertTargetFlag(1)
    constant targetflag     TARGET_FLAG_GROUND              = ConvertTargetFlag(2)
    constant targetflag     TARGET_FLAG_AIR                 = ConvertTargetFlag(4)
    constant targetflag     TARGET_FLAG_STRUCTURE           = ConvertTargetFlag(8)
    constant targetflag     TARGET_FLAG_WARD                = ConvertTargetFlag(16)
    constant targetflag     TARGET_FLAG_ITEM                = ConvertTargetFlag(32)
    constant targetflag     TARGET_FLAG_TREE                = ConvertTargetFlag(64)
    constant targetflag     TARGET_FLAG_WALL                = ConvertTargetFlag(128)
    constant targetflag     TARGET_FLAG_DEBRIS              = ConvertTargetFlag(256)
    constant targetflag     TARGET_FLAG_DECORATION          = ConvertTargetFlag(512)
    constant targetflag     TARGET_FLAG_BRIDGE              = ConvertTargetFlag(1024)


So for example to change unit to be targeted as air unit, find in the table above the flag "TARGET_FLAG_AIR". The flag's value is 4 so setting 4 in place of "X" will make your unit to be targeted as Air.

A few things to note:
  • The action sets a value, it does not add to existing values. So for example if your unit is targeted as Ground and you use the action above with value 4, then the unit will be targeted as Air only. If you want the unit to be targeted as both ground and air, you need to use value 6 (TARGET_FLAG_GROUND + TARGET_FLAG_AIR --> 2 + 4 = 6)
  • You may notice that many options (like ancient, hero, non-hero, non-acient, etc.) are missing. Not sure how to set those
 
Status
Not open for further replies.
Top