• 💀 Happy Halloween! 💀 It's time to vote for the best terrain! Check out the entries to Hive's HD Terrain Contest #2 - Vampire Folklore.❗️Poll closes on November 14, 2023. 🔗Click here to cast your vote!
  • 🏆 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!
  • 🏆 HD Level Design Contest #1 is OPEN! Contestants must create a maze with at least one entry point, and at least one exit point. The map should be made in HD mode, and should not be openable in SD. Only custom models from Hive's HD model and texture sections are allowed. The only exceptions are DNC models and omnilights. This is mainly a visual and design oriented contest, not technical. The UI and video walkthrough rules are there to give everyone an equal shot at victory by standardizing how viewers see the terrain. 🔗Click here to enter!

[General] Switch items

Status
Not open for further replies.
Level 37
Joined
Aug 14, 2006
Messages
7,601
Hmm, yes.

Here's the code:

  • Untitled Trigger 001
    • Events
      • Player - Player 1 (Red) types a chat message containing 1 as An exact match
    • Conditions
    • Actions
      • Set TempInteger = 0
      • For each (Integer A) from 1 to 12, do (Actions)
        • Loop - Actions
          • Set ChangeItems[(Integer A)] = (Item-type of No item)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Integer A) Less than 7
            • Then - Actions
              • Set ChangeItems[(Integer A)] = (Item-type of (Item carried by AAAPhodom in slot (Integer A)))
              • Game - Display to (All players) the text: (Name of (Item carried by AAAPhodom of type ChangeItems[(Integer A)]))
              • Item - Remove (Item carried by AAAPhodom in slot (Integer A))
            • Else - Actions
              • Set TempInteger = (TempInteger + 1)
              • Game - Display to (All players) the text: (String(TempInteger))
              • Set ChangeItems[(Integer A)] = (Item-type of (Item carried by AAPhodom_Box in slot TempInteger))
              • Game - Display to (All players) the text: (Name of (Item carried by AAPhodom_Box of type ChangeItems[TempInteger]))
              • Item - Remove (Item carried by AAPhodom_Box in slot TempInteger)
 

Chaosy

Tutorial Reviewer
Level 40
Joined
Jun 9, 2011
Messages
13,183
I did the following:
  • init
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set AAPhodom_Box = Fradz's Fifth Box 0001 <gen>
      • Set AAAPhodom = Archmage 0000 <gen>
      • Game - Display to (All players) the text: press esc to switch
  • switch Copy
    • Events
      • Player - Player 1 (Red) skips a cinematic sequence
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 6, do (Actions)
        • Loop - Actions
          • Set items[(Integer A)] = (Item-type of (Item carried by AAAPhodom in slot (Integer A)))
          • Set items_box[(Integer A)] = (Item-type of (Item carried by AAPhodom_Box in slot (Integer A)))
          • Item - Remove (Item carried by AAAPhodom in slot (Integer A))
          • Item - Remove (Item carried by AAPhodom_Box in slot (Integer A))
          • Hero - Create items[(Integer A)] and give it to AAPhodom_Box
          • Hero - Create items_box[(Integer A)] and give it to AAAPhodom
 

Attachments

  • change items.w3x
    53.8 KB · Views: 59
I don't wanna drop items or they might disappear. :<

And working test map would be very very very nice thing.
They won't disappear.... how could this happen? I think directly switching an item is the better way, instead of remove and re-create it. (also in case a item variable is set to a item in current inventory, it will bring wrong results, because the actual item will be removed for example)
 
Level 37
Joined
Aug 14, 2006
Messages
7,601
They won't disappear.... how could this happen? I think directly switching an item is the better way, instead of remove and re-create it. (also in case a item variable is set to a item in current inventory, it will bring wrong results, because the actual item will be removed for example)
I don't know but this guy called Chaosy over here made a perfectly working system and I'm happy about it.

Thanks for the help guys!
 
Status
Not open for further replies.
Top