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

I'd like help with a Crafting Trigger.

Status
Not open for further replies.
Level 2
Joined
Jul 27, 2014
Messages
17
So, I'm making a new map, and I'm generally good at triggering. However, a few 'roadblocks' have run into me, and my 'crafting' system. Here's my trigger.

Events
- Unit - [Unit's Name] Begins casting an ability
Conditions
- (Ability being cast) Equal to [Spell Name]
- (Item carried by [Unit] in slot 1) Equal to (Item Carried by [Unit] of type [Item
- (Item carried by [Unit] in slot 2) Equal to (Item Carried by [Unit] of type [Item
- (Item carried by [Unit] in slot 1) Not equal to No Item
- (Item carried by [Unit] in slot 2) Not equal to No Item
Actions
- Item - Create [Item] at (Position of Unit)
- Item - Remove (Item carried by [Unit] in slot 1)
- Item - Remove (Item carried by [Unit] in slot 2)

So, the problem is, I'd like it to be shortened so it uses only ONE ability. I have a bunch of other triggers that all use abilities to craft a specific item, and it's troubling me. Repeating myself, I'm generally good at triggering, but in my opinion, 'crafting' has ALWAYS been one of those 'impossible to reach' triggers. I do not use Jass, either.
 
Level 15
Joined
Aug 7, 2013
Messages
1,338
I do not use Jass, either.

Well GUI is just a fancy way to write JASS, albeit inefficient and missing some features.

I'd like it to be shortened so it uses only ONE ability

What do you mean? As far as I can tell, you are using a single ability in the example you gave. Do you mean you want a single trigger that does all crafting combinations?

Since you're using GUI, I think it would be best to create a trigger for each recipe, but detect the same spell.

So if you have 50 item recipes, you'll have 50 different triggers, which all fire when the spell cast is equal to your crafting ability.

- (Item carried by [Unit] in slot 1) Equal to (Item Carried by [Unit] of type [Item
- (Item carried by [Unit] in slot 2) Equal to (Item Carried by [Unit] of type [Item

Furthermore, it would be prudent to instead loop through a unit's inventory instead of assuming that the items to be crafted are always located in slot 1 and 2, and in that exact order.

Instead, loop through the items, and if you're missing an item, don't do anything.

Otherwise, if you aren't missing the item, remove those items which are part of the recipe, then create the newly crafted item.

- (Item carried by [Unit] in slot 1) Not equal to No Item
- (Item carried by [Unit] in slot 2) Not equal to No Item

Not sure what the purpose of these lines are. I think you can remove this.

- Item - Remove (Item carried by [Unit] in slot 1)
- Item - Remove (Item carried by [Unit] in slot 2)

Again loop through the inventory and remove those items belonging to the recipe.

Note with a trigger per recipe approach, there could be some overlap if some recipes share items, though this will depend on how you design it.
 
Level 2
Joined
Jul 27, 2014
Messages
17
Well, the "Not Equal to No Item" fixes a bug I encountered that made it craft if there were no items in any slot. :p, and, I don't do much item triggering. Plus, when I did 'one spell', it bugged. It wouldn't do a single thing. Care to give an example trigger?

EDIT: I was using several multiple abilities.

EDIT 2: Also, no. My crafting system uses base items (Normally obtained) to obtain 'crafted items' (Through the triggers), and you craft with the crafted items. A bunch of unique/different recipes.
 
Last edited:
Level 2
Joined
Jul 27, 2014
Messages
17
Can anyone give me a trigger to craft? My map uses a bunch of recipes, and having one crafting station for a ton of recipes won't work. I just want (Two or more triggers) that rely on ONE ability to do crafting if either recipe works.
 
Level 2
Joined
Jul 27, 2014
Messages
17
Well, all the ones in the spells section are just Jass. However, yours seems nice, and I can always just make it so you make a 'part' of the finished item.

UPDATE: Thank you a ton! Your "Right Click Recipe" works wonders.
 
Last edited:
Status
Not open for further replies.
Top