• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Rank system

Status
Not open for further replies.
Yeah, i'm making a map. And i need help with a script i've been working on. What it basically does, is when a unit kills another unit. it takes a random number between 1 and 3 and if it returns 1 then it adds a rank, aka, removes other rank abilities and adds the +rank level armor, +rank level dmg and +Ability that you can see that says what rank the unit is

This is what i have so far, i'm having trouble with the condition

  • Rank system
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Random integer number between 1 and 3) Equal to 1
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Ability being cast) Equal to Rank 1 <-- Killing unit has ability
        • Then - Actions
        • Else - Actions
          • Unit - Add Rank 2 to (Killing unit)
          • Unit - Add Rank 2 Armor to (Killing unit)
          • Unit - Add Rank 2 Dmg to (Killing unit)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Ability being cast) Equal to Rank 2 <-- Killing Unit has ability
            • Then - Actions
            • Else - Actions
              • Unit - Add Rank 3 to (Killing unit)
              • Unit - Add Rank 3 Armor to (Killing unit)
              • Unit - Add Rank 3 Dmg to (Killing unit)
Up to rank 10, and i dont want to do it with if/then/else's i'd rather do it in a loop, but i dont know how. Thanks. +Rep will be given to anyone who helps me
 
Level 9
Joined
Apr 25, 2009
Messages
468
Bro, you cant use (Ability being cast) unless you have an event that is Unit - A Unit Starts the effect of an ability
or such.
 
Level 9
Joined
Sep 5, 2007
Messages
358
we said that because you said above you are having trouble with the condition.
Anyway to that, store all abilities into indexed variables, then in a loop you verify if the unit has the ability_variable[IntegerA] and you add to him the ability_variable[integer A + 1] and don't forget to remove the ability_variable[integer A]
 
Level 9
Joined
Sep 5, 2007
Messages
358
create a variable of the ability type and then check the array box and you get an indexed variable.
Now create two more variables like the previous one.
now store in this three variables the abilities of the rank 1 you want to add to the killing unit and in the part in front of the name of variable that says index you put there 1. Now do this for the rest of the ranks but instead of typing 1 you type 2,3,4,5 etc etc etc until 10.
 
i know, but what variable do i use in the loop to see if a unit has a certain ability? Like If unit has ability: "AbilBLAHBLAHBLAH[Integer a] Remove abilBLAHBLAHBLAH[Integer a] add AbilBlahBlahBlah2[Integer a] + 1 AbilBlahBlahBlah3[Integer a] + 1 AbilBlahBlahBlah[Integer a] + 1

So whats the name of the variable for the "Does unit have ability Abilblahblahblah [A]?"
 
Last edited:
Level 2
Joined
Jul 8, 2009
Messages
6
it would be much simpler if you found a rank system (trust me theres a BUNCH) and just edited it to your needs.
 
Status
Not open for further replies.
Top