• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Solved] Unit Classification

Status
Not open for further replies.
Level 37
Joined
Aug 14, 2006
Messages
7,602
Hey.

I'm doing a system that uses Unit Classifications. I learned today that there are only four classifications that can be actually changed by their name(Undead, Mechanical, Giant and Tauren). Well, that's not problem because four is enough for me.

However, what is preventing me to continue the system is that in conditions I don't see Giant and Tauren. How can I detect if a Giant type of unit is attacked?

Rep for the helpers.
 

Attachments

  • WHERE IS GIANT.jpg
    WHERE IS GIANT.jpg
    81.8 KB · Views: 226
Level 20
Joined
Jul 6, 2009
Messages
1,885
You can use custom scripts:
  • Trigger
    • Events
      • Unit - A unit Is attacked
    • Conditions
    • Actions
      • Custom script: local unit u = GetTriggerUnit()
      • Custom script: if IsUnitType(u,UNIT_TYPE_GIANT) then
      • //actions for giant type units here
      • Custom script: elseif IsUnitType(u,UNIT_TYPE_TAUREN) then
      • //actions for tauren type units here
      • Custom script: endif
      • Custom script: set u = null
 
Level 37
Joined
Aug 14, 2006
Messages
7,602
Really?

Does this work?

  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • ((Attacking unit) has an item of type Dragon Buster) Equal to True
    • Then - Actions
      • Custom script: if IsUnitType(udg_Unit,UNIT_TYPE_GIANT) then
      • Unit - Cause (Attacking unit) to damage (Attacked unit), dealing 300.00 damage of attack type Spells and damage type Normal
      • Custom script: endif
    • Else - Actions
Deals extra damage if the attacked enemy unit is Giant type.
 
Level 20
Joined
Jul 6, 2009
Messages
1,885
No. Change it to GetTriggerUnit(), not udg_GetTriggerUnit(). Like this:
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • ((Attacking unit) has an item of type Dragon Buster) Equal to True
    • Then - Actions
      • Custom script: if IsUnitType(GetTriggerUnit(),UNIT_TYPE_GIANT) then
      • Unit - Cause (Attacking) to damage (Triggering unit), dealing 300.00 damage of attack type Spells and damage type Normal
      • Custom script: endif
    • Else - Actions
Also change the attacked unit to triggering unit (just for the sake of efficiency).
 
Status
Not open for further replies.
Top