• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

[Trigger] System - Item crafting system, item stacking systems compatible

Status
Not open for further replies.
Solved: by Dooomlord, Link to post

I am Making a Item crafting system compatible with item stacking system for my project, Jungle trolls Dynasty that am planning to share, and I need help making it work.
I couldn't mange to find what's wrong, please Help asap, +rep for any help


  • ICS Setup
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- Setting amount of crafting abilities\craftables --------
      • Set ICS_crafting_craftables_count = 5
      • -------- Setting the Message the shows if crafting fails --------
      • Set ICS_item_craft_failure_string = Failed to craft item.
      • -------- Setting if whether there is an Item Stacking system included --------
      • -------- There is an item stacking system included by Dangerb0y set --------
      • -------- to true if you will have item stacking system in your map, set --------
      • -------- to false if not --------
      • Set ICS_ItemStackingSystemIncluded = True
      • -------- -------- -------- -------- --------
      • -------- Settings recipe details #1 --------
      • -------- -------- -------- -------- --------
      • Set ICS_crafting_ability[1] = Craft ABL 1
      • Set ICS_req_item_A[1] = Claws of Attack +15
      • Set ICS_req_item_B[1] = Gem Fragment
      • Set ICS_item_result[1] = Blood Key
      • Set ICS_item_result_string[1] = Item, Blood Key
      • -------- -------- -------- -------- --------
      • -------- Settings recipe details #2 --------
      • -------- -------- -------- -------- --------
      • Set ICS_crafting_ability[2] = Craft ABL 2
      • Set ICS_req_item_A[2] = Crown of Kings +5
      • Set ICS_req_item_B[2] = Gerard's Lost Ledger
      • Set ICS_item_result[2] = Ghost Key
      • Set ICS_item_result_string[2] = Item, Ghost Key
      • -------- -------- -------- -------- --------
      • -------- Settings recipe details #3 --------
      • -------- -------- -------- -------- --------
      • Set ICS_crafting_ability[3] = Craft ABL 3
      • Set ICS_req_item_A[3] = Kelen's Dagger of Escape
      • Set ICS_req_item_B[3] = Heart of Aszune
      • Set ICS_item_result[3] = Moon Key
      • Set ICS_item_result_string[3] = Item, Moon Key
      • -------- -------- -------- -------- --------
      • -------- Settings recipe details #4 --------
      • -------- -------- -------- -------- --------
      • Set ICS_crafting_ability[4] = Craft ABL 4
      • Set ICS_req_item_A[4] = Mask of Death
      • Set ICS_req_item_B[4] = Horn of Cenarius
      • Set ICS_item_result[4] = Sun Key
      • Set ICS_item_result_string[4] = Item, Sun Key
      • -------- -------- -------- -------- --------
      • -------- Settings recipe details #5 --------
      • -------- -------- -------- -------- --------
      • Set ICS_crafting_ability[5] = Craft ABL 5
      • Set ICS_req_item_A[5] = Orb of Frost
      • Set ICS_req_item_B[5] = Keg of Thunderwater
      • Set ICS_item_result[5] = Magic Key Chain
      • Set ICS_item_result_string[5] = Item, Magic Key Chain
  • ICS Run
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
    • Actions
      • For each (Integer A) from 1 to ICS_crafting_craftables_count, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Ability being cast) Equal to ICS_crafting_ability[(Integer A)]
            • Then - Actions
              • Set ICS_Unit = (Triggering unit)
              • Set ICS_item_int = (Integer A)
              • Trigger - Run ICS <gen> (checking conditions)
              • Skip remaining actions
            • Else - Actions
  • ICS
    • Events
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (ICS_Unit has an item of type ICS_req_item_A[ICS_item_int]) Equal to True
          • (ICS_Unit has an item of type ICS_req_item_B[ICS_item_int]) Equal to True
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ICS_ItemStackingSystemIncluded Equal to True
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Charges remaining in (Item carried by ICS_Unit of type ICS_req_item_A[ICS_item_int])) Greater than or equal to 2
                • Then - Actions
                  • Item - Set charges remaining in (Item carried by ICS_Unit of type ICS_req_item_A[ICS_item_int]) to ((Charges remaining in (Item carried by ICS_Unit of type ICS_req_item_A[ICS_item_int])) - 1)
                • Else - Actions
                  • Item - Remove (Item carried by ICS_Unit of type ICS_req_item_A[ICS_item_int])
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Charges remaining in (Item carried by ICS_Unit of type ICS_req_item_B[ICS_item_int])) Greater than or equal to 2
                • Then - Actions
                  • Item - Set charges remaining in (Item carried by ICS_Unit of type ICS_req_item_B[ICS_item_int]) to ((Charges remaining in (Item carried by ICS_Unit of type ICS_req_item_B[ICS_item_int])) - 1)
                • Else - Actions
                  • Item - Remove (Item carried by ICS_Unit of type ICS_req_item_B[ICS_item_int])
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ICS_ItemStackingSystemIncluded Equal to False
                • Then - Actions
                  • Item - Remove (Item carried by ICS_Unit of type ICS_req_item_A[ICS_item_int])
                  • Item - Remove (Item carried by ICS_Unit of type ICS_req_item_B[ICS_item_int])
                • Else - Actions
          • Hero - Create ICS_item_result[ICS_item_int] and give it to ICS_Unit
        • Else - Actions
---System Download link: Here
 

Attachments

  • Item Craft System.w3x
    42.3 KB · Views: 90
Last edited:
Level 16
Joined
Dec 15, 2011
Messages
1,423
I currently can't find an error in the code. You may want to try using A unit Starts the effect of an ability instead of begin casting. Also, in the ITE for Item stacking included, you can get rid of the ITE in the Else block. If the boolean is false, it will execute the removal immediately, not checking again.

How about using some debug messages to proofcheck the code's functionality?
 
and where does this bug?

I mean does something at all work or...?

I doesn't seem to work at all
I currently can't find an error in the code. You may want to try using A unit Starts the effect of an ability instead of begin casting. Also, in the ITE for Item stacking included, you can get rid of the ITE in the Else block. If the boolean is false, it will execute the removal immediately, not checking again.

How about using some debug messages to proofcheck the code's functionality?

Am sorry am little noobish I didn't understand that XD
 
Level 16
Joined
Dec 15, 2011
Messages
1,423
http://www.hiveworkshop.com/forums/general-mapping-tutorials-278/debugging-188204/

edit

Okay so I did some testing and I found the bug. Turns out you are using 5 abilities with the same order id (all copied from Berserk) (even if you thought you changed it in the OE, it cannot be changed in reality). You will need 5 different abilities or you need to use the Channel ability to create them. It is the only ability that actually allows you to change the order id.

Test map attached. I have taken the abilities out of the Spell Book and give them to each separate unit. It is working correctly now.

Oh and I optimized it for you too :3
 

Attachments

  • Item Craft System.w3x
    42.1 KB · Views: 66
Last edited:
http://www.hiveworkshop.com/forums/general-mapping-tutorials-278/debugging-188204/

edit

Okay so I did some testing and I found the bug. Turns out you are using 5 abilities with the same order id (all copied from Berserk) (even if you thought you changed it in the OE, it cannot be changed in reality). You will need 5 different abilities or you need to use the Channel ability to create them. It is the only ability that actually allows you to change the order id.

Test map attached. I have taken the abilities out of the Spell Book and give them to each separate unit. It is working correctly now.

Oh and I optimized it for you too :3

Thank you, but is there any way to have them all in one spellbook? maybe a diffrent ability
 
Status
Not open for further replies.
Top