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

Equipment System Trigger

Status
Not open for further replies.
Level 10
Joined
Mar 25, 2010
Messages
187
Hi, am making a rather simple equipment system, all that should happen is is the item drops when you're already carrying one of the same type (i.e. a Shield )

There'll be some other things in later, like Stat requirements but for now i'm just trying to get this working.
Anyhow, i've probably done alot more wrong then i think i did but here it is anyway.

  • Events
    • Unit - A unit Acquires an item
  • Conditions
    • (Item-class of (Item being manipulated)) Equal to Miscellaneous
  • Actions
    • Set MainHandCheck = (MainHandCheck + 1)
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • MainHandCheck Not equal to 1
      • Then - Actions
        • Hero - Drop (Item being manipulated) from (Triggering unit)
      • Else - Actions
        • Do nothing
The idea was to have weapons of certain types belong to different item classes ( for example, weapons are Miscellaneous, armour pieces are Artefacts etc )
Then i hoped i could check what type it is and go from there on out.
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
http://www.hiveworkshop.com/forums/...-279/ids-infinite-number-item-classes-162448/.
That tutorial nicely explains a good way to do this.

If you somehow need something else, or cannot do it, leave a message here and I'll try to make an easy system for you.

Edit: what you've done wrong:
  • Don't use "Do Nothing", it calls a function that doesn't do anything. One of the main rules about computers is that they don't do anything unless they're told to do something. If you just delete the action, it won't do anything either.
  • You should move "MainHandCheck" to right below the "Hero - drop (item)" (inside the if/then/else), and set it to 1 instead (always).
  • Then you should change the condition to "if MainHandCheck equal to 0".
 
Level 10
Joined
Mar 25, 2010
Messages
187
I don't think i fully understood what you meant there, is there anything in particular i need to place at the Else actions?

Here's what i ended up with

  • Events
    • Unit - A unit Acquires an item
  • Conditions
    • (Item-class of (Item being manipulated)) Equal to Miscellaneous
  • Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • MainHandCheck Equal to 0
      • Then - Actions
        • Hero - Drop (Item being manipulated) from (Triggering unit)
        • Set MainHandCheck = 1
      • Else - Actions
        • Hero - Give (Item being manipulated) to (Triggering unit)
 
Level 4
Joined
Jun 23, 2011
Messages
70
Oh, haha, wait a sec. I'm an idiot.

  • Events
    • Unit - A unit Acquires an item
  • Conditions
    • (Item-class of (Item being manipulated)) Equal to Miscellaneous
  • Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • MainHandCheck Equal to 1
      • Then - Actions
        • Hero - Drop (Item being manipulated) from (Triggering unit)
      • Else - Actions
        • Set MainHandCheck = 1
 
Level 4
Joined
Jun 23, 2011
Messages
70
Look, basically, what you're saying to the computer is:

When a hero picks up an item, if the item has a classification of 'misc', check the variable 'MainHandCheck'. If the 'MainHandCheck' is already set to 1, then drop the item in question. If 'MainHandCheck is not equal to 1, then set it to 1 and do nothing else.

Check:
- Make sure that the item your hero is picking up is classified as 'misc'.
- Make sure that you're calling the correct item.
- Make sure that your 'MainHandCheck' is the correct variable to be calling, because personally if I was making a system for this, 'MainHandCheck' would be the variable I'd use to check for a primary weapon (sword, axe, etc), not a misc item, such as an amulet or ring.
- Make sure that 'MainHandCheck' is an integer variable.

If you send me a copy of the map, I'll fix it for you.
 
Status
Not open for further replies.
Top