Unit_Train_Button_Click

This bundle is marked as pending. It has not been reviewed by a staff member yet.
  • Like
Reactions: SebioL
Unit Train Button Click (UTBC)

What it's for:

The new train button events are useful because they fire even if you can't afford the unit's gold, lumber, or food cost. Regular train orders do not do this. However, the events cannot catch what unit type was ordered to be trained. This system handles that for you. It can also report whether the train order was successful and can tell whether the player had insufficient gold, lumber, or food.

How to import:
Just copy and paste the contents of the UnitTrainButtonClick folder into your map (you can copy the entire folder at once).

How to use:
In the configuration trigger (UTBC Config), register all the unit types whose train button click you want to be able to catch. This might be a lot of units but unfortunately I currently don't know how it can be done automatically.

In your triggers using this system:
Events: New train button events.
Conditions: Cannot use the UTBC_ variables!
Actions: (Wait 0.00 seconds) must come before using the UTBC_ variables!

Also check out the demo for example usage.

  • Events
    • Player - Button for train Footman pressed. (Footman must be in config trigger!)
  • Conditions
  • Actions
    • Wait 0.00 seconds
    • (Now you can use UTBC_ variables)
    • UTBC_TrainButtonUnitType - Unit type the button issues a train order for
    • UTBC_TrainButtonPlayer - Owner of the barracks
    • UTBC_InsufficientGold - true if player cannot afford the unit's gold cost
    • UTBC_InsufficientLumber - same as above but for lumber
    • UTBC_InsufficientFood - same as above but for food
    • UTBC_OrderSuccessful - true if the unit is now being trained
    • (Triggering unit) - the barracks

Contents

Unit_Train_Button_Click (Map)

MyPad

Spell Reviewer
Level 21
Joined
May 9, 2014
Messages
1,649
Aside from notifying players about the moment the button was clicked, I'm not sure what other use cases
are possible with this system. Could you give an additional example on this?

The (wait 0.00 seconds) action can be bypassed/disregarded entirely if a real event is used. That way, it
is guaranteed at the instant the event runs that the variables associated with the system are sanitized and
ready to use.
 
Top