HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Issuing Train Orders

06-26-2006, 10:09 PM#1
nevir
OK, so I'm trying to set up a seemingly simple autotraining system, where I have an auto-cast ability that the user turns on and off to enable/disable autobuilding for that specific building. I handle this toggle by setting the unit's custom value to 1/0 - so far so good.

Now, the trouble comes in when I actually order the unit to auto-build the next unit:

Trigger:
Autobuild Helper
Collapse Events
Unit - A unit Finishes training a unit
Collapse Conditions
(Custom value of (Triggering unit)) Equal to 1
Collapse Actions
Unit - Order (Triggering unit) to train/upgrade to a (Unit-type of (Trained unit))

It autobuilds correctly - HOWEVER, when I press cancel (or click the currently training unit), my autobuilding ability is now disabled (though the swirly autocast anim is still going), in addition, it appears to keep *any other* non-training buttons disabled as well.

I've tried to remove/add the ability whenever the user presses cancel - but even after being readded, the ability is still disabled.



So, to me, it seems like actually clicking a unit button on the buidling's console does some extra ordering (or some sort of communication) other than an issuing an immediate order with that unit's id.

Is it at all possible to merely enqueue a unit to be trained, rather than force it to be placed at the head of the queue? I have the feeling that if I can do that, my problem will be solved (not to mention make autobuilding a little more intuitive to the user)
06-27-2006, 01:20 AM#2
Naakaloh
Ordering it again does not cause it to queue another unit?

Also the reason why you lose the autobuilding is because the event only fires when a unit completes, so starting another build will begin the autobuild again, it actually seems like a useful feature if the player wanted to leave autobuild on but temporarily shut it off, but then again, it's your map.
06-27-2006, 03:16 AM#3
nevir
Quote:
Ordering it again does not cause it to queue another unit?
Well, what's strange to me is that ordering a build via trigger puts the new unit at the very start of the queue (regardless of what's already queued), while ordering via the buttons queues them logically

Quote:
Also the reason why you lose the autobuilding is because the event only fires when a unit completes, so starting another build will begin the autobuild again, it actually seems like a useful feature if the player wanted to leave autobuild on but temporarily shut it off, but then again, it's your map.

I'm not sure I explained what's going on well enough - let me do a step by step of what happens in game:

I have a barracks with several units it can train - and two additional abilities:
- one ability "Remove" destroys the barracks (the building is invuln)
- the other ability "Autobuild" is a autocasting ability (based on Replenish), that toggles the custom value of the barracks (replenishon and replenishoff orders)

Now, everything works as it should - the barracks pumps out whatever the first unit in the queue is - time and time again...

The trouble comes in when you want to *stop* it from autobuilding again.

Basically, what I'm doing is:
- right clicking on the autobuild ability to activate it
- click on a unit to start training it <-- at this point, the cancel button shows up, and my two custom abilities become disabled.

If I cancel the first training unit at this point, the cancel button goes away, and my custom abilities are re-enabled again.

However, if I cancel any auto-built units, both my custom abilities are still disabled, even though the barracks is not training anything



I can throw together a test map if you want
06-27-2006, 06:35 AM#4
Naakaloh
Erm, do you mean that the icons for the abilities dissappear? I'm not exactly sure what you mean by disabled. My guess is that you mean you can still autobuild at this point but you can no longer turn off the autobuild, but I'm not sure so a test map might be useful.
06-27-2006, 07:06 AM#5
nevir
The icons are there, they're just showing the disbtn varation of them, and don't respond to mouse clicks. I'm working on a quick test map at the moment, I'll upload in a few mins
06-27-2006, 07:23 AM#6
nevir
Ok, here's my test case:

Building a unit with the autobuild ability not in autocast mode only builds that unit - and does not add a new unit to the queue when finished - as expected

Likewise, turning the autobuild swirly on, and then training a unit works as expected - when that unit is done training, it automatically queues another unit of that type up.

The trouble comes in when you cancel all units currently in the queue:

If you cancel *before* the trigger issues a train order, both my custom abilities are usable - however, if you cancel after the trigger autobuilds a unit, both my custom abilities are now disabled :'(


Thanks for helping, by the way - I appreciate it
Attached Files
File type: w3xAutobuild.w3x (17.1 KB)
06-27-2006, 07:36 AM#7
Naakaloh
Ahh, I see, that appears to be an issue with Warcraft. The solution is to simply add a short wait before training.

Trigger:
Autobuild Unit
Collapse Events
Unit - A unit Finishes training a unit
Collapse Conditions
(Custom value of (Triggering unit)) Equal to 1
Collapse Actions
Wait 0.10 seconds
Unit - Order (Triggering unit) to train/upgrade to a (Unit-type of (Trained unit))

Next time, just edit your previous post to include the map instead of creating a new post.
06-27-2006, 09:58 AM#8
nevir
Perfect, that's exactly what I'm looking for. Many thanks!

It seems to work just fine with a wait of 0.01 as well