HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Item Limits and More

06-05-2004, 11:52 PM#1
linkmaster23
Yea, a friend of mine asked me for help. In a desparate attempt for an answer. As he asked the forum several times for an answer. So I am asking for him.

Quote:
I need a trigger that limits heroes to one item of a certain class, such as one weapon, one shield, etc. I can limit heroes to one item of every class, but what I need the trigger to do is restrict say shields, armor, helms to one item of each of those classes, and allow only 2 jewelries, and 3 accessories. I would like to stick with the HP system.

Answer it please.
06-06-2004, 12:38 AM#2
johnfn
Quote:
Originally Posted by linkmaster23
Yea, a friend of mine asked me for help. In a desparate attempt for an answer. As he asked the forum several times for an answer. So I am asking for him.



Answer it please.
Hmm, not too hard.

Code:
Item System
	Events
		Unit - A unit Acquires an item
	Conditions
	Actions
		For each (Integer A) from 1 to 6, do (Actions)
			Loop - Actions
				If ((Item-class of (Item carried by (Hero manipulating item) in slot (Integer A))) Equal to [b]Powerup[/b]) then do (Set count = (count + 1)) else do (Do nothing)
		If (count Greater than 1) then do (Hero - Drop (Item being manipulated) from (Hero manipulating item)) else do (Do nothing)
 
		For each (Integer A) from 1 to 6, do (Actions)
			Loop - Actions
				If ((Item-class of (Item carried by (Hero manipulating item) in slot (Integer A))) Equal to [b]Perminant[/b]) then do (Set count = (count + 1)) else do (Do nothing)
		If (count Greater than 1) then do (Hero - Drop (Item being manipulated) from (Hero manipulating item)) else do (Do nothing)
 
...

Just replace the bold word with the class types.

...You mentioned (he mentioned, really) that some things should be no more than 3, or whatnot. In that case, change the number where it says (count Greater then #).

At least, I think that's what you want. Thats the only item-class comparison I could find.
06-06-2004, 02:30 AM#3
weaaddar
you could always do use my DT4a its built pretty much on the idea of restrictions...
06-06-2004, 12:57 PM#4
linkmaster23
PLease stop advertizing you SYSTEM! People don't always like using something that is pure JASS and has nothing to do with he question! GEEZ!
06-06-2004, 01:49 PM#5
weaaddar
Um the system works for ITEM RESTRICTIONS. Thats why it was built, the above trigger is tedious and doesn't work properly, DT4a has been abused to be tested.

I don't understand how you can call it advertiseing as you do the same crap when ever you made something and point a link to it when ever anyone asks a question about it...

Is saying lookin in teh FAQ advertiseing?
06-06-2004, 02:04 PM#6
LegolasArcher
You asked how it could be done. He gave an answer. If you don't like it, make one better. You also never said JASS couldn't be used, nor that you did want a system. I'd hardly call pointing to his work, when it is relevent advertising. Also, what does he gain from getting more downloads? He's not getting payed for this.

I've seen weadder's work, and you should really consider it. It does do what your asking for, and he might find some of the other features useful.
06-10-2004, 06:28 AM#7
Gliver
Ok but can u do the same in normal triggers(without JASS)?? i dont where to copy custom scripts, what to do with item arrays....
06-10-2004, 07:29 PM#8
AntJAB
I played with something similar, though not as thick.
I limited units to carrying only one weapon, one armor, and one jewlery.

I set weapons to 1, armors to 2, and jewleries to 4.
I limited it with a very basic trigger.
W = 1
A = 2
W+A = 1+2 = 3
J = 4
W+J = 1+4 = 5
A+J = 2+4 = 6
W+A+J = 1+2+4 = 7

If a hero tried to equip a weapon, it would check the hero's custom points.
If it was 1, 3, 5, or 7 it would not let him equip the weapon.
If it wasn't any of those number it would let him equip and add 1 to his custom points.

You are asking for something for complicated, but it just means more numbers.
One number for each jewlery, etc.
06-10-2004, 09:43 PM#9
-={tWiStÄr}=-
wow.. thats pretty smart :D but you would have to make sure u have numbers that will always work and never duplicate an answer.
06-10-2004, 11:13 PM#10
weaaddar
well I used a bit flagging system in DT4a only I did it a little bit more clever I found out which bits were actually enabled.
Decoding an int isn't hard at all. I stole peppars function only because it was so compact.
Code:
function DecodeInt takes integer bf, integer bit_num returns boolean
    return ModuloInteger(bf / R2I(Pow(2, bit_num)), 2) == 1 
endfunction
You really can't beat that for conserving size. I used it for a different purpose to allow me to have items with multiple categories and allow me to determine which slot the item could go into. So items with values of 1, 2, 4, 8, 16 would be slot one through five respectively, but If an item had a value of 6 for instance it would mean it was a slot 2 and 4 item.
It was really a neat system for its time I think.
06-11-2004, 02:11 PM#11
AntJAB
It seems that witha ll this info, you should be able to whip something up. :)
06-11-2004, 08:43 PM#12
Vexorian
I actually made a really nice, and totally ignored system for this that can be configured in GUI. http://www.wc3campaigns.com/showthread.php?t=42798

and weaaddar spent too much time in his system, let him do that , it allows a lot of stuff, and you don't really need to know JASS that much, just to know how to type
06-11-2004, 09:15 PM#13
SektorGaza
i suggest, if you really don't want to look into weaddars system. do something like johnfn, but only with item lvls

for example, it easy to set item level in item editor
so have weapons lvl 1, shields lvl 2, helmet lvl 3, etc etc.
or whatever classes you have

and then as units aquires an item check first what lvl it is..

event: unit aquires item

condition: none

action:
local unit hero= hero that is manipulating the item
loop from 1 to 6
if in slot (loop variable) of hero item level == level of item being manipulated then
drop the item being manipulated
enter some text for player("no, you already got this item class")
end loop


something like that
06-11-2004, 09:21 PM#14
Vexorian
Levels would make item dropping more difficult, the same if you use classification, mine is better actually