Issue with splitting and combining items!

Level 11
Joined
Jun 20, 2017
Messages
380
I have these triggers that crashes!
It basically splits and combines items!
And I have a toggle ability that can split or combine them!
Which I think it is because of Tasyen system that I messed up somewhere! not sure!
Combining Items of the same type.
  • Crown of Kings
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to Mask of Death
    • Actions
      • -------- Loop inventory of Hero --------
      • For each (Integer A) from 1 to 6, do (Actions)
        • Loop - Actions
          • -------- Is the ItemType at Slot 1/2/3/4/5/6 =the same as the gained? --------
          • -------- But not the gained --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Item-type of (Item carried by (Triggering unit) in slot (Integer A))) Equal to Mask of Death
              • (Item carried by (Triggering unit) in slot (Integer A)) Not equal to (Item being manipulated)
            • Then - Actions
              • Item - Remove (Item carried by (Triggering unit) of type Mask of Death)
              • Hero - Create Crown of Kings +5 and give it to (Triggering unit)
              • Hero - Create Crown of Kings +5 and give it to (Triggering unit)
              • -------- --------
              • Special Effect - Create a special effect attached to the origin of (Triggering unit) using Abilities\Spells\Items\AIem\AIemTarget.mdl
              • Special Effect - Destroy (Last created special effect)
              • -------- End THis Trigger --------
              • Skip remaining actions
            • Else - Actions
  • Mask of Death
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to Crown of Kings +5
    • Actions
      • -------- Loop inventory of Hero --------
      • For each (Integer A) from 1 to 6, do (Actions)
        • Loop - Actions
          • -------- Is the ItemType at Slot 1/2/3/4/5/6 =the same as the gained? --------
          • -------- But not the gained --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Item-type of (Item carried by (Triggering unit) in slot (Integer A))) Equal to Crown of Kings +5
              • (Item carried by (Triggering unit) in slot (Integer A)) Not equal to (Item being manipulated)
            • Then - Actions
              • Item - Remove (Item carried by (Triggering unit) of type Crown of Kings +5)
              • Item - Remove (Item carried by (Triggering unit) of type Crown of Kings +5)
              • Hero - Create Mask of Death and give it to (Triggering unit)
              • -------- --------
              • Special Effect - Create a special effect attached to the origin of (Triggering unit) using Abilities\Spells\Items\AIem\AIemTarget.mdl
              • Special Effect - Destroy (Last created special effect)
              • -------- End THis Trigger --------
              • Skip remaining actions
            • Else - Actions
  • Fuse Same Items init
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set VariableSet FSI_Index = -1
      • -------- --------
      • -------- Ring of the Hell Lords --------
      • Set VariableSet FSI_Index = (FSI_Index + 1)
      • Set VariableSet FSI_Amount[FSI_Index] = 2
      • Set VariableSet FSI_Material[FSI_Index] = Ring of the Hell Lords
      • Set VariableSet FSI_Target[FSI_Index] = Vampiric Ring
      • -------- --------
      • -------- Next item --------
      • -------- Demonic Remains --------
      • Set VariableSet FSI_Index = (FSI_Index + 1)
      • Set VariableSet FSI_Amount[FSI_Index] = 2
      • Set VariableSet FSI_Material[FSI_Index] = Demonic Remains1
      • Set VariableSet FSI_Target[FSI_Index] = Vladimir's Remains
      • -------- --------
      • Set VariableSet FSI_Index = (FSI_Index + 1)
      • Set VariableSet FSI_Amount[FSI_Index] = 2
      • Set VariableSet FSI_Material[FSI_Index] = Demonic Remains2
      • Set VariableSet FSI_Target[FSI_Index] = Vladimir's Remains
      • -------- --------
      • Set VariableSet FSI_Index = (FSI_Index + 1)
      • Set VariableSet FSI_Amount[FSI_Index] = 2
      • Set VariableSet FSI_Material[FSI_Index] = Demonic Remains3
      • Set VariableSet FSI_Target[FSI_Index] = Vladimir's Remains
  • Fuse Same Items
    • Events
      • Unit - A unit Acquires an item
      • Unit - A unit Uses an item
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Item-type of (Item being manipulated)) Equal to Ring of the Hell Lords
          • (Item-type of (Item being manipulated)) Equal to Demonic Remains1
          • (Item-type of (Item being manipulated)) Equal to Demonic Remains2
          • (Item-type of (Item being manipulated)) Equal to Demonic Remains3
    • Actions
      • Set VariableSet FSI_ItemType = (Item-type of (Item being manipulated))
      • Set VariableSet FSI_Counter = 0
      • -------- --------
      • -------- Loop inventory of Hero --------
      • For each (Integer A) from 1 to 6, do (Actions)
        • Loop - Actions
          • -------- Is the ItemType at Slot 1/2/3/4/5/6 = the same as the gained? --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Item-type of (Item carried by (Triggering unit) in slot (Integer A))) Equal to FSI_ItemType
            • Then - Actions
              • -------- Yes increase Counter for each found type --------
              • Set VariableSet FSI_Counter = (FSI_Counter + 1)
            • Else - Actions
      • -------- --------
      • For each (Integer B) from 0 to FSI_Index, do (Actions)
        • Loop - Actions
          • -------- Find the Right Fusion and check if needed amount of Mats is available --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • FSI_ItemType Equal to FSI_Material[(Integer B)]
              • FSI_Counter Greater than or equal to FSI_Amount[(Integer B)]
            • Then - Actions
              • -------- Fuse --------
              • -------- Amount of items to destroy --------
              • Set VariableSet FSI_Counter = FSI_Amount[(Integer B)]
              • -------- --------
              • -------- Destroy and Count down --------
              • 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-type of (Item carried by (Triggering unit) in slot (Integer A))) Equal to FSI_ItemType
                      • FSI_Counter Greater than 0
                    • Then - Actions
                      • Set VariableSet FSI_Counter = (FSI_Counter - 1)
                      • Item - Remove (Item carried by (Triggering unit) in slot (Integer A))
                    • Else - Actions
              • Hero - Create FSI_Target[(Integer B)] and give it to (Triggering unit)
              • -------- --------
              • Special Effect - Create a special effect attached to the origin of (Triggering unit) using Abilities\Spells\Items\AIem\AIemTarget.mdl
              • Set VariableSet LastCreatedSpecialEffect = (Last created special effect)
              • Special Effect - Destroy LastCreatedSpecialEffect
            • Else - Actions
 
