Warcraft III resources & community, 2003–2006 · archived

Only 1 weapon type aloud...

5 posts
#1

Only 1 weapon type aloud...

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... =/
#2
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.
#3
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?
#4
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.
#5
Thank you guys so much!