HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Trigger-move item in inventory (GUI)

10-11-2007, 12:16 AM#1
SkriK
This is just an example trigger of how i'd like it to be:
Trigger:
Collapse Events
Unit - A unit Acquires an item
Collapse Conditions
(Item-class of (Item Being Manipulated)) Equal to Miscellaneous
Here comes the made up part:
Trigger:
Actions
Collapse If - Conditions
Item - item being manipulated is placed in slot 1 or 2
Collapse Then - Actions
Item - move item being manipulated to slot 3 (matching condition = (slot is empty))

Is it possible with GUI? Sometimes it's feels so suffocating not to know JASS
10-11-2007, 12:54 AM#2
Anopob
If you want JASS, look in the tutorial sections. Tons of good stuff there, like this.

About your trigger, try this:

Trigger:
Item
Collapse Events
Unit - A unit Acquires an item
Collapse Conditions
(Item-class of (Item being manipulated)) Equal to Miscellaneous
Collapse Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
Collapse Or - Any (Conditions) are true
Collapse Conditions
(Item carried by (Triggering unit) in slot 1) Equal to (Item being manipulated)
(Item carried by (Triggering unit) in slot 2) Equal to (Item being manipulated)
(Item carried by (Triggering unit) in slot 3) Equal to No item
Collapse Then - Actions
Item - Remove (Item being manipulated)
Hero - Create (Item-type of (Item being manipulated)) and give it to (Triggering unit)
Else - Actions

EDIT: If you specifically want the item to be in Slot 3, and for some reason this doesn't give you the item in Slot 3, then I don't think there's a way unless you fill up the first 2 slots with dummy items, give the Slot 3 item, then remove the dummy items.
10-11-2007, 01:04 AM#3
SkriK
The look of that trigger, makes me think it'll make a repeating cycle and crash the game, but i'll try. And i've thought of the dummy thing, was wondering if there was a more concrete way to do it.
Thanks for your help.
10-11-2007, 05:24 AM#4
Chop_tomato
Trigger:
Item
Collapse Events
Unit - A unit Acquires an item
Collapse Conditions
(Item-class of (Item being manipulated)) Equal to Miscellaneous
Collapse Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
Collapse Or - Any (Conditions) are true
Collapse Conditions
(Item carried by (Hero manipulating item) in slot 1) Equal to (Item being manipulated)
(Item carried by (Hero manipulating item) in slot 2) Equal to (Item being manipulated)
(Item carried by (Hero manipulating item) in slot 3) Equal to No item
Collapse Then - Actions
Unit - Order (Hero manipulating item) to move (Item being manipulated) to inventory slot 3
Collapse Else - Actions
-------- Do Something --------

That should work.

...Tested it, doesn't work. I have no idea why not, but it just reminded me that I really need to learn jass, when simple gui triggers like this don't work. I'm not sure how to fix it, but the problem may be in "Equal to No Item", because when viewed in jass it shows "null" and I think that's more of a "doesn't exist" rather than an "empty".

Wow, this doesn't work either:

Trigger:
Item
Collapse Events
Unit - A unit Acquires an item
Collapse Conditions
(Item-class of (Item being manipulated)) Equal to Miscellaneous
Collapse Actions
Unit - Order (Hero manipulating item) to move (Item being manipulated) to inventory slot 3

Well.. I tried, sorry it didn't end up helping, item triggers in gui are stupid.
10-11-2007, 03:48 PM#5
Viper5030
Trigger:
Item
Collapse Events
Unit - A unit Acquires an item
Collapse Conditions
(Item-class of (Item being manipulated)) Equal to Miscellaneous
Collapse Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
Collapse Or - Any (Conditions) are true
Collapse Conditions
(Item being manipulated) Equal to (Item carried by (Triggering unit) in slot 1)
(Item being manipulated) Equal to (Item carried by (Triggering unit) in slot 2)
Collapse Then - Actions
Unit - Order (Triggering unit) to move (Item being manipulated) to inventory slot 3
Else - Actions


Hmm... got it working of the first try. I'm not sure why the example above didn't work. Note that the third condition mentioned above that makes sure an item is not in slot 3 before performing the item movement order is unnecessary, and it just won't move the item at all if there is an item there.
10-11-2007, 07:51 PM#6
Anopob
Yes, but that's because I think the OP wants the item in slot 3.
10-11-2007, 08:18 PM#7
Viper5030
Quote:
Originally Posted by Anopob
Yes, but that's because I think the OP wants the item in slot 3.

?
10-11-2007, 09:17 PM#8
Viper5030
I'm sorry, I think I confused everyone by referring to chop tomato's example as "the above example" in my post. I wasn't referring to my own trigger.

So, in short, the trigger I posted up above works flawlessly for me, even without using the condition that checks if an item is already in the 3rd slot before moving the picked up item there.
10-12-2007, 11:42 AM#9
Chop_tomato
Well, I noticed there's 2 differences in our triggers Viper, I used "Item carried by hero in slot equal to item" while you used "Item equal to item carried by hero in slot", and I used "Hero manipulating item" while you used "Triggering unit", so I assume one of those is the problem, as im pretty sure I tested my trigger without the "Item equal to No Item" part (thats how i eventually managed to get down to the last trigger in my post, although I don't know why it doesn't work, going to try again now).

Ok, I tried the exact same trigger you used and it didn't work. Are you using any WE mods?

Oooh, that reminds me, I'm using a one of those .txt files so I can have steeper cliffs, I'll go get rid of it and see if it works.

I checked the file, it didn't have anything to do with triggers or items in there but I got rid of it anyway, made a new map, checked the mod wasn't doing anything anymore, but the trigger still isn't working. Looks like it's learn jass or die for me...
10-12-2007, 01:17 PM#10
Toink
Trigger:
Trigger
Collapse Events
Unit - A unit Acquires an item
Collapse Conditions
(Item-class of (Item being manipulated)) Equal to Miscellaneous
Collapse Actions
Custom script: local unit u = GetManipulatingUnit()
Custom script: local item i = GetManipulatedItem()
Custom script: if UnitItemInSlot(1, u) == i ) or UnitItemInSlot(2,u) == 1 then
Custom script: call UnitDropItemSlotBJ( u, i, 3 )
Custom script: endif
Custom script: set u = null
Custom script: set i = null

Didn't bother to test this though
10-13-2007, 08:32 PM#11
ChaosWolfs
Try WE Unlimited. It extends the GUI database further than the regular WE.

If the examples are working above, change "hero manipulating item" to "triggering unit".
10-13-2007, 09:05 PM#12
TaintedReality
Edit: Ehh was confused, never mind =P. But, I'm pretty sure his problem is solved.
10-14-2007, 09:25 PM#13
SkriK
I went by Anopob's suggestion and used dummy items filling up the slots (if they were empty) it needed to skip. Thanks for all the help.