Last edited:

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,866
Just looking at the first Spoiler triggers, you can avoid at least one crash by having the creation of the Items occur after the For Loop is finished.

Something like this seems to work:
  • Mask
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to Mask of Death
    • Actions
      • Set VariableSet Fuse_Hero = (Triggering unit)
      • Set VariableSet Fuse_Item_Rewards[1] = (Item-type of No item)
      • Set VariableSet Fuse_Item_Rewards[2] = (Item-type of No item)
      • For each (Integer Fuse_Slot) from 1 to 6, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Fuse_Item_Rewards[1] Equal to (Item-type of No item)
              • (Item-type of (Item carried by Fuse_Hero in slot Fuse_Slot)) Equal to Mask of Death
              • (Item carried by Fuse_Hero in slot Fuse_Slot) Not equal to (Item being manipulated)
            • Then - Actions
              • Set VariableSet Fuse_Item_Rewards[1] = Crown of Kings +5
              • Set VariableSet Fuse_Item_Rewards[2] = Crown of Kings +5
              • -------- Remove AFTER setting Rewards: --------
              • Item - Remove (Item carried by Fuse_Hero of type Mask of Death)
            • Else - Actions
      • Hero - Create Fuse_Item_Rewards[1] and give it to Fuse_Hero
      • Hero - Create Fuse_Item_Rewards[2] and give it to Fuse_Hero
  • Crown
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to Crown of Kings +5
    • Actions
      • Set VariableSet Fuse_Hero = (Triggering unit)
      • Set VariableSet Fuse_Item_Rewards[1] = (Item-type of No item)
      • Set VariableSet Fuse_Item_Rewards[2] = (Item-type of No item)
      • For each (Integer Fuse_Slot) from 1 to 6, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Fuse_Item_Rewards[1] Equal to (Item-type of No item)
              • (Item-type of (Item carried by Fuse_Hero in slot Fuse_Slot)) Equal to Crown of Kings +5
              • (Item carried by Fuse_Hero in slot Fuse_Slot) Not equal to (Item being manipulated)
            • Then - Actions
              • Set VariableSet Fuse_Item_Rewards[1] = Mask of Death
              • -------- Remove AFTER setting Rewards: --------
              • Item - Remove (Item carried by Fuse_Hero of type Crown of Kings +5)
              • Item - Remove (Item carried by Fuse_Hero of type Crown of Kings +5)
            • Else - Actions
      • Hero - Create Fuse_Item_Rewards[1] and give it to Fuse_Hero
      • Hero - Create Fuse_Item_Rewards[2] and give it to Fuse_Hero
