• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[General] 0

Status
Not open for further replies.
Level 39
Joined
Feb 27, 2007
Messages
5,013
It would be easiest with a 2D array:
  • Events
    • Time - Elapsed game time is 0.50 seconds
  • Conditions
  • Actions
    • Custom script: set udg_NO_ITEM_TYPE = 0 //This line doesn't need to be done, just here for completeness; you need to create an item type variable called NO_ITEM_TYPE and simply don't assign it a default value (it's used in comparisons below)
    • Set MAX_ITEM_COMBINES = 4 //greater than or equal to the maximum number of times any item in the map can be upgraded
    • Set MAX_ITEM_COMBINES = MAX_ITEM_COMBINES + 1 //so it works properly it needs to be one greater
    • -------- --------
    • Set ItemNum = ItemNum + MAX_ITEM_COMBINES
    • Set CombineItem[ItemNum + 0] = Rocket Cannon (Dummy Buy)
    • Set CombineItem[ItemNum + 1] = Rocket Cannon
    • Set CombineItem[ItemNum + 2] = Double Rocket Cannon
    • Set CombineItem[ItemNum + 3] = Triple Rocket Cannon
    • Set CombineItem[ItemNum + 4] = Quad Rocket Cannon
    • -------- --------
    • Set ItemNum = ItemNum + MAX_ITEM_COMBINES
    • Set CombineItem[ItemNum + 0] = Arrow Launcher (Dummy Buy)
    • Set CombineItem[ItemNum + 1] = Arrow Launcher
    • Set CombineItem[ItemNum + 2] = Double Arrow Launcher
    • Set CombineItem[ItemNum + 3] = Triple Arrow Launcher
    • Set CombineItem[ItemNum + 4] = Quad Arrow Launcher
    • -------- --------
    • Set ItemNum = ItemNum + MAX_ITEM_COMBINES
    • Set CombineItem[ItemNum + 0] = Regular Gun (Dummy Buy)
    • Set CombineItem[ItemNum + 1] = Regular Gun
    • Set CombineItem[ItemNum + 2] = Really Fucking Big Gun That Doesn't Upgrade
    • -------- --------
    • etc.
    • -------- --------
    • Set NUM_BASE_COMBINES = ItemNum / MAX_ITEM_COMBINES
  • Events
    • Unit - A unit acquires an item
  • Conditions
  • Actions
    • Set B_Item = (Item being manipulated)
    • Set B_IType = (Item-type of B_Item)
    • Set B_Unit = (Triggering Unit)
    • For each Integer BaseInt from 1 to NUM_BASE_COMBINES) do (Actions)
      • Loop - Actions
        • Set ItemNum = BaseInt x MAX_ITEM_COMBINES
        • If (All conditions are true) then do (Then actions) else do (Else actions)
          • If - Conditions
            • B_IType equal to CombineItem[ItemNum]
          • Then - Actions
            • Set GiveItem = CombineItem[ItemNum]
            • Set FoundItem = False
            • For each Integer SlotInt from 1 to 6 do (Actions)
              • Loop - Actions
                • Set S_Item = (Item carried by B_Unit in slot SlotInt)
                • Set S_IType = (Item-type of S_Item)
                • For each Integer CombInt from ItemNum to (ItemNum + (MAX_ITEM_COMBINES - 1)) do (Actions) //the -1 is because the max rank can't be upgraded
                  • Loop - Actions
                    • If (All conditions are true) then do (Then actions) else do (Else actions)
                      • If - Conditions
                        • S_IType equal to CombineItem[CombInt]
                        • CombineItem[(CombInt + 1)] not equal to NO_ITEM_TYPE
                      • Then - Actions
                        • Set FoundItem = True
                        • Item - Remove S_Item
                        • Set GiveItem = CombineItem[(CombInt + 1)]
                        • Custom script: exitwhen true
                      • Else - Actions
            • If (All conditions are true) then do (Then actions) else do (Else actions)
              • If - Conditions
                • FoundItem equal to True
              • Then - Actions
                • Custom script: exitwhen true
              • Else - Actions
          • Else - Actions
    • Hero - Create GiveItem and give it to B_Unit
    • Set GiveItem = NO_ITEM_TYPE
 
Level 39
Joined
Feb 27, 2007
Messages
5,013
I did not make a map. I just wrote that in the forum reply box; you will have to recreate it yourself. Honestly it will be a good exercise and perhaps you will better understand how the trigger works in the process.
 
Status
Not open for further replies.
Top