• Check out the results of the Techtree Contest #19!
  • 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.
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!

[Trigger] Unit Merger System

Status
Not open for further replies.

H.o.t.Carl

H

H.o.t.Carl

Ok so basically I'm setting up a unit merger system, where they load up into a building, I hit an ability called merge units, and they merge based on what I set the combination to be, for example fire elemental + water elemental = steam manifest. This part below works, which keeps track of which units are loaded into the building, in this case archers. What doesn't work is that when you click on their icons in the loaded building they unload and the number remains the same, so I could unload them and load them back up and the number would jump above the maximum units which I set to be 2 units for merging at this point, which is quite a problem! I used a similar trigger to this one to try and lower the number when you release the unit based on the ability cargo hold being cast to reduce this archer variable in the same fashion as it is increased, but couldn't quite get it. Assistance would be great!

Here's what I've got for the entry trigger, which raises the integer variable for the specific unit entering the building

Soul Absorb
Events
Unit - A unit Begins casting an ability
Conditions
(Ability being cast) Equal to Absorb Soul (Goblin Zeppelin)
Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Unit-type of (Target unit of ability being cast)) Equal to Archer
Then - Actions
Set SFArchers[(Player number of (Owner of (Casting unit)))] = (SFArchers[(Player number of (Owner of (Casting unit)))] + 1)


What I need is a trigger which lowers the same integer variables when a unit leaves the building.
 
  • Unit Enter Merger Record
    • Events
      • Unit - A unit Is loaded into a transport
    • Conditions
      • (Transporting unit) Equal to Arcane Vault 0000 <gen>
      • Or - Any (Conditions) are true
        • Conditions
          • (Unit-type of (Loading unit)) Equal to Fire Elemental (Fire)
          • (Unit-type of (Loading unit)) Equal to Water Elemental (Water)
          • (Unit-type of (Loading unit)) Equal to Wind Elemental (Wind)
          • (Unit-type of (Loading unit)) Equal to Earth Elemental (Earth)
    • Actions
      • Unit Group - Add (Loading unit) to Loaded_Unit
      • Your Action Here
The trigger above is to record whenever the unit is loaded into the merger .

  • Unit Leave Merger Record
    • Events
      • Unit - A unit Is issued an order with no target
    • Conditions
      • ((Triggering unit) is in Loaded_Unit) Equal to True
      • Or - Any (Conditions) are true
        • Conditions
          • (Unit-type of (Triggering unit)) Equal to Fire Elemental (Fire)
          • (Unit-type of (Triggering unit)) Equal to Water Elemental (Water)
          • (Unit-type of (Triggering unit)) Equal to Wind Elemental (Wind)
          • (Unit-type of (Triggering unit)) Equal to Earth Elemental (Earth)
    • Actions
      • Unit Group - Remove (Triggering unit) from Loaded_Unit
      • Your Action Here
I tried this , it worked quite good in my map.
I created a unit group named "Loaded_Unit" .
Since the unit in the transport , it can't do anything , order with no target will point to unload .
When you order the transport to unload all , the system will automatically order the unit in the transport to unload itself , so , it is same as you unload it 1 by 1.
 
Perfect, my trigger will look quite different, but the order with no target thing is exactly what I needed thanks
 
Status
Not open for further replies.
Back
Top