HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Training cancellation.

03-23-2004, 08:48 PM#1
Alfryd
I've been wondering about the possibility of using unit recruitment as a dummy ability, and I was wondering what specific functions I would need to use to:
Cancel a unit's traning just as it begins.
Recognise its unit-type.
Disable the recruitment process.
03-23-2004, 08:54 PM#2
Shadow_Strike
instead of training the unit, make it purchaseable like a mercenary camp
03-24-2004, 08:47 AM#3
Alfryd
I don't actually want to create a unit. I just wanted to know if it's possible to cancel a unit's training. But never mind.
03-24-2004, 11:29 AM#4
AIAndy
You can order the building to cancel, which is about the same as a person pressing ESC. Cancel only has an order id, no order string. You should find that order id per search.
03-25-2004, 11:59 AM#5
Alfryd
Many thanks! But what do you mean by 'per search?' Should I rig up a simple trigger to print the OrderID on screen when I press cancel, or what?
Also, does pressing cancel count as a 'Unit issued order with no target' event?
03-25-2004, 07:59 PM#6
AIAndy
Yes, it does trigger Unit issued order with no target and that way I retrieved the order id in the first place (as well as any other order id I need). But in this case I just meant the search on this site. Searching for 'order cancel' or something similar should bring you the threads that contain that order id (as I wrote it several times in the past).
03-26-2004, 06:46 PM#7
Alfryd
After a little experimentation, I'm afraid unit-training orders simply won't be suitable as dummy abilities. Issuing an immediate cancel order is ignored by the unit- there has to be a slight wait interval after the train order, before it can be cancelled. During this interval, the unit-training UI always appears.
03-26-2004, 07:58 PM#8
AIAndy
That happens with many triggers, that they are fired right before the respective event is applied. You only have to wait 0 seconds to get at a point where you can issue the cancel order. To do that use a timer that expires after 0 seconds. The TimerStart function has a last parameter where you can pass a function that is executed after the timer expires.
03-26-2004, 08:34 PM#9
Alfryd
It's so beautiful! Though now I have to use globals to transfer information to the handler function... Still, a real lifesaver. If I set some globals right before the TimerStart, can I guarantee they won't be modified before it elapses?
03-27-2004, 02:28 AM#10
AIAndy
In my experience it runs instantly so the globals should not change in that time.
BTW, what do you need such dummy abilities for ? Since Channel is usually enough.
03-27-2004, 10:47 AM#11
Alfryd
Well, basically, I was looking for a way to set up multiple no-target dummy abilities on the same unit without having to hunt down different base abilities for each one. As far as I can tell, you can access the custom unit ID more or less directly, so there's no mixups.
Why, what's the advantage of Channel?
03-27-2004, 01:44 PM#12
AIAndy
Channel is the universal dummy ability. You can have more than one on a unit, you can set the type of targeting, you can edit a lot about the graphics, with a slight extension you can even set the type of the spell (magical, physical, ...). It has no game effect by itself so no problems there either.
03-27-2004, 08:59 PM#13
Alfryd
Quote:
Originally Posted by AIAndy
Channel is the universal dummy ability. You can have more than one on a unit, you can set the type of targeting, you can edit a lot about the graphics, with a slight extension you can even set the type of the spell (magical, physical, ...). It has no game effect by itself so no problems there either.

Oh, yes I see now. Most useful... you can even hide the UI... so I could use it for that gold-spawn ability... hmm. There isn't any way to set the targetting to something area-based, similar to blizzard or flamestrike, is there?
03-29-2004, 12:43 PM#14
Alfryd
Well, that's no problem- I an dummy those up conventionally. However, I am having some difficulty getting channel to display missile art using the unit-target setting. What exactly do I need to set to ensure that missile art will display properly?