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

Can't find condition

Status
Not open for further replies.
Level 2
Joined
Nov 25, 2013
Messages
15
I want to implement a way for a hero to change it's weapon simply by clicking a weapon in the inventory, but I can't find the condition I need.

What I need is:

Event: Player owned unit manipulates item
Condition: Manipulated item equal to Glock = true
Action: Replace triggering unit with Hero (Glock)

I cannot find the condition I need anywhere, any ideas?
 
Level 2
Joined
Nov 25, 2013
Messages
15
Where do I find Temp_Int))? I have scoured every integer and handle menu and can't see it
 
Level 2
Joined
Nov 25, 2013
Messages
15
I am confused what 'int_temp' is though, so I can't create it because I have no idea what to look for :x
 
Level 12
Joined
Mar 24, 2011
Messages
1,082
You have 6 slots (probably) and you need to check in every slot to see if the hero has the item.
Make a integer varible named Temp_Int. (Temp is short for temporaly and Int means integer wich referes to values)

use this action:
  • For each (Integer Temp_Int) from 1 to 6, do (Actions)
    • Loop - Actions
Now the varible is equal to all the values from 1 to 6 so it has basicly 6 values at the same time.

Now you search for the item:
  • Untitled Trigger 001
    • Events
    • Conditions
    • Actions
      • For each (Integer Temp_Int) from 1 to 6, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Item-type of (Item carried by (triggering unit) in slot Temp_Int)) Equal to Sword
            • Then - Actions
            • Else - Actions
Now you just tell the computer whatever it should do under 'Then - Actions'
 
Level 12
Joined
Mar 24, 2011
Messages
1,082
Kitabatake is right. Use his method.

@NightSkyAurora: The trigger which he had and which you are offering will fire if ANY item is used and the hero HAS a glock even if the item used WAS NOT the glock.

PS: Didn't see your initial question but it is good to know what variables are and what they are used for. There are many things which can be done only with variables. By using them you may make your code leakless, faster and more readable.
 
Level 25
Joined
Sep 26, 2009
Messages
2,378
Tbh, will that even work? I always thought that the event "Unit manipulates an item" works only for when you actually manipulate the item by removing it from inventory, to different backpack slot, etc.

He wanted to activate the trigger by clicking on the item (I guess right-clicking). If that is the case, you could create your own custom ability, which will be used by that item exclusively (based off the hero "Channel" ability, as that ability does nothing).

Then you actually make an event "Unit starts the effect of an ability" and check if the ability being cast is the ability the item (= sword) has.
 
Level 12
Joined
Mar 24, 2011
Messages
1,082
Tbh, will that even work? I always thought that the event "Unit manipulates an item" works only for when you actually manipulate the item by removing it from inventory, to different backpack slot, etc.


Mmm... Hmm... Well... there is no event "a unit manipulates an item" there are "a unit loses an item" for when an item is "removed" from inventory and "a unit acquires an item"... but Idk if "Item being manipulated" answers to "Unit uses an item" or only for the 2 others...

Well there are a lot of cases where you can say "Blizzard logic !".

And I believe the stuff with items is one of them as it rarely works as I want it to or I think it should. Abilities are much more straightforward and easy to work with. Maybe they are the easiest to work with. At least I think so.
 
Level 2
Joined
Nov 25, 2013
Messages
15
He wanted to activate the trigger by clicking on the item (I guess right-clicking). If that is the case, you could create your own custom ability, which will be used by that item exclusively (based off the hero "Channel" ability, as that ability does nothing).

Then you actually make an event "Unit starts the effect of an ability" and check if the ability being cast is the ability the item (= sword) has.

Awesome, that helps me massively in another trigger I was having difficulty with, thankyou
 
Status
Not open for further replies.
Top