Stack Items

Mind

New Member
Reaction score
7
What is wrong with this trigger?

Code:
Events:
    Unit - A unit acquires an item
Conditions:
    (Charges remaining in (Item being manipulated) Greater than 0
Actions:
    Set ItemBeingManipulatedCharges = (Charges remaining in (Item being manipulated))
    Item - Remove (Item being manipulated)
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    If - Conditions
        ((Triggering unit) has an item of type (Item-type of (Item being manipulated)) Equal to True
    Then - Actions
        Item - Set charges remaining in (Items carried by (Triggering unit) of type (Item-type of (Item being manipulated)) to (Charges remaining in (Item carried by (Triggering unit) of type (Item-type of (Item being manipulated))) + ItemBeingManipulatedCharges
    Else - Actions
        Hero - Create (Item-type of (Item being manipulated)) and give it to (Triggering unit)
        Item - Set charges remaining in (Last created item) to ItemBeingManipulatedCharges

Unfortunately, the fact that the World Editor has no "Integer - Item - Items carried by hero of type" comparison forced me to make this matter very difficult and complicated.
 
W

w/e

Guest
well, before I can help you, I need to know what you're trying to do.
 

XXXconanXXX

Cocktails anyone?
Reaction score
284
I think I might have your answer. In the "Item - Set charges remaining in (Last created item) to ItemBeingManipulatedCharges", you have it set to "(Last created item)" which if you have another item that is created right BEEFORE that action then it'll screw it up and effect the other item.
 

Mind

New Member
Reaction score
7
There is, as I said,
no "Integer - Item - Items carried by hero of type" comparison.
Thus, I must remove the item which is manipulated
in order to see if the hero which acquired the item has another
item of the same type as the item which is manipulated.

If this is the case,
then the remaining charges of the item carried by the hero
which manipulated the item of the same type as the item
which is manipulated are set to the remaining charges in the item
which is manipulated plus the remaining charges in
the item carried by the hero which manipulated the item
of the same type as the item which is manipulated.

Heh. That last sentence was 359 characters long.

If this is not the case, then the item is recreated,
and its remaining charges are set to the same amount of remaining charges
the item which was manipulated contained before it was removed.

Do you undestand?
Me neither.
 

SD_Ryoko

Ultra Cool Member
Reaction score
85
First lets determine if 'set the ammount of charges' even works. Does it? If an item comes with 5 charges, can it go OVER five?

I see a massive error. Look at this.

"Items carried by (Triggering unit) of type (Item-type of (Item....."

Okay. This condition will ALWAYS be true, of COURSE, because he just picked UP an item of that type.

Your checking if he already has one in his inventory. Of COURSE he does. He just picked it up.

Then your calling the SAME function for setting charges, and removing the item.

Understand?
 

Mind

New Member
Reaction score
7
Please read the trigger code with more attention. The acquired item is removed first.
 

Mind

New Member
Reaction score
7
I now use a variable which stores the item-type of the item which is manipulated before it is removed, but it still doesn't work.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top