• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Cancelled Unit Event Response?

Status
Not open for further replies.
Level 24
Joined
Aug 1, 2013
Messages
4,657
A unit starts training a unit.
-> Save the unit somewhere (hashtable for example)
A unit finishes training a unit.
-> Remove that unit from the hashtable.
A unit cancels training a unit.
-> The unit that would be trained (the unit from the hashtable) is the one you want.
 
Level 24
Joined
Aug 1, 2013
Messages
4,657
wait a sec. there is a reference from cancels.

The point is that it is not a unit. The unit is not created so it has no id.
The thing you want is a unit-type.
Make a new action "create unit" and go to the unit type. There you can see the event response "Trained Unit-Type"
(I bet that you dont want to create the unit but just to show you where it is.)
 
Level 12
Joined
May 9, 2009
Messages
735
Okay I think I get it. I first used the event 'a unit is issued an order with no target' and then put in the condition that the given order is a unit type converted to a string. If yes, then I used a variable and set an integer to 1. In another trigger which starts with 'unit cancels training a unit' the condition is 'if integer is equal to 1'. Then the integer is set back to 0.
 
Level 12
Joined
May 9, 2009
Messages
735
UnitType convert to a string?

Also your idea sounds acceptable for only one or few units. May I ask what exactly you want to achieve with checking the canceling?

The canceling is done through a separate trigger that refers to the integer variable and resets it. 'unit cancels producing a unit', 'triggering unit is equal to (your building)', 'if integer equals 1 then revert effects of the starting of unit production'.

I cannot reference the 'cancelled unit' or the 'training unit' because no such event responses exist. Thus, I resort to using the production of a particular unit type as an order and set an integer to a particular value which is what I use to reference the cancelling unit (since cancelling a unit is not an order like producing a unit).
 
Level 24
Joined
Aug 1, 2013
Messages
4,657
cannot reference the 'cancelled unit' or the 'training unit' because no such event responses exist.

"Trained Unit-Type" not "Trained Unit"

When you order the barracks to recruit a unit.
That unit is not yet created, so it has no id, no location, no owner, no nothing.
You cannot kill nothing, give nothing an ability, set nothing's health or let nothing do an order.
That is why they respond to Unit-Type rather than Unit.

The barracks sets his training value to that unit type.
Unit-Type is the event response.
 
Level 12
Joined
May 9, 2009
Messages
735
"Trained Unit-Type" not "Trained Unit"

When you order the barracks to recruit a unit.
That unit is not yet created, so it has no id, no location, no owner, no nothing.
You cannot kill nothing, give nothing an ability, set nothing's health or let nothing do an order.
That is why they respond to Unit-Type rather than Unit.

The barracks sets his training value to that unit type.
Unit-Type is the event response.

I really don't understand what you mean. When I go the condition 'unit-type comparison' I can set a unit responding to an event e.g. triggering unit to be a certain unit type. Without an event response to the training of the unit I cannot make use of that comparison.

If you mean to say that using the comparison 'Unit type of (trained unit) equals to 'some unit'' actually works you are wrong. I just tried it now again to make sure and it does not work. It references the unit type of the trained unit, not the training unit, and responds to the event 'a unit finishes training' rather than 'a unit begins training'.
 
Level 24
Joined
Aug 1, 2013
Messages
4,657
'Unit type of (trained unit) equals to 'some unit'

You really don't understand the difference between Unit and Unit-Type do you?

"Trained Unit-Type" not "Trained Unit"
That is why they respond to Unit-Type rather than Unit.
Unit-Type is the event response.

  • Untitled Trigger 001
    • Events
      • Unit - A unit Cancels training a unit
    • Conditions
      • (Trained unit-type) Equal to Footman
    • Actions
      • -------- Do something --------
Not "Unit type of (Unit)" but "Event Response - Trained unit-type"
 
Status
Not open for further replies.
Top