- Joined
- Feb 5, 2017
- Messages
- 32
I've recently made a Recipe System, it's easy to use and flexible, but it works as long as you don't have recipes with similar items, which is bogging me.
The Recipe System
Problem:
I can redo the system on JASS but i think it might ruin the easy process of making a recipe with the base trigger.
Is there any solution to this system without recurring to a complete overhaul? I was thinking of registering the recipes on init and using hashtables, but wouldn't it cause leaks?
The Recipe System
Problem:
-
Inventory System Run
-

Events
-

Conditions
-

Actions
-


Set InventorySystem_Recap = 0
-


-------- Conteo de los objetos --------
-


For each (Integer A) from 1 to 6, do (Actions)
-



Bucle: Actions
-




Set InventorySystem_GoodToGo = False
-




For each (Integer B) from 1 to InventorySystem_Max, do (Actions)
-





Loop: Actions
-






If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-







If: Conditions
-








InventorySystem_GoodToGo Equal to False
-








(Item-type of (Item carried by (Triggering unit) in slot (Integer A))) Equal to InventorySystem_Objects[(Integer B)]
-
-







Then: Actions
-








Set InventorySystem_GoodToGo = True
-








Set InventorySystem_Recap = (InventorySystem_Recap + 1)
-
-







Else: Actions
-
-
-
-
-
-


-------- Creación del objeto --------
-


If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-



If: Conditions
-




InventorySystem_Recap Equal to InventorySystem_Max
-
-



Then: Actions
-




For each (Integer A) from 1 to InventorySystem_Max, do (Actions)
-





Loop: Actions
-






Item - Remove (Item carried by (Triggering unit) of type InventorySystem_Objects[(Integer A)])
-
-
-




Special Effect - Create a special effect at (Position of (Triggering unit)) using InventorySystem_Model
-




Special Effect - Destroy (Last created special effect)
-




Hero - Create InventorySystem_FinalObject and give it to (Triggering unit)
-
-



Else: Actions
-
-
-
-
Item Base A
-

Events
-


Unit - A unit Acquires an item
-
-

Conditions
-


Or - Any (Conditions) are true
-



Conditions
-




(Item-type of (Item being manipulated)) Equal to Ring of Protection +1
-




(Item-type of (Item being manipulated)) Equal to Rock
-
-
-
-

Actions
-


-------- How many items are we combining?--------
-


Set InventorySystem_Max = 2
-


-------- Object List --------
-


Set InventorySystem_Objects[1] = Ring of Protection +1
-


Set InventorySystem_Objects[2] = Rock
-


-------- Final Item --------
-


Set InventorySystem_FinalObject = Infernal Stone
-


-------- Model. --------
-


Set InventorySystem_Model = Abilities\Spells\Items\AIlm\AIlmTarget.mdl
-


-------- - --------
-


-------- Detonador para las recetas --------
-


-------- No borrar --------
-


Trigger - Run Inventory System Run <gen> (checking conditions)
-
-
I can redo the system on JASS but i think it might ruin the easy process of making a recipe with the base trigger.
Is there any solution to this system without recurring to a complete overhaul? I was thinking of registering the recipes on init and using hashtables, but wouldn't it cause leaks?
Last edited:

