• 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.
  • 💡 We're thrilled to announce that our upcoming texturing contest is in the works, and we're eager to hear your suggestions! Please take this opportunity to share your ideas in this theme discussion thread for the Texturing Contest #34!
  • 🏆 Hive's 7th HD Modeling Contest: Icecrown Creature is now open! The frozen wastes of Icecrown are home to some of Azeroth’s most terrifying and resilient creatures. For this contest, your challenge is to design and model a HD 3D monster that embodies the cold, undead, and sinister essence of Icecrown! 📅 Submissions close on April 13, 2025. Don't miss this opportunity to let your creativity shine! Enter now and show us your frozen masterpiece! 🔗 Click here to enter!

[Solved] How can I create item up with int and for x to y

Status
Not open for further replies.
Level 2
Joined
Jan 6, 2020
Messages
12
I am trying to write a system for item upgrade. But the system I wrote does not work. I'm not near my computer right now, but I can briefly explain.

Fitem[1]= item1 Fitem[2]= item2 Unit - Starts eff. ability if ability being cast eq item_abil2 action for 1 to 4 integer A for 1 to 6 integer B if item type - hero inv. slot integer B equal to Fitem[integer A] if math random 1 to 100 less than 65 give item Fitem[integer A +1]

how can i do this correctly?

Help me please.
 

Uncle

Warcraft Moderator
Level 72
Joined
Aug 10, 2018
Messages
7,754
Is the ability always the same? The name makes it seem like it's supposed to match with the item.

Anyway, that trigger should work fine as long as (integer A + 1) is within the bounds of the array.

Keep in mind it will attempt to upgrade the new item if it's placed in an inventory slot > integer B.

Also, I would use unique Integer variables instead of IntegerA/B.

  • A
    • Events
    • Conditions
    • Actions
      • Set VariableSet UpgUnit = (Triggering unit)
      • For each (Integer ItemLoop) from 1 to TotalItems, do (Actions)
        • Loop - Actions
          • For each (Integer InvLoop) 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 UpgUnit in slot InvLoop)) Equal to Items[ItemLoop]
                • Then - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Random integer number between 1 and 100) Less than or equal to 65
                    • Then - Actions
                      • Hero - Create Items[(ItemLoop + 1)] and give it to UpgUnit
                    • Else - Actions
                • Else - Actions
If you want it to stop after upgrading an item:
  • B
    • Events
    • Conditions
    • Actions
      • Set VariableSet UpgUnit = (Triggering unit)
      • Set VariableSet FoundItem = False
      • For each (Integer ItemLoop) from 1 to TotalItems, do (Actions)
        • Loop - Actions
          • For each (Integer InvLoop) 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 UpgUnit in slot InvLoop)) Equal to Items[ItemLoop]
                • Then - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Random integer number between 1 and 100) Less than or equal to 65
                    • Then - Actions
                      • Hero - Create Items[(ItemLoop + 1)] and give it to UpgUnit
                    • Else - Actions
                  • Set VariableSet FoundItem = True
                  • Custom script: exitwhen udg_FoundItem
                • Else - Actions
          • Custom script: exitwhen udg_FoundItem
 

Attachments

  • Item Loop.w3m
    16.6 KB · Views: 8
Last edited:
Level 2
Joined
Jan 6, 2020
Messages
12
It's very explanatory. thank you. I don't know how to best use for loop and integer A/B.
The same ability will replace the first item he sees in the inventory with the one above the item row. Probably this is what I'm looking for.
 
Status
Not open for further replies.
Top