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

Simple Rank System v1.2 [GUI]

This bundle is marked as useful / simple. Simplicity is bliss, low effort and/or may contain minor bugs.

- This system has been requested by .VTZ. (not in a private project) and I decided to share with you all.

- The system is actually MUI that will keep track each unit kill and will be promoted once a certain kill has been made by that unit.

- There is an indicator (you can choose on how to show the indicator) that will affect your unit depending on your ranks.

- Useful in modern war map.

- GUI ^_^.



- All instructions are in the RS Setup.

External Instructions:
- Copy the Dummy Rank Model (Object Editor) from the test map into your map (Object Editor)
- Download this model: Model Rank by anarchianbedlam
- Import the model into your map (after your import it, double-click the path and tick the Use Custom Path and delete the war3mapImported\) so your path should be like this: rankmdx.mdx
- Open World Editor -> File -> Preferences... -> General Tab -> Tick the Automatically create unknown variables while pasting trigger data.
- Copy the Folder Rank System and paste it in your Trigger Editor.
- Open Sound Editor (F5) and press CTRL + F.
- Type "goodjob.wav" and Left-click it, select Use As Sound.
- Go to Trigger Editor and set your RankSoundSetup variable = GoodJob <gen>

- There are 2 methods to indicate the rank:
* Rank will always follow the unit.
* Rank will only be shown if you type "-rank" (you must select a unit beforehand).

