• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!
  • ✅ The POLL for Hive's Texturing Contest #34 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!
  • ✅ The POLL for Hive's Techtree Contest #20 is OPEN! Vote for the TOP 3 FACTIONS! 🔗Click here to cast your vote!

[Trigger] Remove Fixed Number of Units

Status
Not open for further replies.

mr-mushy

M

mr-mushy

Replacing multiple units

Hi there,

I'm trying to make a trigger which creates a unit when three are placed in a certain region. At the same time, the trigger needs to remove all three units from the game.

Basically 3 units = 1 unit.

Here's what I have so far:

65437259.jpg


The problem is, it creates 3 Captains when it should only make one. Obviously I need something to tell it to only make 1 per 3 Footmen.

Any help would be awesome. :cool:

Thanks.
 
Last edited by a moderator:
I think this is what your looking for

  • Fusion Enter
    • Fusion Enter
      • Events
        • Unit - A unit enters Fuse 1 <gen>
      • Conditions
        • (Unit-type of (Triggering unit)) Equal to Footman
      • Actions
        • Unit Group - Add (Triggering unit) to FuseGroup
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (Number of units in FuseGroup) Greater than or equal to 3
          • Then - Actions
            • Set TempPoint = (Center of Fuse 1 <gen>)
            • Unit Group - Pick every unit in FuseGroup and do (Actions)
              • Loop - Actions
                • Unit Group - Remove (Picked unit) from FuseGroup
                • Unit - Remove (Picked unit) from the game
            • Unit - Create 1 Captain for (Owner of (Triggering unit)) at TempPoint facing Default building facing degrees
            • Custom script: call RemoveLocation(udg_TempPoint)
          • Else - Actions
And to make sure the player doesn't exploit it by simply patrolling a unit in and out of the region.

  • Fusion leave
    • Events
      • Unit - A unit leaves Fuse 1 <gen>
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Footman
    • Actions
      • Unit Group - Remove (Triggering unit) from FuseGroup
If you didnt notice a great deal of that trigger was to deal with Leaks
 
Just curious how you got
  • Fusion Enter
above your event there?

It doesn't work >.< Nor sure why at the moment :S

I have arrays on my variables, are they needed? I thought they are there so I don't need to make a bucketload of variables for each player.

If that's stopping it from working... I guess bucketloads it is.
 
Arrays sholden't hurt the trigger so long as you are properly using them Eg Fusion Group[1] could be for footmen to captain and FusionGroup[2] could be from archers to rangers or something. Just make sure you get the index right. You don't need a array for temp point but it should only be used in instantanius triggers (triggers with no waits in them). Here I will post my test map it worked fine for me.
 

Attachments

You sir, I love you.

Permission to use that identical trigger in my map? I'll throw your name into the credits and everything and let you know when it's released :)

I have a feeling you know what I'm making ^^ Send me a PM if you do, would be interesting to hear your guess.
 
Status
Not open for further replies.
Back
Top