Save/Load Limit Usage

Level 3
Joined
Oct 3, 2025
Messages
15
Hello, I Am Trying To Figure Out How To Add A Limit To Prevent Players Being Able To Put In -Load Command 30xs? (Is There A Way To Limit Each Player To This Command? Example 2 Usage Of The Load Command )
And Another Question I Thought I Knew How To Do This But Haven't Been Able to Make it Happen, How Do I Also Remove Heros/Units With -Repick Command
Any Help Is Appreciated Thank You In Advance!!!
 
It sounds like you need to start using Array variables. These are variables that behave like lists (imagine a grocery list). They have what's called an [index] which acts like their list number. For example: 1 = Milk, 2 = Eggs, 3 = Chicken, etc... By taking advantage of the index you can store all sorts of values all within a single variable.

Of course we're playing Warcraft and not grocery shopping, so we'll be keeping track of things like Units, Items, and Abilities instead.
:peasant-grin:

In your case each Player needs to track their own Hero as well as how many times they've typed "-load". This is easy since Players already have their own unique Player Number, Red = 1, Blue = 2, Teal = 3, etc. So by combining this Player Number with an Array variable we can track data for specific Players. You'll see this referred to as MPI throughout the forums.

Here's how to do it for your Load command:
  • Events
    • Player - Player 1 (Red) types a chat message containing -load as A substring
    • Player - Player 2 (Blue) types a chat message containing -load as A substring
  • Conditions
    • Player_Load_Counter[(Player number of (Triggering player))] Less than 2
  • Actions
    • Set Variable Player_Load_Counter[(Player number of (Triggering player))] = (Player_Load_Counter[(Player number of (Triggering player))] + 1)
    • -------- Proceed to loading --------
Player_Load_Counter is an Integer array variable. You increase it by 1 whenever a Player types in their load command. Notice how the Conditions prevent the trigger from running it's Actions once a Player has typed this command two times.

For Hero repicking, first you need to keep track of each Player's Hero. So when a Player picks their Hero you would do something like this:
  • Events
    • ...
  • Conditions
  • Actions
    • Unit - Create 1 Paladin for (Triggering player) at (Center of HeroSpawnRegion <gen>)
    • Set Variable Player_Hero[(Player number of (Triggering player))] = (Last created unit)
I don't know how your map works so I can't give a better example here. In DotA, you purchase your Hero from a Tavern building. In some maps you move a Wisp to a Region and pick the Hero standing there. In other maps you use a custom Hero Selection system, like one of the many that can be found on Hive. It all depends...

Then for your Repick command you can do something like this:
  • Events
    • Player - Player 1 (Red) types a chat message containing -repick as An exact match
    • Player - Player 2 (Blue) types a chat message containing -repick as An exact match
  • Conditions
    • Player_Hero[(Player number of (Triggering player))] Not equal to No unit
  • Actions
    • Unit - Remove Player_Hero[(Player number of (Triggering player))] from the game
    • Set Variable Player_Hero[(Player number of (Triggering player))] = No unit
Player_Hero is a Unit array variable. "No unit" is a Preset option that allows you to remove the Unit reference. "Not equal to No unit" is a little confusing but it simply means "They have a hero". So when a Player types "-repick" we check to see if they actually have a Hero then proceed to Removing it from the game as well as their reference to it.
 
Last edited:
I Will Have To Give That A Go Once Im Able To Thank You Again In Advance! i WIll post again when i test it out
My RPG hero selection is using A unit and walking into a region Currently
 
Back
Top