• 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.

[GUI] Right Click Item Recipe 1.06

Right Click Item Recipes

Description
Item combination/recipe system that triggers when an item is dropped on another (right click item, click on another).
This limits the system to only 2 components for each recipe.

I couldn't find this exact system anywhere in the spells section, but I did find plenty of traditional recipe systems. So here we are.

  • MUI, will work for any hero/unit with an inventory
  • Disassembly ability that you can add to the hero or a forge-type unit
  • Option to allow disassembly when an item is dropped on itself
  • Option to have charged items add their charges together when combined

Due to the way it works, there is a small delay when combining. (the system compares the unit's inventory before and after an item has been targetted, a delay is necessary for changes to be registered)

Installation
1. Copy the Right Click Recipe System trigger category into your map, making sure the Automatically Create Unknown Variables is enabled on your editor.
2. Copy the Disassemble ability into your map, if you want to use it.
3. Configure the system as described in the RCR Config trigger

Triggers

  • RCR Config
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- -------------------------------------------------------------------------------- --------
      • -------- SYSTEM VARIABLES --------
      • -------- -------------------------------------------------------------------------------- --------
      • -------- Set the disassemble ability --------
      • Set RCR_DisassembleAbility = Disassemble
      • -------- Set the combine SFX --------
      • Set RCR_CombineSFX = Abilities\Spells\Items\AIam\AIamTarget.mdl
      • -------- Set the disassemble SFX --------
      • Set RCR_DisassembleSFX = Abilities\Spells\Items\AIfb\AIfbSpecialArt.mdl
      • -------- (for either SFX, set to nothing if you don't want an SFX) --------
      • -------- -------------------------------------------------------------------------------- --------
      • -------- SETTINGS --------
      • -------- -------------------------------------------------------------------------------- --------
      • -------- Show text when items combined/disassembled --------
      • Set RCR_ShowText = True
      • -------- Enabled/disable disassembly when an item is dropped on itself - delete the next line to disable --------
      • Trigger - Turn on RCR Disassemble RC <gen>
      • -------- -------------------------------------------------------------------------------- --------
      • -------- RECIPES --------
      • -------- -------------------------------------------------------------------------------- --------
      • -------- Set a recipe --------
      • Set RCR_SaveRecipeItemA = Claws of Attack +15
      • Set RCR_SaveRecipeItemB = Crown of Kings +5
      • Set RCR_SaveRecipeResult = Blood Key
      • Trigger - Run RCR SaveRecipe <gen> (ignoring conditions)
      • -------- -------------------------------------------------------------------------------- --------
      • -------- And another --------
      • Set RCR_SaveRecipeItemA = Kelen's Dagger of Escape
      • Set RCR_SaveRecipeItemB = Mask of Death
      • Set RCR_SaveRecipeResult = Sun Key
      • Trigger - Run RCR SaveRecipe <gen> (ignoring conditions)
      • -------- -------------------------------------------------------------------------------- --------
      • -------- And another --------
      • Set RCR_SaveRecipeItemA = Potion of Greater Healing
      • Set RCR_SaveRecipeItemB = Potion of Greater Mana
      • Set RCR_SaveRecipeResult = Replenishment Potion
      • -------- Set whether or not charges will be added together for this recipe --------
      • Set RCR_SaveAddCharges = True
      • Trigger - Run RCR SaveRecipe <gen> (ignoring conditions)
      • -------- -------------------------------------------------------------------------------- --------
  • RCR SaveRecipe
    • Events
    • Conditions
    • Actions
      • Custom script: set udg_RCR_SaveA = udg_RCR_SaveRecipeItemA
      • Custom script: set udg_RCR_SaveB = udg_RCR_SaveRecipeItemB
      • Custom script: set udg_RCR_SaveR = udg_RCR_SaveRecipeResult
      • -------- For combining --------
      • Hashtable - Save RCR_SaveR as RCR_SaveA of RCR_SaveB in RCR_CombineTable
      • Hashtable - Save RCR_SaveR as RCR_SaveB of RCR_SaveA in RCR_CombineTable
      • -------- For charges --------
      • Hashtable - Save RCR_SaveAddCharges as RCR_SaveR of RCR_SaveA in RCR_CombineTable
      • Hashtable - Save RCR_SaveAddCharges as RCR_SaveR of RCR_SaveB in RCR_CombineTable
      • -------- For disassembly --------
      • Hashtable - Save RCR_SaveA as (RCR_SaveR x -1) of (RCR_SaveR x -1) in RCR_CombineTable
      • Hashtable - Save RCR_SaveB as (RCR_SaveA x -1) of (RCR_SaveR x -1) in RCR_CombineTable
  • RCR Combine
    • Events
      • Unit - A unit Is issued an order targeting an object
    • Conditions
      • (Target item of issued order) Not equal to No item
    • Actions
      • Set tempUnit = (Triggering unit)
      • -------- null previous variables --------
      • Set RCR_SaveR = 0
      • Set RCR_SaveAddCharges = False
      • Set RCR_CombineItemA = No item
      • Set RCR_CombineItemB = No item
      • Custom script: set udg_LoopA = GetIssuedOrderId()-852001
      • Set RCR_CombineItemB = (Item carried by tempUnit in slot LoopA)
      • Set RCR_CombineItemA = (Target item of issued order)
      • -------- Now check recipes --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • RCR_CombineItemA Not equal to No item
          • RCR_CombineItemB Not equal to No item
          • RCR_CombineItemA Not equal to RCR_CombineItemB
        • Then - Actions
          • -------- Retrieve recipe result --------
          • Set RCR_SaveRecipeItemA = (Item-type of RCR_CombineItemA)
          • Set RCR_SaveRecipeItemB = (Item-type of RCR_CombineItemB)
          • Custom script: set udg_RCR_SaveA = udg_RCR_SaveRecipeItemA
          • Custom script: set udg_RCR_SaveB = udg_RCR_SaveRecipeItemB
          • Set RCR_SaveR = (Load RCR_SaveA of RCR_SaveB from RCR_CombineTable)
          • Custom script: set udg_tempItemType = udg_RCR_SaveR
          • Set RCR_SaveAddCharges = (Load RCR_SaveR of RCR_SaveA from RCR_CombineTable)
          • -------- Verify result --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • RCR_SaveR Not equal to 0
            • Then - Actions
              • Hero - Drop RCR_CombineItemA from tempUnit
              • Hero - Drop RCR_CombineItemB from tempUnit
              • Hero - Create tempItemType and give it to tempUnit
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • RCR_SaveAddCharges Equal to True
                • Then - Actions
                  • Item - Set charges remaining in (Last created item) to ((Charges remaining in RCR_CombineItemA) + (Charges remaining in RCR_CombineItemB))
                • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • RCR_CombineSFX Not equal to <Empty String>
                • Then - Actions
                  • Special Effect - Create a special effect attached to the origin of tempUnit using RCR_CombineSFX
                  • Special Effect - Destroy (Last created special effect)
                • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • RCR_ShowText Equal to True
                • Then - Actions
                  • Set tempForce = (Player group((Owner of tempUnit)))
                  • Quest - Display to tempForce the New Item Received message: (|cff7777aaITEMS COMBINED|r - + (((Name of RCR_CombineItemA) + combined with ) + ((Name of RCR_CombineItemB) + ( to create + (Name of (Last created item))))))
                  • Custom script: call DestroyForce(udg_tempForce)
                • Else - Actions
              • Item - Remove RCR_CombineItemA
              • Item - Remove RCR_CombineItemB
            • Else - Actions
        • Else - Actions
  • RCR Disassemble Ability
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to RCR_DisassembleAbility
    • Actions
      • Set tempUnit = (Triggering unit)
      • Set tempItem = (Target item of ability being cast)
      • -------- null previous variables --------
      • Set RCR_SaveR = 0
      • Set RCR_SaveA = 0
      • Set RCR_SaveB = 0
      • Set RCR_SaveAddCharges = False
      • -------- Retrieve recipe result --------
      • Set RCR_SaveRecipeResult = (Item-type of tempItem)
      • Custom script: set udg_RCR_SaveR = udg_RCR_SaveRecipeResult
      • Set RCR_SaveA = (Load (RCR_SaveR x -1) of (RCR_SaveR x -1) from RCR_CombineTable)
      • Set RCR_SaveB = (Load (RCR_SaveA x -1) of (RCR_SaveR x -1) from RCR_CombineTable)
      • Custom script: set udg_tempItemType = udg_RCR_SaveA
      • Custom script: set udg_tempItemType2 = udg_RCR_SaveB
      • Set RCR_SaveAddCharges = (Load RCR_SaveR of RCR_SaveA from RCR_CombineTable)
      • -------- Verify result --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • RCR_SaveA Not equal to 0
          • RCR_SaveB Not equal to 0
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • RCR_SaveAddCharges Equal to True
              • (Charges remaining in tempItem) Less than or equal to 1
            • Then - Actions
              • Set tempForce = (Player group((Owner of tempUnit)))
              • Quest - Display to tempForce the Simple Hint message: |cffff0000Error|r -...
              • Custom script: call DestroyForce(udg_tempForce)
            • Else - Actions
              • Set tempLoc = (Position of tempItem)
              • Item - Create tempItemType at tempLoc
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • RCR_SaveAddCharges Equal to True
                • Then - Actions
                  • Set tempInt = ((Charges remaining in tempItem) mod 2)
                  • Item - Set charges remaining in (Last created item) to (((Charges remaining in tempItem) / 2) + tempInt)
                • Else - Actions
              • Set tempItem2 = (Last created item)
              • Item - Create tempItemType2 at tempLoc
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • RCR_SaveAddCharges Equal to True
                • Then - Actions
                  • Item - Set charges remaining in (Last created item) to ((Charges remaining in tempItem) / 2)
                • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • RCR_ShowText Equal to True
                • Then - Actions
                  • Set tempForce = (Player group((Owner of tempUnit)))
                  • Quest - Display to tempForce the New Item Received message: (|cff7777aaITEMS DISASSEMBLED|r - + (((Name of tempItem) + was disassembled into ) + ((Name of tempItem2) + ( and + (Name of (Last created item))))))
                  • Custom script: call DestroyForce(udg_tempForce)
                • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (tempItem is owned) Equal to True
                • Then - Actions
                  • Item - Remove tempItem
                  • Hero - Give tempItem2 to tempUnit
                  • Hero - Give (Last created item) to tempUnit
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • RCR_DisassembleSFX Not equal to <Empty String>
                    • Then - Actions
                      • Special Effect - Create a special effect attached to the origin of tempUnit using RCR_DisassembleSFX
                      • Special Effect - Destroy (Last created special effect)
                    • Else - Actions
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • RCR_DisassembleSFX Not equal to <Empty String>
                    • Then - Actions
                      • Special Effect - Create a special effect at tempLoc using RCR_DisassembleSFX
                      • Special Effect - Destroy (Last created special effect)
                    • Else - Actions
                  • Item - Remove tempItem
              • Custom script: call RemoveLocation(udg_tempLoc)
        • Else - Actions
  • RCR Disassemble RC
    • Events
      • Unit - A unit Is issued an order targeting an object
    • Conditions
      • (Target item of issued order) Not equal to No item
    • Actions
      • Set tempUnit = (Triggering unit)
      • -------- null previous variables --------
      • Set RCR_SaveA = 0
      • Set RCR_SaveB = 0
      • Set RCR_SaveR = 0
      • Set RCR_SaveAddCharges = False
      • Set RCR_CombineItemA = No item
      • Set RCR_CombineItemB = No item
      • Custom script: set udg_LoopA = GetIssuedOrderId()-852001
      • Set RCR_CombineItemB = (Item carried by tempUnit in slot LoopA)
      • Set RCR_CombineItemA = (Target item of issued order)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • And - All (Conditions) are true
            • Conditions
              • RCR_CombineItemA Not equal to No item
              • RCR_CombineItemB Not equal to No item
              • RCR_CombineItemA Equal to RCR_CombineItemB
        • Then - Actions
          • -------- Retrieve recipe result --------
          • Set RCR_SaveRecipeResult = (Item-type of RCR_CombineItemA)
          • Custom script: set udg_RCR_SaveR = udg_RCR_SaveRecipeResult
          • Set RCR_SaveA = (Load (RCR_SaveR x -1) of (RCR_SaveR x -1) from RCR_CombineTable)
          • Set RCR_SaveB = (Load (RCR_SaveA x -1) of (RCR_SaveR x -1) from RCR_CombineTable)
          • Custom script: set udg_tempItemType = udg_RCR_SaveA
          • Custom script: set udg_tempItemType2 = udg_RCR_SaveB
          • Set RCR_SaveAddCharges = (Load RCR_SaveR of RCR_SaveA from RCR_CombineTable)
          • -------- Verify result --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • RCR_SaveA Not equal to 0
              • RCR_SaveB Not equal to 0
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • RCR_SaveAddCharges Equal to True
                  • (Charges remaining in RCR_CombineItemA) Less than or equal to 1
                • Then - Actions
                  • Set tempForce = (Player group((Owner of tempUnit)))
                  • Quest - Display to tempForce the Simple Hint message: |cffff0000Error|r -...
                  • Custom script: call DestroyForce(udg_tempForce)
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • RCR_DisassembleSFX Not equal to <Empty String>
                    • Then - Actions
                      • Special Effect - Create a special effect attached to the origin of tempUnit using RCR_DisassembleSFX
                      • Special Effect - Destroy (Last created special effect)
                    • Else - Actions
                  • Hero - Drop RCR_CombineItemA from tempUnit
                  • Hero - Create tempItemType and give it to tempUnit
                  • Set tempItem = (Last created item)
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • RCR_SaveAddCharges Equal to True
                    • Then - Actions
                      • Set tempInt = ((Charges remaining in RCR_CombineItemA) mod 2)
                      • Item - Set charges remaining in (Last created item) to (((Charges remaining in RCR_CombineItemA) / 2) + tempInt)
                    • Else - Actions
                  • Hero - Create tempItemType2 and give it to tempUnit
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • RCR_SaveAddCharges Equal to True
                    • Then - Actions
                      • Item - Set charges remaining in (Last created item) to ((Charges remaining in RCR_CombineItemA) / 2)
                    • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • RCR_ShowText Equal to True
                    • Then - Actions
                      • Set tempForce = (Player group((Owner of tempUnit)))
                      • Quest - Display to tempForce the New Item Received message: (|cff7777aaITEMS DISASSEMBLED|r - + (((Name of RCR_CombineItemA) + was disassembled into ) + ((Name of tempItem) + ( and + (Name of (Last created item))))))
                      • Custom script: call DestroyForce(udg_tempForce)
                    • Else - Actions
                  • Item - Remove RCR_CombineItemA
            • Else - Actions
        • Else - Actions


Credits
System requested by GhostHunter123
As seen in Phase Killer by Dark.Revenant
Maker - Teaching me a better way of detecting which item was being manipulated.

Changelog
1.06
  • Both items in a recipe can now be the same item type.
1.05
  • Changed the system to only require 1 hashtable.
1.04
  • Replaced loop with a hashtable check. Now requires 2 hashtables.
1.02-1.03
  • Removed the wait to properly make the system MUI (thanks Maker)
  • Fixed an exploit when disassembling charged items - it must have at least 2 charges, and the charges are divided evenly between the two new component items.
1.01
  • Cached (triggering unit) (thanks Radamantus for pointing that out)

Keywords:
item, item combine, item recipe, combine, recipe,
Contents

Right Click Recipe 1.06 (Map)

Reviews
23:21, 2nd Jan 2013 Magtheridon96: Approved. Nice system. It's quite efficient and useful.

Moderator

M

Moderator

23:21, 2nd Jan 2013
Magtheridon96: Approved.
Nice system. It's quite efficient and useful.
 
Level 37
Joined
Mar 6, 2006
Messages
9,243
The system is not MUI due to the wait. In addition, a wait of 0.00 seconds is actually one of [0.100, 0.125, 0.150, 0.175, 0.200] chosen randomly. So there's an unpleasant delay in the system. Use a timer if you need a short delay.

Get the manipulated items like this instead of loops:
  • Custom script: set udg_LoopA = GetIssuedOrderId()-852001
  • Game - Display to P1 for 3 s: (Name of (Target item of issued order))
  • Game - Display to P1 for 3 s: (Name of (Item carried by (Triggering unit) in slot LoopA))
 
Level 1
Joined
Apr 22, 2019
Messages
5
I liked this system alot so i put in into a map i'm making that me and some of my friends will play, stil put you as credit in the quest logs : ) , i like it alot!
 
Top