Unit Spawn, Research Triggered

Edward

New Member
Reaction score
2
Hello,
I'm trying to find a way to consolidate the following to affect all players (1-12) without having to make 12 different triggers:
Trigger:
  • Rifleman Copy
    • Events
      • Unit - A unit Finishes research
    • Conditions
      • (Researched tech-type) Equal to Call Rifleman
      • (Owner of (Triggering unit)) Equal to Player 2 (Blue)
    • Actions
      • For each (Integer A) from 1 to 1000000000, do (Actions)
        • Loop - Actions
          • Unit - Create 1 Rifleman for Player 2 (Blue) at Point facing Default building facing degrees
          • Wait 30.00 seconds


Here is an example of my footman trigger. Since this trigger affects all players at map initialization, I was able to make it successfully.
Trigger:
  • Footmen Spawn
    • Events
      • Time - Every 10.00 seconds of game time
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 6, do (Actions)
        • Loop - Actions
          • Unit - Create 1 Footman for PlayerNumber[(Integer A)] at (Center of RegionSpawn[(Integer A)]) facing 0.00 degrees


So this is basically what I'm trying to make (but don't know how):
Event: Every 30 seconds of game time
Actions: For Loop Integer A
-If/Then/Else
-If PlayerNumber[A] has researched "Call Rifleman" then spawn a rifleman man at RegionSpawn[A]; else do nothing.
 

the_ideal

user title
Reaction score
61
Do the loop for all players using integer A, and then inside each of those paste the part of the trigger you already have, but use integer B. Does that answer your question?
 

Edward

New Member
Reaction score
2
No, I'm looking for a way to make sure that only players who have researched the tech will get the rifleman.
 

Edward

New Member
Reaction score
2
I have developed a work around that uses two triggers, but I'd still like to see someone offer advice on how to do it with one trigger.

I have it so that if a player researches the Rifleman tech, it creates a rifleman in a region behind the players town hall. This region is both isolated and bounded and the rifleman is invulnerably.

The second trigger spawns real/usable riflemen at the player's town hall, after checking that the "Region" contains a rifleman. This repeats every 30 seconds.

I'm sure there's a simple to do this though.
 

Edward

New Member
Reaction score
2
Here are the two triggers I am using to circumvent this problem. This idea was inspired by Cannon Defense from Starcraft, where it used a "unit enters/leaves region" trigger to allow/disallow photon cannon stacking by "turning the lights on/off."

Trigger:
  • Rifleman Dummy
    • Events
      • Unit - A unit Finishes research
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 6, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Owner of (Triggering unit)) Equal to PlayerNumber[(Integer A)]
              • (Researched tech-type) Equal to Call Rifleman
            • Then - Actions
              • Unit - Create 1 Rifleman for PlayerNumber[(Integer A)] at (Center of RegionDummy[(Integer A)]) facing 0.00 degrees
            • Else - Actions
              • Do nothing


Trigger:
  • Rifleman Spawn
    • Events
      • Time - Every 30.00 seconds of game time
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 6, do (Actions)
        • Loop - Actions
          • Unit Group - Pick every unit in (Units in RegionDummy[(Integer A)]) and do (If ((Unit-type of (Picked unit)) Equal to Rifleman) then do (Unit - Create 1 Rifleman for PlayerNumber[(Integer A)] at (Center of RegionSpawn[(Integer A)]) facing Default building facing degrees) else do (Do nothing))
 

Moridin

Snow Leopard
Reaction score
144
Firstly - Quadriple post. There's an Edit button for a reason. Don't bump your threads more than once per day.

Also, you could try this: (You'll need 2 triggers though because there's no condition to check for finished research that I know of)
Note: The triggers are freehand. They should still be quite accurate though.

Trigger:
  • Finished Research
    • Events
      • Unit - A unit Finishes research
    • Conditions
      • (Researched tech-type) Equal to Call Rifleman
    • Actions
      • Set Has_Researched[Player number of (Triggering player)] = True


Has_Researched[] = A boolean variable array with a size of 13

Trigger:
  • Rifleman Spawn
    • Events
      • Time - Every 30.00 seconds of game time
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 6, do (Actions)
        • Loop - Actions
          • If (Multiple conditions are true) then do (Then actions) else do (Else actions)
            • If - Conditions
              • Has_Researched[(Integer A)] Equal to True
            • Then - Actions
              • Unit - Create 1 Rifleman for PlayerNumber[(Integer A)] at (Center of RegionDummy[(Integer A)]) facing 0.00 degrees
            • Else - Actions
 

Setharoth114

New Member
Reaction score
5
Is it possible to see if Player(Integer A) has the specific tech-type researched?

For instance, Pick all Players matching condition?

You could also use a boolean variable that triggers when the tech is researched, but that would also require two triggers.

I don't really see a problem with using two triggers, tho.
 
General chit-chat
Help Users

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top