How to check if unit has item of type?

Status
Not open for further replies.
Level 3
Joined
Aug 18, 2008
Messages
35
OK i have a building with a dummy abbilty called create steel. To use the abbilty you need at least 1 item Iron Ore in the inventory. the trigger removes the iron ore and puts in steel. i cant figure out the conditions for the trigger. I have one condition that says abbility being cast is equal to Create steel, so it knows its the steel mill but how do i make a condition that tells if theres the 1 iron ore in the inventory?
 
Level 7
Joined
Dec 29, 2008
Messages
252
  • Create Steel
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to CreateSteel
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Triggering unit) has an item of type (Item-type of Steel)) Equal to True
        • Then - Actions
          • -------- Whatever actions that you want to add here --------
        • Else - Actions
          • Game - Display to (Player group((Owner of (Triggering unit)))) the text: You need at least 1...
I think this should work.
 
Level 3
Joined
Aug 18, 2008
Messages
35
Hey i did that trigger and it doesnt work. its like the item will be there and when i click on the dummy abbilty it just says theres no iron ore and doesnt do anything. ive messed with it a few times changeing things but i just doesnt want to work. any idea?
 
Level 3
Joined
Aug 18, 2008
Messages
35
well it works on a normal unit but i found it its not the trigger thats bad its how i set the item variable i did something wrong there and now i need to figure out how to fix it but its not really going my way currently
 
Level 3
Joined
Aug 18, 2008
Messages
35
no the trigger is fine it works with no bugs i dont need to change that its the variable that is wrong. i didnt do that part righti tested it with an if then or else function.
 
Level 3
Joined
Aug 18, 2008
Messages
35
im not sure but i had to use a variable thing to identify the item in the units inventory or something not sure open the map and look for urself
 
Level 3
Joined
Aug 18, 2008
Messages
35
then i made the trigger wrong cuz theres no other way to get around it that i can find by messing around with the trigger from earlier. so please explane how to get this to work
 
Status
Not open for further replies.
Top