• 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.

Loading Unit Trigger

Status
Not open for further replies.
Level 2
Joined
Dec 9, 2021
Messages
5
Hello,

The trigger below works fine but i have a problem with it. But let me shortly explain. The Trigger is for my Unit "MinerGuild". The Idea is that you can send your basic workers (MinerBrigade) into that Minerguild to upgrade them to better Workers if you have the money or they get kicked out if you dont have the money. The Minerguild has the loading ability of the Goblin Zeppelin.

Now i want that the Trigger shall start first if 2 basic worker joined the guildhouse (loaded ability). 2 MinerBrigade for 1 Work Carriage. Right now its 1 for 1 and i dont like that. Maybe someone knows a solution.


  • Joining the Guildhouse
    • Events
      • Unit - A unit Is loaded into a transport
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to MinerBrigade
      • (Unit-type of (Transporting unit)) Equal to Miner-Guild
    • Actions
      • -------- Here begins a short "Story". Not necessary for the trigger --------
      • Unit - Pause (Transporting unit)
      • Game - Display to (Player group((Owner of (Triggering unit)))) the text: Workers take place ...
      • Wait 8.00 seconds
      • Game - Display to (Player group((Owner of (Triggering unit)))) the text: heated debates abou...
      • Wait 8.00 seconds
      • Game - Display to (Player group((Owner of (Triggering unit)))) the text: You are trying to s...
      • Wait 8.00 seconds
      • Game - Display to (Player group((Owner of (Triggering unit)))) the text: But the worker are ...
      • Wait 4.00 seconds
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Owner of (Triggering unit)) Current lumber) Greater than or equal to 75
        • Then - Actions
          • -------- If you got the Money. (Lumber is money in my map) --------
          • Player - Set (Owner of (Triggering unit)).Current lumber to (((Owner of (Triggering unit)) Current lumber) - 75)
          • Game - Display to (Player group((Owner of (Triggering unit)))) the text: You are forced to a...
          • Wait 2.50 seconds
          • Set VariableSet MinerTradeLoc = (Position of (Triggering unit))
          • Unit - Remove (Triggering unit) from the game
          • Unit - Create 1 Work Carriage for (Owner of (Triggering unit)) at MinerTradeLoc facing Default building facing degrees
          • Unit - Unpause (Transporting unit)
          • Custom script: call RemoveLocation(udg_MinerTradeLoc)
        • Else - Actions
          • -------- If you dont got the money --------
          • Wait 2.50 seconds
          • Game - Display to (Player group((Owner of (Triggering unit)))) the text: No agreement was re...
          • Unit - Unpause (Transporting unit)
          • Unit - Order (Transporting unit) to Unload (Triggering unit)
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,867
So how does this design sound to you:

  • You can ONLY Load MinerBrigades into the Miner-Guild. It will reject any other Unit-Type besides that worker.
  • The Story only starts once 2 MinerBrigades are inside the Miner-Guild.
  • You pay the Lumber right away meaning that you can only get in if you have enough to begin with. (There's no issue with doing it the other way)
  • Use Floating Text instead of Text Messages to prevent issues with screen clutter / multiple uses at the same time.

Also, how many Miner-Guilds are there? Is there only one Guild unit? One Guild per player? Or is this something that can happen multiple times at once.

Issues:
You can't use (Transporting unit) after a Wait. It's not safe unlike (Triggering unit).
 
Last edited:
Level 2
Joined
Dec 9, 2021
Messages
5
So how does this design sound to you:

  • You can ONLY Load MinerBrigades into the Miner-Guild. It will reject any other Unit-Type besides that worker.
  • The Story only starts once 2 MinerBrigades are inside the Miner-Guild.
  • You pay the Lumber right away meaning that you can only get in if you have enough to begin with. (There's no issue with doing it the other way)
  • Use Floating Text instead of Text Messages to prevent issues with screen clutter / multiple uses at the same time.

Also, how many Miner-Guilds are there? Is there only one Guild unit? Or is this something that can happen multiple times at once.

Issues:
You can't use (Transporting unit) after a Wait. It's not safe unlike (Triggering unit).
First i have 3 different kinds of Minerguilds (Minerguilds, Manufactur and Labor Union). Each player (6 Players) can build these units once.

What can happen with the issue? I mean i have tested it and it works. No problems. Is there a chance nothing will happen? I mean i have to pause that building otherwise you can just unload it by clicking the worker.

Point 2 "The Story only starts once 2 MinerBrigades are inside the Miner-Guild." is my prefered way. But i dont know what kind of "if Condition" could do that? A set amount var?

Ill change it to a Floating Text.
 
Last edited:

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,867
First i have 3 different kinds of Minerguilds (Minerguilds, Manufactur and Labor Union). Each player (6 Players) can build these units once.

What can happen with the issue? I mean i have tested it and it works. No problems. Is there a chance nothing will happen? I mean i have to pause that building otherwise you can just unload it by clicking the worker.

Point 2 "The Story only starts once 2 MinerBrigades are inside the Miner-Guild." is my prefered way. But i dont know what kind of "if Condition" could do that? A set amount var?

Ill change it to a Floating Text.
Regarding the issue with Event Responses, I may be wrong about this particular one (Transporting unit), but a lot of Event Responses are unusable after Waits or act like Global variables which means that they can easily have their values changed during the Waiting period. Again, (Transporting unit) MAY actually work properly, but I like to play it safe and avoid using most Event Responses when Waits are involved.

This may shed some light on Event Responses + Waits. I can't guarantee that everything said here is correct:

Anyway, I made a map with what seems to be a working version of what you described. I had to use some more advanced methods to get it to work properly because there's no easy way to get how many units are loaded into a transport.

This involved importing a Unit Indexer into the map, which is a great and lightweight system that allows you to save data to units using their Custom Value. I use this to link the Workers to the Guild that they load into and to manage a Unit Group that is linked to each Guild which contains it's loaded Workers.

I also use a method called Shadowing to turn a global variable into a local variable. Read more here: local udg_
I did this to remedy the issue with Event Responses and Waits. Again, this may have not been necessary but I like to play it safe.
 

Attachments

  • Guild Load.w3m
    24.3 KB · Views: 15
Last edited:
Level 2
Joined
Dec 9, 2021
Messages
5
Thank you for your work. I appreciate it. That Indexer is pretty useful. I need to familiarize myself with it and shadowing. This Trigger works really nice. Ill Implant that system and trigger.

I guess i need more experinece (learning by doing) with the different kind of variables. Your Map will help me alot. Thanks!
 
Status
Not open for further replies.
Top