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

Trying to Make a 'Unit Spillover' Trigger

Level 18
Joined
Mar 16, 2008
Messages
721
It's a defense map and players A, B, C units sometimes get bugged by 100 unit cap. I tried adding more players to control the spawns and prevent any one of them hitting unit cap of 100 units but it seems in some rare cases they still hit 100 unit cap.

Trigger needs to transfer ownership of units from players A, B, C, ... to player Y.

Thinking maybe assign each one of the spawn unit-types a food cost of 1 then track if player A, B, or C, or ... exceeds cap and transfer to player X.

Wanted to see if anyone on here had a better idea before I went down that path tho.

:thumbs_up:
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,567
By the unit cap I assume you mean the pathfinding issue where units stutter and refuse to move. In that case, the unit limit can depend on different factors. I find a safe value to be a limit of 50-60 units at one time. Anyway, the solution is simple if you have a good amount of Player Slots available to use.

Setup Computer players that will share the spawned units:
  • Events
    • Map initialization
  • Conditions
  • Actions
    • Set Variable ComputerArray[1] = Player 20
    • Set Variable ComputerArray[2] = Player 21
    • Set Variable ComputerArray[3] = Player 22
Whenever you spawn an enemy unit get the next Computer player in line and create it for them:
  • Actions
    • Set Variable ComputerIndex = ComputerIndex + 1
    • If ComputerIndex Greater than 3 then Set Variable ComputerIndex = 0
    • Unit - Create 1 EnemyUnit for ComputerArray[ComputerIndex]...
ComputerIndex = Integer
ComputerArray = Player (array)

It helps to have a solid system for spawning units.
 
Last edited:
Top