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

Techtree Requirements Via Triggers

Status
Not open for further replies.
Level 5
Joined
Mar 24, 2020
Messages
80
Hi guys,

The below triggers are supposed to add/remove dummy units that are used for tech-tree requirements.

I'm having an issue where a variable doesn't seem to want to reset. When the building begins construction the dummy unit is removed from the game, so that the player cannot build a second.

The second trigger is for if the construction is cancelled. The dummy unit is created again, but the variable doesn't seem to set so when trigger 1 occurs again, the dummy unit doesn't get removed. Meaning the building can be built however times the player wishes.

Can anyone spot the issue or suggest an alternative?

Thank you!

  • Tavern 1
    • Events
      • Unit - A unit Begins construction
    • Conditions
      • (Unit-type of (Constructing structure)) Equal to Tavern Hero
    • Actions
      • Unit - Remove DummyTavern[(Player number of (Owner of (Constructing structure)))] from the game
  • Tavern 2
    • Events
      • Unit - A unit Cancels construction
    • Conditions
      • (Unit-type of (Cancelled structure)) Equal to Tavern Hero
    • Actions
      • Set VariableSet SpawnLocation = (Random point in Boolean <gen>)
      • Unit - Create 1 You can only have one Tavern. for (Owner of (Cancelled structure)) at SpawnLocation facing (Random angle) degrees
      • Set VariableSet DummyTavern[(Player number of (Owner of (Cancelled structure)))] = (Last created unit)
      • Custom script: call RemoveLocation(udg_SpawnLocation)
 
Level 5
Joined
Oct 16, 2007
Messages
67
I Tested it, works fine for me.
  • Build
    • Events
      • Unit - A unit Begins construction
    • Conditions
    • Actions
      • Unit - Kill unit[(Player number of (Owner of (Constructing structure)))]
      • Game - Display to (All players) the text: (Name of (Triggering unit))
      • Game - Display to (All players) the text: (Name of (Constructing structure))
  • Cancel
    • Events
      • Unit - A unit Cancels construction
    • Conditions
      • (Unit-type of (Cancelled structure)) Equal to Farm
    • Actions
      • Unit - Create 1 Footman for (Owner of (Cancelled structure)) at (Center of (Playable map area)) facing Default building facing degrees
      • Set VariableSet unit[(Player number of (Owner of (Cancelled structure)))] = (Last created unit)
Depending on which Patch you use, you can use a Upgrade instead of a Unit. In current Versions they can be set back to 0 to prevent building or remove bonuses from units again.
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,540
You can tell that he's using the latest patch because of "Set VariableSet". Just another bug that came with Reforged. Although... it's actually convenient that it exists since it helps determine what patch someone is on.

Anyway, it's definitely better to use actual Upgrades instead of a Unit as Lartin said.
 
Level 5
Joined
Oct 16, 2007
Messages
67
Just had an idea...
  • Init
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Player Group - Pick every player in (All players) and do (Actions)
        • Loop - Actions
          • Player - Limit training of Farm to 1 for (Picked player)
This limits the Unit to 1 for every Player. No further Triggers needed.
 
Level 5
Joined
Mar 24, 2020
Messages
80
You can tell that he's using the latest patch because of "Set VariableSet". Just another bug that came with Reforged. Although... it's actually convenient that it exists since it helps determine what patch someone is on.

Anyway, it's definitely better to use actual Upgrades instead of a Unit as Lartin said.

Ahh you think it's just a bug on their part then?

Thanks Larkin, I will consider using the upgrades or just the trigger!
 
Status
Not open for further replies.
Top