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

[General] Switch items

Status
Not open for further replies.
Level 37
Joined
Aug 14, 2006
Messages
7,614
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 41
Joined
Jun 9, 2011
Messages
13,241
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: 65
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,614
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