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

total player research

Status
Not open for further replies.
Level 2
Joined
Sep 26, 2020
Messages
10
hello, trying to add a trigger that detects a players total research/upgrade count in order to restrict the use of endgame units until the player reaches a total of 25 researches, any assistance is much appreciated.
 
Level 7
Joined
Dec 9, 2014
Messages
89
  • ResearchCounter
    • Events
      • Unit - A unit Finishes research
    • Conditions
    • Actions
      • Set TotalResearches[(Player number of (Owner of (Researching unit)))] = (TotalResearches[(Player number of (Owner of (Researching unit)))] + 1)
  • CancelTraining
    • Events
      • Unit - A unit Begins training a unit
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • TotalResearches[(Player number of (Owner of (Triggering unit)))] Less than 25
        • Then - Actions
          • Custom script: call IssueImmediateOrderById(GetTriggerUnit(), 851976)
        • Else - Actions
This should work. The first trigger increments an int variable TotalResearches by 1 each time a player researches. The array number corresponds to the player number so that each player gets its own counter.

The second trigger checks to see if the TotalResearches for that player is less than 25 when a unit begins training another unit. If it is, it cancels the trained unit. If you are using sell instead of train you would need to modify it to 'sells a unit'
 
Status
Not open for further replies.
Top