• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Trigger] Drop items of Same Type

Status
Not open for further replies.
Level 5
Joined
Apr 11, 2011
Messages
107
im having troubles getting this trigger to work. ive done a search, but no luck.

the trigger is supposed to drop the current item of type if you pick up a different one.

example: hero picks up item type: artifact1. if there is an item type: artifact in heroes inventory, drop item type: artifact2 and pick up item type: artifact1

is there perhaps another way to do this? say, make some sort of variable with an array. so right handed weapons could be... item[1], left handed weapons item[2], shields item[3], ect ect item[ect..]


side note: why wont it add a skill to my unit when he acquires an item, then remove it when he loses the item?

the maps below, feel free to laugh at my attempts :p
 

Attachments

  • RPG.w3x
    1.2 MB · Views: 48
Level 10
Joined
May 28, 2011
Messages
455
I suggest you learn jass... there are many leaks... and will definitely solve your problem...

Btw, to do that, all you need is to arrange the unit order.

The unit is issued a target order
The target is item
Check the item type (Yes, make an index for attachment type) i prefer hashtable
If it is the same, order drop carried item, take the targeted item (or give item type to the issued unit and remove the item from game)

goodluck.
 
Level 5
Joined
Apr 11, 2011
Messages
107
Any chance you could give me an example/template. I have no idea how to do hashtables/checks
 
Level 10
Joined
May 28, 2011
Messages
455
Tutorial is your best friend. Take your time learning instead of solving the problems. GUI Tutorials It will hasten your progress...

Anyway, i will give you the idea of hashtable. Hashtable is the same as 2 dimension array. for example, a2dArray[*number][*number]... Instead of the [*number][*number]... It is parent key (integer number) and child key (integer number)... nothing so different right.

So, this is similar..
set a2dArray[1][2] = 3 ---- > i havent seen anyone use 2d in jass. maybe it does not exist. well, this is just an example.

call SaveInteger( hashtableName, 1, 2, 3)
 
Level 5
Joined
Apr 11, 2011
Messages
107
it could just be the late hour, but im having a hell of a time getting this. thanks for you help, ill look into it and try to figure out whats what. atleast now ive got a starting point :)
 
Level 15
Joined
Jan 27, 2007
Messages
948
this post is really old but just in case you still need it... here's the trigger:

  • Double Weapon
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • (Item-class of (Item being manipulated)) Equal to Artifact
    • Actions
      • For each (Integer A) from 1 to 6, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Item carried by (Hero manipulating item) in slot (Integer A)) Not equal to (Item being manipulated)) and ((Item-class of (Item carried by (Hero manipulating item) in slot (Integer A))) Equal to Permanent)
            • Then - Actions
              • Unit - Order (Hero manipulating item) to drop (Item carried by (Hero manipulating item) in slot (Integer A)) at (Position of (Hero manipulating item))
            • Else - Actions
              • Do nothing
 
Level 17
Joined
Nov 13, 2006
Messages
1,814
Any chance you could give me an example/template. I have no idea how to do hashtables/checks

i got template for this in signature, and i stored everything to variable, kinda longer work but i think worth/

in my case i give to every equipable item different item level then in arrays the index is the item level

so example

Item_ReqLevel[item level] = 5

so if my armor got lv100 item level then look like this

Item_ReqLevel[100] = 5

and this way u can categoryze the items too or do what u want
 
Status
Not open for further replies.
Top