- These options can be changed by changing the RankAlwaysShow boolean variable in the RS Setup trigger.



  • RS Setup
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- CONFIGURABLES --------
      • -------- LISTS OF RANKS --------
      • Set Rank[1] = Private First Class
      • Set Rank[2] = Specialist
      • Set Rank[3] = Corporal
      • Set Rank[4] = Sergeant
      • Set Rank[5] = Staff Sergeant
      • -------- KILL REQUIRED PER RANK --------
      • Set RankKillRequired[1] = 5
      • Set RankKillRequired[2] = 10
      • Set RankKillRequired[3] = 15
      • Set RankKillRequired[4] = 20
      • Set RankKillRequired[5] = 25
      • -------- MAX RANK YOU CAN GO --------
      • Set MaxRank = 5
      • -------- PLAYER COLORS --------
      • Set PlayerColor[1] = |CFFFF0303
      • Set PlayerColor[2] = |CFF0042FF
      • Set PlayerColor[3] = |CFF1CB619
      • Set PlayerColor[4] = |CFF540081
      • Set PlayerColor[5] = |CFFFFFF01
      • Set PlayerColor[6] = |CFFFE8A0E
      • Set PlayerColor[7] = |CFF20C000
      • Set PlayerColor[8] = |CFFE55BB0
      • Set PlayerColor[9] = |CFF959697
      • Set PlayerColor[10] = |CFF7EBFF1
      • Set PlayerColor[11] = |CFF106246
      • Set PlayerColor[12] = |CFF4E2A04
      • -------- THIS IS THE RANK MODEL: CREDITS TO anarchianbedlam --------
      • Set RankModel = Dummy Rank Model
      • -------- THIS IS THE SOUND WHERE YOU GETS RANKED UP --------
      • Set RankSoundSetup = GoodJob <gen>
      • -------- OPTION WHETHER YOU WANT TO ALWAYS SHOW THE RANK OR NOT --------
      • -------- TO SHOW CURRENT RANK OF A UNIT, SELECT IT AND TYPE "-rank" --------
      • Set RankAlwaysShow = True
      • -------- END OF CONFIGURABLES --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • RankAlwaysShow Equal to True
        • Then - Actions
        • Else - Actions
          • Trigger - Turn on RS Rank Select <gen>
          • For each (Integer LoopingInteger) from 1 to 12, do (Actions)
            • Loop - Actions
              • Trigger - Add to RS Rank Select <gen> the event (Player - (Player(LoopingInteger)) types a chat message containing -rank as A substring)
      • Hashtable - Create a hashtable
      • Set RankHashtable = (Last created hashtable)
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units in (Playable map area) matching (((Matching unit) is A structure) Equal to False)) and do (Actions)
        • Loop - Actions
          • Set RankUnit = (Picked unit)
          • Custom script: set udg_RankKey = GetHandleId(udg_RankUnit)
          • Set RankUnitKill = 0
          • Hashtable - Save RankUnitKill as (Key UnitKill) of RankKey in RankHashtable
  • RS Event
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Killing unit) is A structure) Equal to False
    • Actions
      • Set RankUnit = (Killing unit)
      • Custom script: set udg_RankKey = GetHandleId(udg_RankUnit)
      • Set RankUnitKill = (Load (Key UnitKill) of RankKey from RankHashtable)
      • Hashtable - Save (RankUnitKill + 1) as (Key UnitKill) of RankKey in RankHashtable
      • Set RankUnitKill = (RankUnitKill + 1)
      • For each (Integer LoopingInteger) from 1 to MaxRank, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • RankUnitKill Equal to RankKillRequired[LoopingInteger]
            • Then - Actions
              • Unit Group - Add RankUnit to RankGroup
              • Set TempLoc = (Position of RankUnit)
              • Custom script: if GetLocalPlayer() == GetOwningPlayer(udg_RankUnit) then
              • Set RankSound = RankSoundSetup
              • Custom script: endif
              • Sound - Play RankSound at 100.00% volume, located at TempLoc with Z offset 0.00
              • Unit - Create 1 RankModel for (Owner of RankUnit) at TempLoc facing Default building facing degrees
              • Unit - Add a 3.00 second Generic expiration timer to (Last created unit)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • RankUnit Equal to No unit
                • Then - Actions
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • RankAlwaysShow Equal to True
                    • Then - Actions
                      • Set RankFloatingText = (Load (Key Rank) of RankKey in RankHashtableIf the label is not found, this function returns NULL.)
                      • Floating Text - Destroy RankFloatingText
                      • Floating Text - Create floating text that reads (PlayerColor[(Player number of (Owner of RankUnit))] + (Rank[LoopingInteger] + |r)) above RankUnit with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
                      • Set RankFloatingText = (Last created floating text)
                      • Hashtable - Save Handle OfRankFloatingText as (Key Rank) of RankKey in RankHashtable
                      • Trigger - Turn on RS Rank Always Show <gen>
                    • Else - Actions
                      • Floating Text - Create floating text that reads (PlayerColor[(Player number of (Owner of RankUnit))] + (Rank[LoopingInteger] + |r)) above RankUnit with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
                      • Set RankFloatingText = (Last created floating text)
                      • Floating Text - Set the velocity of RankFloatingText to 32.00 towards 90.00 degrees
                      • Floating Text - Change RankFloatingText: Disable permanence
                      • Floating Text - Change the lifespan of RankFloatingText to 3.00 seconds
                      • Floating Text - Change the fading age of RankFloatingText to 1.50 seconds
              • Custom script: call RemoveLocation(udg_TempLoc)
            • Else - Actions
  • RS Register New Unit
    • Events
      • Unit - A unit enters (Playable map area)
    • Conditions
      • ((Triggering unit) is A structure) Equal to False
    • Actions
      • Set RankUnit = (Triggering unit)
      • Custom script: set udg_RankKey = GetHandleId(udg_RankUnit)
      • Set RankUnitKill = 0
      • Hashtable - Save RankUnitKill as (Key UnitKill) of RankKey in RankHashtable
  • RS Rank Always Show
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in RankGroup and do (Actions)
        • Loop - Actions
          • Set RankUnit = (Picked unit)
          • Custom script: set udg_RankKey = GetHandleId(udg_RankUnit)
          • Set RankFloatingText = (Load (Key Rank) of RankKey in RankHashtableIf the label is not found, this function returns NULL.)
          • Floating Text - Change the position of RankFloatingText to RankUnit with Z offset 0.00
  • RS Rank Select
    • Events
    • Conditions
    • Actions
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units currently selected by (Triggering player)) and do (Actions)
        • Loop - Actions
          • Set RankUnit = (Picked unit)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (RankUnit is in RankGroup) Equal to False
            • Then - Actions
              • Floating Text - Create floating text that reads (PlayerColor[(Player number of (Owner of RankUnit))] + (You don't have ranks yet + |r)) above RankUnit with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
              • Floating Text - Set the velocity of (Last created floating text) to 32.00 towards 90.00 degrees
              • Floating Text - Change (Last created floating text): Disable permanence
              • Floating Text - Change the lifespan of (Last created floating text) to 3.00 seconds
              • Floating Text - Change the fading age of (Last created floating text) to 1.50 seconds
            • Else - Actions
              • Custom script: set udg_RankKey = GetHandleId(udg_RankUnit)
              • Set RankUnitKill = (Load (Key UnitKill) of RankKey from RankHashtable)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • RankUnitKill Greater than or equal to RankKillRequired[MaxRank]
                • Then - Actions
                  • Floating Text - Create floating text that reads (PlayerColor[(Player number of (Owner of RankUnit))] + (Rank[MaxRank] + |r)) above RankUnit with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
                  • Floating Text - Set the velocity of (Last created floating text) to 32.00 towards 90.00 degrees
                  • Floating Text - Change (Last created floating text): Disable permanence
                  • Floating Text - Change the lifespan of (Last created floating text) to 3.00 seconds
                  • Floating Text - Change the fading age of (Last created floating text) to 1.50 seconds
                • Else - Actions
                  • For each (Integer LoopingInteger) from 1 to MaxRank, do (Actions)
                    • Loop - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • RankUnitKill Less than RankKillRequired[LoopingInteger]
                        • Then - Actions
                          • Floating Text - Create floating text that reads (PlayerColor[(Player number of (Owner of RankUnit))] + (Rank[(LoopingInteger - 1)] + |r)) above RankUnit with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
                          • Floating Text - Set the velocity of (Last created floating text) to 32.00 towards 90.00 degrees
                          • Floating Text - Change (Last created floating text): Disable permanence
                          • Floating Text - Change the lifespan of (Last created floating text) to 3.00 seconds
                          • Floating Text - Change the fading age of (Last created floating text) to 1.50 seconds
                          • Skip remaining actions
                        • Else - Actions

- .VTZ.: He requested this system.
- anarchianbedlam: He made the rank model, badass.
- Lists of Military Ranks: http://www.militaryfactory.com/ranks/army_ranks.asp
- HellvsHeaven -> Gave me idea to change to indicator from SFX to message.
- -Kobas- -> Detecting the null unit killing saves data too.



v1.0
- Initial release

v1.1
- Removed SFX indicator
- Added message indicator showing what ranks are the unit currently is.

v1.2
- Fixed the bug where sometimes Floating Text of rank will appear on the middle of the map (null value).
- Bonus Damage has been removed.
- Added new option on how to show the rank for each unit (just play with the RankAlwaysShow Boolean Variable.
- Added 2 new ranks.


Keywords:
simple, rank, system, general, zero, hour, command, and, conquoer, defskull, .VTZ., anarchianbedlam.
Contents

Just another Warcraft III map (Map)

Reviews
12th Dec 2015 IcemanBo: Too long as NeedsFix. Rejected. 17:48, 19th Jul 2012 Magtheridon96: Fix the dummy-dealing-damage bug and reduce the number of function calls in your triggers by using variables to cache data, and this might be approved.

Moderator

M

Moderator

12th Dec 2015
IcemanBo: Too long as NeedsFix. Rejected.

17:48, 19th Jul 2012
Magtheridon96:

Fix the dummy-dealing-damage bug and reduce the number of function calls in your triggers by using variables to cache data, and this might be approved.
 
Level 3
Joined
Nov 24, 2011
Messages
31
While I was testing the map, I found a bug with the floating text. Some floating texts showing ranks magically appears on the screen and stays there, not connecting to any unit. By the way, I didn't mean floating text to indicate ranks. I meant adding the rank names as titles to a player's name. For example, [Rank] (player name). This way, when a player types something, others and the player will always know what rank he/she is. Anyway, this is only an suggestion, not a demand. Also, the floating text is sort of annoying because it is blocking the player's view.
 
Level 12
Joined
Dec 17, 2009
Messages
951
While I was testing the map, I found a bug with the floating text. Some floating texts showing ranks magically appears on the screen and stays there, not connecting to any unit. By the way, I didn't mean floating text to indicate ranks. I meant adding the rank names as titles to a player's name. For example, [Rank] (player name). This way, when a player types something, others and the player will always know what rank he/she is. Anyway, this is only an suggestion, not a demand. Also, the floating text is sort of annoying because it is blocking the player's view.

@defskull, 5/5

@HellvsHeaven, you can delete the floating message, and if you dont want to use rank sfx, you can write " ^ " on floating message as a rank value :)
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
Also, the floating text is sort of annoying because it is blocking the player's view.
And that is why at my first attempt, I used an SFX to indicate current ranks.
I will add an option to choose on how to show the current rank of each unit.

Method 1:
Current method, always shows the current rank of a unit.

Method 2:
Select unit and type "-rank" or whatever command suits, and a Floating Text will appear above the selected unit(s) about 3 seconds or so and disappear.

Thanks for feedbacks !
 
Floating Text created on 0.000, 0.000 because of null unit.
If hero destroy few units (with spell), it will destroy system.

Edit, also this system will fail if you use dummy units because you need to register all kills made by dummy units as well as main unit for same unit.

Make it jass/vjass and just add few GUI examples.
 

Attachments

  • Capture.JPG
    Capture.JPG
    218.7 KB · Views: 294
Level 33
Joined
Mar 27, 2008
Messages
8,035
Map has been updated.

Floating Text created on 0.000, 0.000 because of null unit.
Fixed.

Edit, also this system will fail if you use dummy units because you need to register all kills made by dummy units as well as main unit for same unit.
What do you meant by dummy and unit, as a single unit ?
Did you want to exclude dummy units too ?
I'll add an exception option in the next version (which unit can be included in rank system and which unit does not included).

Make it jass/vjass and just add few GUI examples.
The systems I made is focusing on GUI-users because some of them is too lazy to install JNGP which is needed if you want to alter the data for vJASS/JASS triggers.
 
You can make it vanilla jass so they can use it in regular WE.

Well you count some kills for some hero, example.

Hero kill 3 units
Counter[hero_id] = 3

Hero cast storm bolt and kill unit.
Counter[hero_id] = 4

Hero cast custom made spell that create dummy unit that cast spell and kill unit.
Counter[hero_id] = 4

See problem?
note: Counter isn't array, I just present it that way to explain problem easier.

EDIT:

You can easily create functions in GUI actions, just add:

endfunction
function name takes xxx returns xxx

into custom script, you can create few useful functions like this and move them to top of map triggers or just create triggers without events but you won't be able to use function "takes" easily, you will need globals.

My idea is to add function in this form.
-----------------------------------------------
function RegisterUnit takes unit killer, unit pwner returns nothing
set udg_UNIT_1 = killer
set udg_UNIT_2 = pwner
call SaveUnit(hash, getHandleId (udg_UNIT_1 ) , 0, udg_UNIT_2 )
call SaveUnit(hash, getHandleId (udg_UNIT_2 ) , 0, udg_UNIT_2 )
------------------------------------------------
Then when you kill unit with both dummy or hero you can load unit that will be improved.

:)

  • Example
    • Events
    • Conditions
    • Actions
      • Custom script: endfunction
      • Custom script: function RegisterUnit takes unit killer, unit pwner returns nothing
      • Custom script: set udg_u1 = killer
      • Custom script: set udg_u2 = pwner
      • Hashtable - Save Handle Ofu2 as 0 of (Key u1) in (Last created hashtable)
      • Hashtable - Save Handle Ofu2 as 0 of (Key u2) in (Last created hashtable)
JASS:
function Trig_Example_Actions takes nothing returns nothing
    endfunction
    function RegisterUnit takes unit killer, unit pwner returns nothing
    set udg_u1 = killer
    set udg_u2 = pwner
    call SaveUnitHandleBJ( udg_u2, 0, StringHashBJ("u1"), GetLastCreatedHashtableBJ() )
    call SaveUnitHandleBJ( udg_u2, 0, StringHashBJ("u2"), GetLastCreatedHashtableBJ() )
endfunction

//===========================================================================
function InitTrig_Example takes nothing returns nothing
    set gg_trg_Example = CreateTrigger(  )
    call TriggerAddAction( gg_trg_Example, function Trig_Example_Actions )
endfunction
 
Last edited:
Level 33
Joined
Mar 27, 2008
Messages
8,035
Dummy units shouldn't be dealing damage anyway, so doing that is kind of unneeded
But dummy can cast an actual spell that really deals damage (if lucky enough, kills the target unit).
I'm trying to find somehow to link between dummy unit and the caster itself.

I'll be running with some experiments later on.
 
Top