• 🏆 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!
  • ✅ HD Level Design Contest #1 POLL is now OPEN! Check out the stunning visuals of the final entries. 🔗Click here to cast your vote!

[Trigger] Attachments

Status
Not open for further replies.
Level 8
Joined
Sep 18, 2008
Messages
298
Howdy. Im makin a hero defense map with a lil twist, and that is everytime you pick up a item, it reflects onto your hero. I found help to make it so you can only have 1 shield, 1 chest piece, 1 helmet, 1 two handed weapon, 1 one handed weapon, or 2 one handed weapons. Only problem is, when the units equip a one handed sword, and another one handed sword, there both on the same hand and it makes it rather disgusting! Im not sure how to fix this, and i want the item system to be similiar to "Unholy Invasion". ANy help would be appreciated!
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
I shouldnt make a map because im not familiar with making boolean comparions?

He's just saying that if boolean comparisons aren't familiar to you, it may lead one to believe you're not very experienced triggerer, or map maker in general. So you're probably doing your first or one of the first maps. That usually means the map might not be that good. The first few maps rarely are. I hope you can create something awesome...

your a joke.

Now that is funny.
 
Level 2
Joined
Jul 17, 2009
Messages
27
A boolean is a true / false statement. You want to create a means of recording (in JASS) whether a unit has equipped an item in the right hand, or left had. Then, when he picks up a second item, you can attach it to the other hand.

Programming is mostly logic, and you'll need to look at the systems you have in place in order to decide the best way to determine item handiness. Examples:

(vJASS)

Each unit has its own data structure, that lists the items it is carrying. CustomUnitData points to each unit's own struct. When a unit picks up a new item, compare it to the data structure to decide what should happen with the new item.

(JASS)

All one-handed weapons are kept in an array. When wielded, the item's position in the array is marked such that you can determine whether it was picked up one or two handed. When a second item is picked up, put it in the opposite hand to any existing one-handed weapon.
 
Level 20
Joined
Oct 21, 2006
Messages
3,231
You create a new boolean variable called IHASITEM[#]. Every time when a hero pick ups an item you set IHASITEM[playernumber] to true and every time when the trigger is run you check if IHASITEM[playerumber] is true, if it is true, you order hero to drop the item and display a message "no can has more". Also you need a trigger where hero drops item and then you set IHASITEM[#] to false.

Ofcourse this isnt possible if you dont know what is a variable.
 
Level 8
Joined
Sep 18, 2008
Messages
298
You create a new boolean variable called IHASITEM[#]. Every time when a hero pick ups an item you set IHASITEM[playernumber] to true and every time when the trigger is run you check if IHASITEM[playerumber] is true, if it is true, you order hero to drop the item and display a message "no can has more". Also you need a trigger where hero drops item and then you set IHASITEM[#] to false.

Ofcourse this isnt possible if you dont know what is a variable.

For my system i want the hero to be able to hold 2 one handed weapons. So if i already have a one handed weapon in my right hand, i want to be able to equip another one handed sword, and put it in my left hand
 
Level 11
Joined
Apr 6, 2008
Messages
760
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • HasWeapon[(Player number of (Owner of (Triggering unit)))] Equal to False
    • Then - Actions
      • -------- Create attachment in right hand --------
      • Set HasWeapon[(Player number of (Owner of (Triggering unit)))] = True
    • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • HasWeapon2[(Player number of (Owner of (Triggering unit)))] Equal to False
        • Then - Actions
          • -------- Create attachment in other hand --------
          • Set HasWeapon2[(Player number of (Owner of (Triggering unit)))] = True
        • Else - Actions
Not very effective but it do the job...
 
Status
Not open for further replies.
Top