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

How to tell WE if unit is an item?

Status
Not open for further replies.
Level 22
Joined
Jun 24, 2008
Messages
3,050
So, i was wondering..

I'm making this trigger making the unit unable to attack, by giving it a 'move to position of triggering unit' every time it recives a smart/attack order on an object.

Problem is; This works on items too.
So my hero can't pick up items. I couldn't find any place to 'Target of order is not equal to item' or such.

Help, please?

(I couldn't decide to to put this in triggers and scripts or WEHZ, so here goes)
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
erm, perhaps you can do it the other way around: instead of checking whether it is an item, check whether it's a unit.
Maybe something like this helps:
  • ((Triggering unit) is A ground unit) Equal to True
  • ((Triggering unit) is A flying unit) Equal to True
Put an Or - Multiple Conditions around it and it should always return true for units, it might just do the trick :/
 
Level 22
Joined
Jun 24, 2008
Messages
3,050
erm, perhaps you can do it the other way around: instead of checking whether it is an item, check whether it's a unit.
Maybe something like this helps:
  • ((Triggering unit) is A ground unit) Equal to True
  • ((Triggering unit) is A flying unit) Equal to True
Put an Or - Multiple Conditions around it and it should always return true for units, it might just do the trick :/

So you're saying that i should check it as a non-ground and non-air unit?
I don't think that's going to work.

Also ^ that won't work. I'm not manipulating any item (aquiering, selling etc.)
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
So you're saying that i should check it as a non-ground and non-air unit?
I don't think that's going to work.

Also ^ that won't work. I'm not manipulating any item (aquiering, selling etc.)
Ehh, I thought you were making a trigger that makes a unit stop with an attack-order.
If the target of order is either a flying or a ground unit, then stop him, otherwise don't...
If you target an item, it won't be a ground/flying unit, so he won't be stopped, right?

Did I misunderstand anything?
 
Level 5
Joined
May 3, 2009
Messages
129
this is the trigger i made fast to see it i could pick up a item or not.

  • test
    • Events
      • Unit - A unit Is issued an order targeting an object
    • Conditions
      • (Target item of issued order) Equal to (Item being manipulated)
    • Actions
      • Unit - Order (Triggering unit) to Move To (Position of (Triggering unit))
It will pick the item up but not attack unit/object
 
Level 22
Joined
Jun 24, 2008
Messages
3,050
this is the trigger i made fast to see it i could pick up a item or not.

  • test
    • Events
      • Unit - A unit Is issued an order targeting an object
    • Conditions
      • (Target item of issued order) Equal to (Item being manipulated)
    • Actions
      • Unit - Order (Triggering unit) to Move To (Position of (Triggering unit))
It will pick the item up but not attack unit/object

Whoa, really? I'm just going to try that out, then.

EDIT: Yes, it works, but problem is, my hero has to be able to attack /sometimes/.
With this, she can't attack at all, but can gather items.
  • RandomName
    • Events
      • Unit - A unit Is issued an order targeting an object
    • Conditions
      • CurrentWeapon[(Player number of (Triggering player))] Equal to No item
      • (Unit-type of (Triggering unit)) Equal to Tester of tools
      • (SOMETHING HERE THAT MEANS THE TARGET IS NOT AN ITEM)
      • Or - Any (Conditions) are true
        • Conditions
          • (Issued order) Equal to (Order(attack))
          • (Issued order) Equal to (Order(smart))
    • Actions
      • Unit - Order (Triggering unit) to Move To (Position of (Triggering unit))
This is my trigger.
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
With this you can pick up items, but if you right click on enemy units or order the unit to attack units, it will stop. The unit will still auto attack enemy units in range.

  • Untitled Trigger 093
    • Events
      • Unit - A unit Is issued an order targeting an object
    • Conditions
      • (Unit-type of (Target unit of issued order)) Not equal to No unit-type
      • Or - Any (Conditions) are true
        • Conditions
          • (Issued order) Equal to (Order(attack))
          • (Issued order) Equal to (Order(smart))
    • Actions
      • Set Temp_Loc_1 = (Position of (Triggering unit))
      • Unit - Order (Triggering unit) to Move To Temp_Loc_1
      • Custom script: call RemoveLocation(udg_Temp_Loc_1)
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
.
  • RandomName
    • Events
      • Unit - A unit Is issued an order targeting an object
    • Conditions
      • CurrentWeapon[(Player number of (Triggering player))] Equal to No item
      • (Unit-type of (Triggering unit)) Equal to Tester of tools
      • (SOMETHING HERE THAT MEANS THE TARGET IS NOT AN ITEM)
      • Or - Any (Conditions) are true
        • Conditions
          • (Issued order) Equal to (Order(attack))
          • (Issued order) Equal to (Order(smart))
    • Actions
      • Unit - Order (Triggering unit) to Move To (Position of (Triggering unit))

I kind of meant that change

  • (SOMETHING HERE THAT MEANS THE TARGET IS NOT AN ITEM)
->
  • (Unit-type of (Target unit of issued order)) Not equal to No unit-type
If that's not what you're trying to do then I missunderstood you.
 
Level 5
Joined
May 3, 2009
Messages
129
ok i think i've got it now
it will pick up any item but not attack till it has a specific item
  • test
    • Events
      • Unit - A unit owned by Player 1 (Red) Is issued an order targeting an object
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Item being manipulated) Equal to (Target item of issued order)
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Item carried by (Triggering unit) of type Phat Lewt) Equal to (Item carried by (Matching unit) in slot 1)
            • Then - Actions
              • Unit - Order (Triggering unit) to Move To (Position of (Triggering unit))
            • Else - Actions
        • Else - Actions
ive tested it and it works
 
Level 22
Joined
Jun 24, 2008
Messages
3,050
I kind of meant that change

  • (SOMETHING HERE THAT MEANS THE TARGET IS NOT AN ITEM)
->
  • (Unit-type of (Target unit of issued order)) Not equal to No unit-type
If that's not what you're trying to do then I missunderstood you.

Is no-unit type a possible unit-type? If so, then it's probably the right one.

EDIT: Doesn't work, the archer can still attack debris such as crates or barrels.

PvSvN (Sorry if i spelled that wrong)'s version works just fine after i've added my condition (current weapon = no item)

Thanks again.
 
Level 13
Joined
Mar 4, 2009
Messages
1,156
IF TARGET IS UNIT
-if (target unit of issued) order equal to (target unit of issued)
IF TARGET IS ITEM
(Target item of issued order) Equal to (Target item of issued order)
IF TARGET IS NOT ITEM
(Target item of issued order) not Equal to (Target item of issued order)
.....
 
Status
Not open for further replies.
Top