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

Passive upgrade

Status
Not open for further replies.
Level 5
Joined
Apr 17, 2010
Messages
124
Hello, reader.

I was wondering, how would you make a fully MUI/MPI system that would upgrade an ability said unit has after a certain amount of kills has been reached.

I don't get how to count the kills for each tower SEPARATELY, so each tower can level up its ability SEPARATELY.

I tried by arrays, but the kills is in an integer array, meaning each players index has only a certain number, therefore all towers level up at the same time.

~~DooM
 
Level 20
Joined
Jul 6, 2009
Messages
1,885
  • Trigger
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Killing unit)) Equal to Your Tower
    • Actions
      • Hashtable - Save ((Load 0 of (Key (Killing unit)) from Hashtable) + 1) as 0 of (Key (Killing unit)) in Hashtable
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Load 0 of (Key (Killing unit)) from Hashtable) Equal to 5
        • Then - Actions
          • Unit - Increase level of Tower Ability for (Killing unit)
        • Else - Actions
 
Well, I prefer indeces, so:
  • Tower Upgrade
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Killing unit)) Equal to Tower
    • Actions
      • -------- tower_int[2] is the loop index, and tower_int[1] is the max index --------
      • For each (Integer tower_int[2]) from 1 to tower_int[1], do (Actions)
        • Loop - Actions
          • -------- If the killing unit has been stored already, increase the kill count --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Killing unit) Equal to tower_unit[tower_int[2]]
            • Then - Actions
              • Set tower_killcount[tower_int[2]] = (tower_killcount[tower_int[2]] + 1)
              • -------- Checks the amount of kills --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • tower_killcount[tower_int[2]] Greater than or equal to 50
                • Then - Actions
                  • -------- If the tower has enough kills, you can apply your actions here --------
                • Else - Actions
              • -------- Since this has been checked already, you can simply skip the rest --------
              • Skip remaining actions
            • Else - Actions
      • -------- This will only work if the tower has not been stored in a variable yer --------
      • -------- because of the 'Skip Remaining Actions' inside the above loop --------
      • Set tower_int[1] = (tower_int[1] + 1)
      • Set tower_unit[tower_int[1]] = (Killing unit)
      • Set tower_killcount[tower_int[1]] = (tower_killcount[tower_int[1]] + 1)
 
Status
Not open for further replies.
Top