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

possible to make natrual passive tower cargo hold

Status
Not open for further replies.
Level 4
Joined
Apr 25, 2008
Messages
75
Oh, he means an AI. Like, to have Neutral Passive towers load other nearby units into them.

Meh, no idea, I suck at triggers.

Oh I see....

I'm working on it now but I think I can take a shortcut if you tell me a few things:

Will this unit be movable?
How many of these units are there?
EDIT: How many units can it hold? (I'm actually almost done but I've hit a brick wall... If it can only hold 1 unit then I can easily do this. Otherwise I'm stuck for now)
 
Last edited:
Level 4
Joined
Apr 25, 2008
Messages
75
My brain hurts.
  • Load
    • Events
      • Unit - A unit Is issued an order targeting an object
    • Conditions
      • And - All (Conditions) are true
        • Conditions
          • (Unit-type of (Target unit of issued order)) Equal to Orc Burrow
          • (Owner of (Target unit of issued order)) Equal to Neutral Passive
    • Actions
      • Wait until ((Distance between (Position of (Ordered unit)) and (Position of Orc Burrow 0000 <gen>)) Less than or equal to 200.00), checking every 0.10 seconds
      • Unit - Change ownership of Orc Burrow 0000 <gen> to (Owner of (Ordered unit)) and Change color
      • Unit - Order (Target unit of issued order) to Orc Burrow - Battle Stations
  • Integerplus
    • Events
      • Unit - A unit Is loaded into a transport
    • Conditions
      • (Unit-type of (Transporting unit)) Equal to Orc Burrow
    • Actions
      • Set NumberOfUnitsInBurrow = (NumberOfUnitsInBurrow + 1)
  • Unload
    • Events
      • Unit - A unit Is issued an order targeting an object
    • Conditions
      • (Issued order) Equal to (Order(unload))
    • Actions
      • Set NumberOfUnitsInBurrow = (NumberOfUnitsInBurrow - 1)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • NumberOfUnitsInBurrow Equal to 0
        • Then - Actions
          • Unit - Change ownership of (Ordered unit) to Neutral Passive and Change color
          • Unit - Change ownership of (Target unit of issued order) to (Triggering player) and Change color
        • Else - Actions
          • Do nothing
Change Battlestations's range to 200 or whatever you put for the distance check. Problem with this is that it will load all units in 200 radius.
You must also remove the "Stand Down" ability from the burrows because when you unload it the peons get stuck inside and it changes to Neutral again. I've tried using Waits and all but it's glitching.

If there is more than one of these units then you have to make more than 1 of the variable or use arrays.

Please note that I tested this with Unedited Peons and only edits to Burrows are those above and I also made it Neutral Passive race.

The annoying thing is that there isn't a function that detects how many units are loaded in another unit or even if a unit unloads a unit.

To even get close I had to write this trigger:
  • order
    • Events
      • Unit - A unit Is issued an order targeting an object
      • Unit - A unit Is issued an order targeting a point
      • Unit - A unit Is issued an order with no target
    • Conditions
    • Actions
      • Game - Display to (All players) the text: ((Name of (Ordered unit)) + (String((Issued order))))
EDIT:
Found a fix to the Battlestations thing that loads all units in 200 radius. To do this I had to learn JASS :p Well I've only used JASS or Custom Script once before (not even for leaks!). Anyways I converted "Load" trigger to JASS and lo-and-behold! I found a way to order the Peon to Enter the Burrows. Just substitute this in:
  • Load
    • Events
      • Unit - A unit Is issued an order targeting an object
    • Conditions
      • And - All (Conditions) are true
        • Conditions
          • (Unit-type of (Target unit of issued order)) Equal to Orc Burrow
          • (Owner of (Target unit of issued order)) Equal to Neutral Passive
    • Actions
      • Wait until ((Distance between (Position of (Ordered unit)) and (Position of Orc Burrow 0000 <gen>)) Less than or equal to 200.00), checking every 0.10 seconds
      • Unit - Change ownership of Orc Burrow 0000 <gen> to (Owner of (Ordered unit)) and Change color
      • Custom script: call IssueTargetOrderBJ( GetOrderedUnit(), "smart", GetOrderTargetUnit() )
+Rep to you for making me learn so much tonight!!!!
 
Level 4
Joined
Apr 25, 2008
Messages
75
In case you haven't seen it yet you have to turn NumberOfPeonsInBurrow into an Array. Thing I can't be bothered thinking about is how it's gonna detect which Array to use.

Also just noticed that in the first trigger I used "Orc Burrow 0000 <gen>". You could (and probably should) change it to "(Target Unit of Issued Order)".

That's why I asked you how many there will be in map and all those questions. But since I didn't get your reply I always try to make it as capable as possible. In fact the NumberOfPeonsInBurrow integer wouldn't be needed if it only holds 1 unit :)
 
Status
Not open for further replies.
Top