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

Keeping tracks of all units loaded into transport

Status
Not open for further replies.
Level 8
Joined
Mar 12, 2008
Messages
437
I have an Inn unit, which units can enter, with abilities basically copied from the Goblin Zeppelin. I want to be able to fetch the units in the Inn, but I can't come up with a way that works.

"Pick every unit in playable map area matching Unit is being transported", and then matching Transporting unit to Inn doesn't work.

"Pick every unit owned by Player X matching Unit is being transported" actually works, until you try to match Transport unit.

So this is what actually works somewhat, so far:
  • For each (Integer A) from 1 to 5, do (Actions)
    • Loop - Actions
      • Unit Group - Pick every unit in (Units owned by (Player((Integer A))) matching (((Matching unit) is being transported) Equal to True)) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (No conditions yet)
            • Then - Actions
              • (Actions)
            • Else - Actions
But as I said, I want to match Transporting unit with Inn, and it already feels like a clumsy way to do it.

I was also thinking of keeping track of them via a group, but I don't find any "Unit is unloaded" event.
 
Level 12
Joined
Mar 24, 2011
Messages
1,082
Hello,

I have done something similar some time ago, you may want to check this http://www.hiveworkshop.com/forums/spells-569/gui-bunkersystem-v1-4-a-222023/

This basically creates a group for each bunker (transport in your case) and stores the units which enter it (and makes a copy of them which can attack but you will not need this part... probably).

So, feel free to modify the code to your needs, you only have to remove the unneeded parts, I have commented almost every line so it would not be hard, if you can't manage yourself, ask for help again :)
 
Level 8
Joined
Mar 12, 2008
Messages
437
Hello,

I have done something similar some time ago, you may want to check this http://www.hiveworkshop.com/forums/spells-569/gui-bunkersystem-v1-4-a-222023/

Thanks, but it must have support for heroes, hehe...

Anyway, it occurred to me that I can make a two-dimensional loop, by saving the Inns in a unit array, and then looping through them both two-dimensionally, like this:

  • Unit Group - Pick every unit in (Units owned by (Player((Integer A))) matching (((Matching unit) is loaded into Inn[(Integer B)]) Equal to True)) and do (Actions)
    • Loop - Actions
 
Status
Not open for further replies.
Top