How to combine items of the same type?

REM.Shephard

New Member
Reaction score
0
Hi! I tried to make a trigger that combines items of the same type. For example, if you buy or pick a "Broadsword" and you already have a "Broadsword" in your inventory it will combine into "Broadsword +1." But my trigger doesn't work properly, because when I buy or pick an item it automatically tranforms into the same item +1 even if I don't have the same item in my inventory.
This is the trigger I made:

Combine item
Events
Unit - A unit acquires an item
Conditions
(Item-type of (Item being manipulated)) Equal to BROADSWORD
((Triggering unit) has an item of type BROADSWORD) Equal to True
Actions
Item - Remove (Item carried by (Triggering unit) of type BROADSWORD)
Item - Remove (Item carried by (Triggering unit) of type BROADSWORD)
Hero - Create BROADSWORD+1 and give it to (Triggering unit)

Thanks in advance.
 

Yoww89

New Member
Reaction score
0
The problem is the second condition in which you try to check if the unit already have one broadsword in the inventory.
It doesn't work because even when you acquire the first broadsword the condition will return true.
It's like this: you acquire a Broadsword > then the trigger will run > the condition will be true cause you just got one.

I know only one method to solve this, it's using a loop from 1 to 6 checking in each slot with you have a item of type broadsword AND if the item in that slot IS NOT the item being manipulated.

Maybe someone has a better solution ;s

If I helped you, what about giving me some rep? (I'm really dying to get my first rep x.x)
 

Happy

Well-Known Member
Reaction score
71
just use a loop from 1 to 6 and check whether the hero has an item equal to broadsword. if yes set an integer value +1. at the end check whether the integer value is equal to or greater than 2 and if yes remove the items and create the new one.
 

REM.Shephard

New Member
Reaction score
0
Uhm...that seems ok...but I don't know how to do it. Can someone put the whole trigger please? I'm still newbie at triggering (as well as speaking English). Thanks for your answers, guys.
 

jig7c

Stop reading me...-statement
Reaction score
123
get EGUI, there is a RecipeSYS in it which makes this job very very easy.... and its also in GUI
 

Happy

Well-Known Member
Reaction score
71
Code:
Combine item
Events
Unit - A unit acquires an item
Conditions
(Item-type of (Item being manipulated)) Equal to BROADSWORD
Actions
Set Int_Value(player number of (owner of triggering unit)) = 0
Loop from 1 to 6 (Integer A)
   if triggering unit has broadsword in slot Integer A
   then set Int_Value = Int_Value +1
           if Int_Value is equal to 2 
           then Item - Remove (Item carried by (Triggering unit) of type  
                   BROADSWORD)
                   Item - Remove (Item carried by (Triggering unit) of type 
                   BROADSWORD)
                   Hero - Create BROADSWORD+1 and give it to (Triggering unit)
          else 
  else

thats the code....its freehand but you should understand it...
 
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