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

[Trigger] Unit Merger System

Status
Not open for further replies.
Level 2
Joined
Sep 21, 2007
Messages
9
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.
 
Level 3
Joined
Jul 6, 2008
Messages
42
  • 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.
 
Status
Not open for further replies.
Top