• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

Ground Unit condition

Status
Not open for further replies.
Level 5
Joined
Jun 14, 2009
Messages
106
I am currently making a triggered spell and I am encountering one serious problem. I am making a condition which is used to select the units which are affected by a spell. This condition specifies that the matching unit is a ground unit. However it appears that amphibious units do not fall under this condition as they are not being affected. This is a real problem as I need this spell to be able to affect a mixture of amphibious and ground units but not air units. Anyone know of a way to do this by using another condition?
 
Level 5
Joined
Jun 14, 2009
Messages
106
Right now that's what I'm using. However that also requires that I make other conditions such as 'is a structure equal to false' and such, which I'm trying to avoid cause this isn't the only spell that I'm making for this map.
 
Level 16
Joined
May 1, 2008
Messages
1,605
Do I get it correct, that you just want to type the conditions just once but you wanna use them more times for different spells?
In this case, I just can give you something in Jass, because I tried but don't know how you can do it in GUI:

1) Make a trigger named (as example) filter. Convert this trigger to custom text, delete everything and add this:
JASS:
function filter takes unit u, player p returns boolean
    return GetWidgetLife(u) > 0.405 and IsUnitEnemy(u,p) and IsUnitType(u,UNIT_TYPE_GROUND) == true and IsUnitType(u,UNIT_TYPE_STRUCTURE) == false and IsUnitType(u,UNIT_TYPE_MAGIC_IMMUNE) == false
endfunction

2) Now you create your spell and for using this filter you have to do this:
  • Actions
    • Custom script: if filter(GetSpellTargetUnit(),GetOwningPlayer(GetTriggerUnit())) then
    • Unit - Kill (Target unit of ability being cast)
    • Custom script: endif
3) For a GUI group pick action it would be like this (since you don't wanna add all the conditions for a direct filter):
  • Actions
    • Set UnitVariable = (Triggering unit)
    • Set PointVariable = (Position of UnitVariable)
    • Set GroupVariable = (Units within 500.00 of PointVariable)
    • Unit Group - Pick every unit in GroupVariable and do (Actions)
      • Loop - Actions
        • Custom script: if filter(GetEnumUnit(),GetOwningPlayer(udg_UnitVariable)) then
        • Unit - Kill (Picked unit)
        • Custom script: endif
    • Custom script: call RemoveLocation(udg_PointVariable)
    • Custom script: call DestroyGroup(udg_GroupVariable)
 

Attachments

  • filter.w3x
    12.7 KB · Views: 29
Level 5
Joined
Jun 14, 2009
Messages
106
Alright guys, thanks for all the help. Right now the trigger I was using, uses several conditions instead of one only, to define a 'ground unit'. I was merely trying to see if there was an easier method to do this, that's all because I am using several spells which use this condition. And not only this condition but many others as well. I was trying to avoid having to insert about 7 conditions when defining a unit group (which requires the use of several 'and' functions). However it appears that this is not possible, so I'll just use the current format.

@Dr. Boom, I'm really not that comfortable using Jass as I'm not very familiar with it, so I think I'll pass on your solution. But thanks anyway :)
 
Status
Not open for further replies.
Top