• Check out the results of the Techtree Contest #19!
  • 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.
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!

Custom ability upgrade system

Status
Not open for further replies.

Ardenian

A

Ardenian

Hello, for my map I need a system that allows the player to upgrade an ability by buying an item from a dummy.

The problem is, I don't know how to get the index.

There is an indexed variable for each type of sold item, an indexed variable for each corresponding ability and the indexed unit that will get the new / upgraded ability.

But, I have problems getting started with this trigger.
The attached image shows what I basically want the action to look like. But, for the index I need the corresponding index from the variable that defines the type of the item.

How do I get this index ?
I would be glad if you could help me.
 
Last edited by a moderator:
you probably need to set these indexes in map initialization.

  • init
    • Events
      • Time - Elapsed game time is 0.01 seconds
    • Conditions
    • Actions
      • Set ItemType[1] = Glyph of Purification
      • Set ItemType[2] = Amulet of the Wild
      • Set ItemType[3] = Magic Key Chain
      • Set Hero_Ability[1] = Acid Bomb
      • Set Hero_Ability[2] = Avatar
      • Set Hero_Ability[3] = Battle Roar
then make a trigger for each ability/item.

  • Acid Bomb Get
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to ItemType[1]
    • Actions
      • Set playernumber = (Player number of (Owner of (Hero manipulating item)))
      • Unit - Add Hero_Ability[1] to Hero_Player[playernumber]
this is probably not the most efficient way, just made it off the top of my head.
 
Yeah, this is what came to my mind, too. Isn't there a more efficient way ?

I mean, I have like... around 50+ abilities and I have to write a trigger for each of them ?
Isn't there a way to choose a variable index, like 'x' ? So the number will be the same for item and for ability. But I couldn't find this solution in the WE, sadly.
 
thought about it for a while, can't seem to find any solutions. hopefully another person who knows how to do this (if there is a way) will show us.

this seems to be a similar problem to making quests for an O/RPG, might end up with a similar solution (copy pasting woo).
 

  • Map Init
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set Hero_Ability[1] = some ability...
      • Set Hero_Ability[2] = some other ability...
      • Set Hero_Ability[3] = more ability...
      • Set ItemType[1] = some item...
      • Set ItemType[2] = some other item...
      • Set ItemType[3] = more item...
      • Set MaxIndex = 3
  • Add Ability
    • Events
      • Unit - A unit Acquires an item
    • Conditions
    • Actions
      • For each (Integer LoopInteger) from 1 to MaxIndex, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Item-type of (Item being manipulated)) Equal to ItemType[LoopInteger]
            • Then - Actions
              • Unit - Add Hero_Ability[LoopInteger] to (Triggering Unit)
              • Skip remaining actions
            • Else - Actions


Is this what you need?
 
Hm, it seems so, although I don't understand what's a looped integer.
Thank you!
 
Status
Not open for further replies.
Back
Top