• 🏆 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!

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:
Level 9
Joined
Apr 23, 2011
Messages
527
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.
 

Ardenian

A

Ardenian

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.
 
Level 9
Joined
Apr 23, 2011
Messages
527
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).
 
Level 11
Joined
Dec 19, 2012
Messages
411

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

Ardenian

A

Ardenian

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