• 🏆 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!
  • ✅ The POLL for Hive's Texturing Contest #33 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!

Sharing Tech/Research With Team

Status
Not open for further replies.
Level 2
Joined
Jan 5, 2019
Messages
7
I've been working on a map for a while now and have hit a roadblock. To give you guys some background information, my game will have 3 teams, each comprised of one "Fighter" and 2 "Builders". The "fighters" do not have the ability to make or tech units, while the "builders" have access to most of the standard melee units and buildings, and can send their units to the "fighter" to use on behalf of the team. This is done via a trigger that replaces the unit sent with an identical copy at the "Fighter's" base, under their control, and removes the original unit.

The problem is that each team's "Fighter" doesn't have access to any tech/upgrades/research for the units (And I don't want them to either, I want all research to be done exclusively by each team's builders). So lets say "builder" #1 researches the "Iron Forged Swords" tech and sends a footman to the "fighter" on their team. The "fighter" receives the footman, but without the tech (Their attack tech level is still 0). To make things more tedious/complex, each team has 2 builders, both of which could potentially be the same race, researching the same upgrades.

What I need to do is make it so that any research that is completed, by any "Builder" on a team, is carried across for the entire team. So, in the above example, if "Builder" #1 completes the "Iron Forged Swords" tech and sends a footman to red, that footman has the "Iron Forged Swords" upgrade on it. Id like to do this so if both builders on a team are the same race, lets say human, and one researches the "Iron Forged Swords" tech, that the other human builder also has this upgrade so they don't waste their time and money on the same upgrade.

After spending about an hour on various triggers and testing, I realized I have no clue how to do this, everything I've tried has failed outright. Any help is appreciated (I'm bad with triggers so please be explicit with your advice).
 
  • Shared Research
    • Events
      • Unit - A unit Finishes research
    • Conditions
    • Actions
      • Set TempTechType = (Researched tech-type)
      • Set TempPlayers[0] = (Triggering player)
      • Set TempPGroup = (All allies of TempPlayers[0])
      • Set TempInteger = 1
      • -------- Searches for the highest level of that tech from all alies --------
      • Player Group - Pick every player in TempPGroup and do (Actions)
        • Loop - Actions
          • Set TempPlayers[1] = (Picked player)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Current research level of TempTechType for TempPlayers[1]) Greater than TempInteger
            • Then - Actions
              • Set TempInteger = (Current research level of TempTechType for TempPlayers[1])
            • Else - Actions
      • -------- Applies that to all allies --------
      • Player Group - Pick every player in TempPGroup and do (Actions)
        • Loop - Actions
          • Set TempPlayers[1] = (Picked player)
          • Player - Set the current research level of TempTechType to TempInteger for TempPlayers[1]
      • Custom script: call DestroyForce(udg_TempPGroup)
 
Instead of replacing them, just move them instantly and change owner. All researches (In the object editor) has a field that says something like "Keep upgrades on changed owner". Or something like that.

Edit:
upload_2019-1-6_13-32-37.png
 
Level 2
Joined
Jan 5, 2019
Messages
7
@Mythic So I just wrote out the trigger and tested it, and unfortunately it isn't working for some reason. I tested it by placing trollheadhunters down for me and my allies, gave myself a Barracks, and teched he Berserker upgrade, and none of my allies' headhunters were upgraded, only mine. Here's the trigger as I wrote it:

TechTrigger.PNG

Maybe my variables are off? I've literally never made a variable once in my life before 10 minutes ago, so that'd be my guess.
Tempplayers0 and Tempplayers 1 are both player variables
TempGroup is a Playergroup variable
TempInteger is an integer variable
TempTechType is a Techtype variable.

Where did I go wrong? Is it because of that custom script thing at the bottom? Or is that irrelevant?
 
Status
Not open for further replies.
Top