Edit: Fixed a bug with Skip remaining actions. Updated a better map, see my 2nd post.
 
Last edited:
Level 11
Joined
Jun 20, 2017
Messages
380
Thanks, for some reason it didn't work in actions but it did in ITE action!
There is a problem that if I split the mask, it gives me 1 crown instead of 2!
  • Mask to Crown 2
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Fuse Item Toggle [Custom] Item
    • Actions
      • Set VariableSet Fuse_Hero = (Triggering unit)
      • Set VariableSet Fuse_Item_Rewards[1] = (Item-type of No item)
      • Set VariableSet Fuse_Item_Rewards[2] = (Item-type of No item)
      • -------- --------
      • For each (Integer Fuse_Slot) from 1 to 6, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Item-type of (Item carried by Fuse_Hero in slot Fuse_Slot)) Equal to Mask of Death
              • (Item carried by Fuse_Hero in slot Fuse_Slot) Not equal to (Item being manipulated)
            • Then - Actions
              • Set VariableSet Fuse_Item_Rewards[1] = Crown of Kings +5
              • Set VariableSet Fuse_Item_Rewards[2] = Crown of Kings +5
              • -------- --------
              • -------- Remove AFTER setting Rewards: --------
              • Item - Remove (Item carried by Fuse_Hero of type Mask of Death)
              • -------- --------
              • Hero - Create Fuse_Item_Rewards[1] and give it to Fuse_Hero
              • Hero - Create Fuse_Item_Rewards[2] and give it to Fuse_Hero
              • -------- --------
              • Special Effect - Create a special effect attached to the origin of Fuse_Hero using Abilities\Spells\Items\AIem\AIemTarget.mdl
              • Special Effect - Destroy (Last created special effect)
              • Skip remaining actions
            • Else - Actions
  • Crown to Mask
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to Crown of Kings +5
    • Actions
      • Set VariableSet Fuse_Hero = (Triggering unit)
      • Set VariableSet Fuse_Item_Rewards[1] = (Item-type of No item)
      • Set VariableSet Fuse_Item_Rewards[2] = (Item-type of No item)
      • -------- --------
      • For each (Integer Fuse_Slot) from 1 to 6, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Item-type of (Item carried by Fuse_Hero in slot Fuse_Slot)) Equal to Crown of Kings +5
              • (Item carried by Fuse_Hero in slot Fuse_Slot) Not equal to (Item being manipulated)
            • Then - Actions
              • Set VariableSet Fuse_Item_Rewards[1] = Mask of Death
              • -------- --------
              • -------- Remove AFTER setting Rewards: --------
              • Item - Remove (Item carried by Fuse_Hero of type Crown of Kings +5)
              • Item - Remove (Item carried by Fuse_Hero of type Crown of Kings +5)
              • -------- --------
              • Hero - Create Fuse_Item_Rewards[1] and give it to Fuse_Hero
              • -------- --------
              • Special Effect - Create a special effect attached to the origin of Fuse_Hero using Abilities\Spells\Items\AIem\AIemTarget.mdl
              • Special Effect - Destroy (Last created special effect)
              • Skip remaining actions
            • Else - Actions
 

