| 10-17-2002, 11:26 PM | #1 |
Guest | I'm trying to keeping a player from being able to create ANY non-structure units if some integer X meets some condition. Is there a way to cancel training from a trigger? I tried using: Event: A unit owned by P1 begins training a unit Action: Order Triggering unit to stop This didn't work, so I'm stuck with counting for X for each unit trained, then camparing X with my condition and, if it meets the condition, turning off the availability for all units. This is a pain, and isn't as fool-proof as I might like. Also, I don't want to change anything to do with the food cap (which I thought might work, but would give an annoying food-cap message, which is unrelated to my variable X). Essentially, is there a way to cancel unit training? |
| 10-17-2002, 11:41 PM | #2 |
force the player to press ESC its the cancel button |
| 10-18-2002, 12:41 AM | #3 |
Guest | that won't help if the player put many units in the queue. |
| 10-18-2002, 12:46 AM | #4 |
There's a trigger to enable/disable creation of units for certain player(s). Just run this for every unit you don't want the player to build. Should be one of the Player triggers. If not try Unit. |
| 10-18-2002, 01:38 AM | #5 |
Guest | Yeah, I can turn off the availability of each unit, but then a player can still queue 7 guys, even if he's only alotted one more, and the availability will change after the first guy over the limit, but the rest will finish building regardless. This is certainly not optimal :) |
| 10-18-2002, 03:09 AM | #6 |
Couldn't you just make the building not be able to train those units? This can be editted in WE, the "Trains" field of the Unit Editor. This would work unless you want to turn on/off the availability of the units |
| 10-18-2002, 03:40 AM | #7 |
Guest | Yes, I can keep a building from training units; the question is: How can I do it after the player has created (or queued) X other units? These aren't all detectable. What I have done instead is keep a count of units in training and a count of trained units. Then, when a building begins training a unit that would put units in training + trained units > X, I destroy and recreate the building (for my purposes, I can't use 'replace'). This is working, but it's no fun to implement. So, a somewhat new question comes of this: can we detect queued units? |
| 10-18-2002, 04:19 AM | #8 |
Eh, actually, forcing the cancel key will work. Each time you begin training, even if queueing, it'll be canceled. Try it :) If that doesn't work, just replace the building with one of the same type and HP and display an error message. To the player it'll just look like the order never went through. |
| 10-18-2002, 04:40 AM | #9 |
Guest | Yes, I essentially just replace the building after X people have been produced and it works... I was just looking for a better (less messy) way. |
| 10-18-2002, 04:49 AM | #10 |
Ah, I knew I misunderstood... good luck :D |
| 10-18-2002, 05:13 PM | #11 |
Since this problem is related to my own, I will go ahead and ask here... My problem: I'm working on a WC2 TC and I'm trying to stop the player from queueing any units (WC2 oly allowed one unit to train at a time). Now, I've tried changine the training availablility of units, but that is a Player function, so it goes for all the buildings. Example... Town Halls build Peons... a trigger that fires when a town hall starts training a unit and then sets peons to be unavailable for training would make them untrainable for ALL Town Halls. Is there another way to work this so that only the unit who is currently training cannot train units? |
| 10-18-2002, 05:26 PM | #12 | |
Quote:
You know in the playstation version of warcraft 2 you could queue like 20 guys i think... I'd personally leave the queue in there. |
| 10-18-2002, 06:38 PM | #13 |
Well, I was thinking about leaving the queue in. It is a vast improvement... as are rally points. But I have just figured out how to simulate remove the queue... prepare yourself 8) Code:
Variables: Variable Name Variable Type Initial Value ------------- ------------- ------------- curtraining Unit Group - None - selectedunit Unit No unit Triggers: Stop Train Queue: -Events: -----Unit - A unit owned by Player 1 (Red) Begins training a unit -----... REPEAT FOR ALL PLAYERS -Conditions: -Actions: -----Player - Make Peasant Unavailable for training/construction for (Triggering player) -----... REPEAT FOR ALL UNITS -----Unit Group - Add (Triggering unit) to curtraining Select Building: -Events: -----Player - Player 1 (Red) Selects a unit -----... REPEAT FOR ALL PLAYERS -Conditions: -Actions: -----If (((Triggering unit) is in curtraining) Equal to True) then do Player - Make Peasant Unavailable for training/construction by (Triggering player)) else do (Player - Make Peasant Available for training/construction by (Triggering player)) -----...REPEAT FOR ALL UNITS -----Set selectedunit = (Triggering unit) Reset Train Queue: -Events: -----Unit - A unit owned by Player 1 (Red) Cancels training a unit -----... REPEAT FOR ALL PLAYERS -----Unit - A unit owned by Player 1 (Red) Finishes training a unit -----... REPEAT FOR ALL PLAYERS -Conditions: -Actions: -----If ((Triggering unit) Equal to selectedunit) then do (Player - Make Peasant Available for training/construction by (Triggering player)) else do (Do nothing) -----...REPEAT FOR ALL UNITS -----Unit Group - Remove (Triggering unit) from curtraining |
| 10-18-2002, 08:00 PM | #14 |
The only thing would be though that if you have multiple structures and you made training unavailable for all other units all units would be unavailable to build. Like, say, I train a peon at the Great Hall, then I can't make grunts at the barracks! |
| 10-18-2002, 11:15 PM | #15 |
No, because when you select a Barraks to build a Grunt, it reenables training/construction availability... which is the beauty at key of this trigger :ggani: :ggani: :ggani: |
