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

Item Levels

Status
Not open for further replies.
Level 2
Joined
Apr 7, 2007
Messages
16
i was wondering is there a special way to make the item trigger a lot more shorter because currently i have down this. the trigger is working correctly however once i finish with them there will be more than 100 active item combinations due to items such as
Angelic robe Lvl 1 - gives the wearer 20 HP
all the way to
Angelic Robe Lvl 20 - gives the wearer 400 HP
  • Events - Unit Aquires and Item
  • Conditions - Wait 0.01 seconds
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • ((Hero manipulating item) has an item of type Angelic Robe Level 1) Equal to True
      • ((Hero manipulating item) has an item of type Angelic Robe Level 1) Equal to True
    • Then - Actions
      • Special Effect - Create a special effect attached to the overhead of (Buying unit) using Abilities\Spells\Other\Charm\CharmTarget.mdl
      • Item - Remove (Item carried by (Hero manipulating item) of type Angelic Robe Level 1)
      • Item - Remove (Item carried by (Hero manipulating item) of type Angelic Robe Level 1)
      • Hero - Create Angelic Robe Level 2 and give it to (Hero manipulating item)
    • Else - Actions
my question is this, is there a another method of making the level item trigger without having me to create 20 of each ones that has a level like this? because i fear that it would cause the map to load very slow when people play it and also if i use map optimizer, who knows what bugs can occur.
 
Level 8
Joined
Jul 23, 2005
Messages
329
I believe the answer would lie in arrays, and their indexing capabilities...

I'm not the most efficient coder (Pointed out by Dr Super Good), but here's what I've got:

  • Initializer
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set Angelic_Robe[0] = Angelic Robe Level 1
      • Set Angelic_Robe[1] = Angelic Robe Level 2
      • Set Angelic_Robe[2] = Angelic Robe Level 3
      • Set Angelic_Robe[3] = Angelic Robe Level 4
      • -------- Snip 16 lines --------
  • Angelic Robie
    • Events
      • Unit - A unit Acquires an item
    • Conditions
    • Actions
      • Wait 0.01 seconds
      • For each (Integer A) from 0 to 19, do (Actions)
        • Loop - Actions
          • -------- Use a loop to find out which item it was --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Item-type of (Item being manipulated)) Equal to Angelic_Robe[(Integer A)]
            • Then - Actions
              • Special Effect - Create a special effect attached to the overhead of (Buying unit) using Abilities\Spells\Other\Charm\CharmTarget.mdl
              • Item - Remove (Item carried by (Hero manipulating item) of type Angelic_Robe[(Integer A)])
              • Hero - Create Angelic_Robe[((Integer A) + 1)] and give it to (Hero manipulating item)
              • Special Effect - Destroy (Last created special effect)
            • Else - Actions
              • -------- This item wasn't it, continue with the loop --------
EDIT: Time for a little explanation:

The first trigger sets up an array of item types (Named Angelic_Robe).

The second trigger uses a loop to see which item-type it was. It then gives it the item one level ahead, or one item-type in front of the old one.

EDIT2: Oh yeah, and I forgot about a memory leak. Fixed now.
 
Level 27
Joined
Feb 22, 2006
Messages
3,052
The only problem with destroying special effects once they are made is that if they don't have a death animation, nothing will show.
A few of my favorites are:
Avatar of Vengeance (makes a cool purple poof)
Tomes (makes a cartoonish poof)
Transmute (makes a gold fountain with coins and such)
Can't think of any others, might get back to that.
Good idea though, pres.
--donut3.5--
 
Status
Not open for further replies.
Top