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

Only 1 weapon type aloud...

Status
Not open for further replies.
Level 3
Joined
Aug 29, 2005
Messages
33
Im trying to make it where you can only have 1 weapon type Example = Armor

I Already have everything down like the Artifact as weapon and everything, but i dont know the trigger to make it so you cannot pick up the same type if you have 1 already... =/
 
Level 5
Joined
Jun 17, 2006
Messages
114
try this:

events
a unit aquires an item

conditions
item class of (item being manipulated) equal to artifact
//assume artifact means weapon

actions
//cycle through the hero's inventory to count the number of items of that type
set num1(integer) = 0
for each integer A from 1 to 6
if (item class of (item carried in hero slot(for loop integer A)) equal to artifact then set num1 = num1 + 1
if (num1 greater than 1) then
//hero already has a weapon
hero - drop (item being manipulated) from (triggering unit)
game - display text message to player group(owner of triggering unit) "You already have a weapon."


hope this helps. i realize that it's a bit complex and probably not very clear so if you want me to explain any of the specifics feel free to ask.
 
Level 2
Joined
Jun 27, 2004
Messages
22
how to make more item classes than (for armor, gloves, accessory etc.) as you cant use the artifact class for them, because they are already for the weapons?
 
Level 5
Joined
Jun 17, 2006
Messages
114
well there are a few ways you could do it. the easiest way that i can think of off the top of my head would be to have the life of the item represent the item type. for example, if an item has 1 life then it is gloves, 2 is boots, 3 is armor, etc. so instead of checking which items are artifacts you'd do an integer comparison checking the life of the item. i would also recommend disabling attacks against items for player controlled units so people don't accidentally (or intentionally) destroy their beloved items.
 
Status
Not open for further replies.
Top