Attachments

  • Fuse Items 1.w3m
    19.3 KB · Views: 8

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,866
I see, the Skip Remaining Actions was skipping the end results. Anyway, I think I understand what you're trying to do now. Try this instead:
  • Fuse 2x Masks To 2x Crowns
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Fuse Item Toggle [Custom] Item
    • Actions
      • Set VariableSet Fuse_Hero = (Triggering unit)
      • Set VariableSet Fuse_Count = 0
      • -------- --------
      • For each (Integer Fuse_Slot) from 1 to 6, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Fuse_Count Less than 2
              • (Item-type of (Item carried by Fuse_Hero in slot Fuse_Slot)) Equal to Mask of Death
            • Then - Actions
              • Set VariableSet Fuse_Count = (Fuse_Count + 1)
            • Else - Actions
      • -------- --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Fuse_Count Equal to 2
        • Then - Actions
          • Special Effect - Create a special effect attached to the origin of Fuse_Hero using Abilities\Spells\Items\AIem\AIemTarget.mdl
          • Special Effect - Destroy (Last created special effect)
          • -------- --------
          • Item - Remove (Item carried by Fuse_Hero of type Mask of Death)
          • -------- --------
          • Hero - Create Crown of Kings +5 and give it to Fuse_Hero
          • Hero - Create Crown of Kings +5 and give it to Fuse_Hero
        • Else - Actions
  • Combine 2x Crowns to 1x Mask
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to Crown of Kings +5
    • Actions
      • Set VariableSet Fuse_Hero = (Triggering unit)
      • Set VariableSet Fuse_Count = 0
      • -------- --------
      • For each (Integer Fuse_Slot) from 1 to 6, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Fuse_Count Less than 2
              • (Item-type of (Item carried by Fuse_Hero in slot Fuse_Slot)) Equal to Crown of Kings +5
            • Then - Actions
              • Set VariableSet Fuse_Count = (Fuse_Count + 1)
            • Else - Actions
      • -------- --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Fuse_Count Equal to 2
        • Then - Actions
          • Special Effect - Create a special effect attached to the origin of Fuse_Hero using Abilities\Spells\Items\AIem\AIemTarget.mdl
          • Special Effect - Destroy (Last created special effect)
          • -------- --------
          • Item - Remove (Item carried by Fuse_Hero of type Crown of Kings +5)
          • Item - Remove (Item carried by Fuse_Hero of type Crown of Kings +5)
          • -------- --------
          • Hero - Create Mask of Death and give it to Fuse_Hero
        • Else - Actions
 

Attachments

  • Fuse Items 2.w3m
    18.8 KB · Views: 1
Level 11
Joined
Jun 20, 2017
Messages
380
I try to do this
Split 1x Masks To 2x Crowns
Combine 2x Crowns to 1x Mask

The combination works well, but the division...!
Something weird is happening here!
If I don't use the Casting unit, it won't work at all!
And it randomly spawn items somewhere and does not give them to the hero!
Let's say what if I have more than 1 mask in my inventory then what? Does it split the first mask?
  • Split 1x Masks To 2x Crowns
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Split Item Toggle [Custom] Item
    • Actions
      • Set VariableSet SplitItem_Hero = (Triggering unit)
      • Set VariableSet Fuse_Count = 0
      • -------- --------
      • For each (Integer Fuse_Slot) from 1 to 6, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Fuse_Count Less than 2
              • (Item-type of (Item carried by SplitItem_Hero in slot Fuse_Slot)) Equal to Mask of Death
            • Then - Actions
              • Set VariableSet Fuse_Count = (Fuse_Count + 1)
            • Else - Actions
      • -------- --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Fuse_Count Equal to 1
        • Then - Actions
          • Special Effect - Create a special effect attached to the origin of SplitItem_Hero using Abilities\Spells\Items\AIem\AIemTarget.mdl
          • Special Effect - Destroy (Last created special effect)
          • -------- --------
          • Item - Remove (Item carried by (Casting unit) of type Mask of Death)
          • -------- --------
          • Hero - Create Crown of Kings +5 and give it to (Casting unit)
          • Hero - Create Crown of Kings +5 and give it to (Casting unit)
          • -------- --------
          • Item - Create Crown of Kings +5 at (Position of (Casting unit))
          • Item - Create Crown of Kings +5 at (Position of (Casting unit))
        • Else - Actions

Also I found this system of yours, they are almost the same but work for the recipes, maybe you can edit it to work for the same type of items? And splinting?
[Trigger] - Item System Not Working

Edit,
I guess I'll have to stick with this for now!
  • Split 1x Masks To 2x Crowns
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Split Item [Custom] Item
    • Actions
      • Set VariableSet Fuse_Hero = (Triggering unit)
      • -------- --------
      • For each (Integer Fuse_Slot) from 1 to 6, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Item-type of (Item carried by Fuse_Hero in slot Fuse_Slot)) Equal to Mask of Death
            • Then - Actions
              • Item - Remove (Item carried by Fuse_Hero of type Mask of Death)
              • -------- --------
              • Item - Create Crown of Kings +5 at (Position of (Triggering unit))
              • Item - Create Crown of Kings +5 at (Position of (Triggering unit))
              • -------- --------
              • Special Effect - Create a special effect attached to the origin of Fuse_Hero using Abilities\Spells\Items\AIem\AIemTarget.mdl
              • Special Effect - Destroy (Last created special effect)
            • Else - Actions
 

Attachments

  • Fuse Items 2.w3m
    19.3 KB · Views: 2
Last edited:
Top