• 🏆 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!

Making a unit preview

Status
Not open for further replies.
Level 6
Joined
Feb 27, 2008
Messages
222
Well, i am trying to make a map where you have a building which you can set to automatically create units (so you don't have to bother doing it yourself). While this part is easy, i was looking for more eye candy.

I wanted to have a transparent unit above the building, representing the unit type that will be built next.

Now, i know how to do the transparency part, placing it above the building, and removing it when the unit is built.

What troubles me, is the part of creating the unit itself. I am trying to use the "Begins training a unit" event, but when i'm trying to access the unit type, i can't find a "Training unit", to access the unit that is being trained. There's just a "Trained unit", which refers to the unit after it's been trained. And that's not what i want.

Am i missing something, or do i need to make a different way for things to work?
 
Level 6
Joined
Feb 27, 2008
Messages
222
I know what you mean but i want the unit created before the actual unit has been trained. What you are suggesting will create the dummy unit after the actual unit is trained, which will be a bit late for you to see what you are actually going to train.
 
Level 6
Joined
Feb 27, 2008
Messages
222
Well it was a simple
A unit finishes training a unit

-Order [triggering unit] to train [Unit type of Trained unit]


But it just kept training the first unit you ordered it to train, so now i'm working on making a small gap in between so you can have multiple units that will be trained continuously (for example, you ordered a footman, a rifleman and a knight, and if you enable the feature, the building will continuously create a footman, a rifleman, a knight and then again footman, rifleman, knight etc...etc...)
 
Level 6
Joined
Feb 27, 2008
Messages
222
Ok, i did the training part ok, it is training as i wanted to


But the original problem still exists. I want a preview unit to appear above the building before the unit is actually created.

Have you played bomber command? The blizzard map that came around with a not-so-recent patch. There, you train planes and while they are being built, you can see a transparent preview of the plane that is going to be sent.

That's exactly what i want. Before the unit gets trained, a transparent preview is created above the building, making it easier for you to see what you are actually training.
 
Level 6
Joined
Feb 27, 2008
Messages
222
i checked the map and it's in JASS, so it's not very helpful...
Edit : Ok, here are the triggers

  • Events
    • Unit - A unit Finishes training a unit
  • Conditions
  • Actions
    • Set Loc[0] = (Position of (Triggering unit))
    • Set Trainingunit[(Player number of (Owner of (Triggering unit)))] = (Triggering unit)
    • Unit - Create 1 (Unit-type of (Trained unit)) for (Owner of (Trained unit)) at Loc[0] facing Default building facing degrees
    • Set Unit[(Player number of (Owner of (Trained unit)))] = (Last created unit)
    • Unit - Add Crow Form to Unit[(Player number of (Owner of (Trained unit)))]
    • Unit - Add Pause 0.05 to Unit[(Player number of (Owner of (Trained unit)))]
    • Unit - Turn collision for (Last created unit) Off
    • Animation - Change (Last created unit) flying height to 300.00 at 99999.00
    • Animation - Change Unit[(Player number of (Owner of (Trained unit)))]'s vertex coloring to (100.00%, 100.00%, 100.00%) with 50.00% transparency
    • Unit - Move Unit[(Player number of (Owner of (Trained unit)))] instantly to Loc[0], facing (Position of (Triggering unit))
    • Unit - Order (Last created unit) to Orc Tauren Chieftain - War Stomp <===== This is a 0.05s casting War Stomp, with no effect. It just makes a gap yo sou can train different types of units in autospawn.
This trigger creates the preview. I haven't finished yet, the units have to die when another unit is trained, and they have to be paused. But that's easy, so i will do it later, what matters is that i can't make the unit spawn before it's finished.

  • Events
    • Unit - A unit Starts the effect of an ability
  • Conditions
    • (Ability being cast) Equal to Autospawn
  • Actions
    • Unit - Remove (Ability being cast) from (Triggering unit)
    • Unit - Add Cancel Autospawn to (Triggering unit)
    • Trigger - Turn on Training <gen>
This turns on the auto spawning trigger.

  • Events
    • Unit - A unit Starts the effect of an ability
  • Conditions
    • (Ability being cast) Equal to Pause 0.05 <==== The 0.05 war stomp ability
  • Actions
    • Unit - Order Trainingunit[(Player number of (Owner of (Triggering unit)))] to train/upgrade to a (Unit-type of (Casting unit))
This is the trigger that issues the training order.



So far, these triggers work ok for me, but i still can't make the preview
 
Last edited:
Status
Not open for further replies.
Top