• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

When a unit is trained spawns an additional unit to trained unit

Status
Not open for further replies.
Level 9
Joined
Apr 22, 2020
Messages
430
I just need a simple trigger here guys i have a custom upgrade here which enables a trained unit to have an addtional unit coming out of it as well when finished training. But my trigger doesn't seem to work so i need someone to make me a trigger for this.
 
Level 9
Joined
Apr 22, 2020
Messages
430
Please post what you have so far and we'll help you out.
Just to tell you i'm reallyyyyyyyyy horrible when it comes to making triggers

Events: (Generic Unit Event)
A unit Finishes training a unit

Conditions:
(Unit-type of (Trained unit)) equal to Footman

Actions:
Unit - Create 1 something for player you at (Position of (Trained unit)) facing Default building facing degrees

Thats what i got so far LOL!
 
Level 30
Joined
Feb 18, 2014
Messages
3,623
You mean like in Curse of the Forsaken campaign, when the Dark Ranger finishes training a spider will spawn next to her and follow her? Here's how to do it :
  • Additional Unit Spawn
    • Events
      • Unit - A unit Finishes training a unit
    • Conditions
      • (Unit-type of (Trained unit)) Equal to Footman
      • (Current research level of MyResearch for (Owner of (Triggering unit))) Greater than 0
    • Actions
      • Set Temp_Point = Position of (Trained unit)
      • Unit - Create 1 Rifleman for (Owner of (Triggering unit)) at Temp_Point facing Default building facing degrees
      • Unit - Order (Last created unit) to Follow (Trained unit)
      • Custom script : call RemoveLocation (udg_Temp_Point)
 
Last edited:
Level 20
Joined
Feb 23, 2014
Messages
1,265
@Warseeker I imagine the Temp_Point variable was meant to eliminate a point leak in the "create unit" action, but it's not used* (so it still leaks). Also, personally I'd use the building's rally point for issuing the move order for the unit - I think it will feel more natural, but that's just a matter of preference.

EDIT: *well, wasn't before you edited it :D

Regardless, @Dispatcher your original trigger looks fine and should spawn a unit, so... if it doesn't, are you sure that the trigger is turned on and you're training the correct unit? Because as I've said, the idea is fine and it should work.

As a side note, here's my version (fixed leak, using the rally point):

  • Extra Spawn Trigger
    • Events
      • Unit - A unit Finishes training a unit
    • Conditions
      • (Unit-type of (Trained unit)) Equal to <Your Unit Type>
      • <any extra conditions go here>
    • Actions
      • Set TempPoint = (Position of (Trained unit))
      • Unit - Create 1 <Spawned Unit Type> for (Owner of (Triggering Unit)) at TempPoint facing (Facing of (Trained unit)) degrees
      • Custom script: call RemoveLocation (udg_TempPoint)
      • Set TempPoint = (Rally-Point of (Triggering unit) as a point)
      • Unit - Order (Last created unit) to Move To TempPoint
      • Custom script: call RemoveLocation (udg_TempPoint)
 
Level 9
Joined
Apr 22, 2020
Messages
430
You mean like in Curse of the Forsaken campaign, when the Dark Ranger finishes training a spider will spawn next to her and follow her? Here's how to do it :
  • Research Complete
    • Events
      • Unit - A unit Finishes a research
    • Conditions
      • (Researched tech-type) Equal to My Research
    • Actions
      • Trigger - Turn on Additional Unit Spawn <gen>
  • Additional Unit Spawn
    • Events
      • Unit - A unit Finishes training a unit
    • Conditions
      • (Unit-type of (Trained unit)) Equal to Footman
    • Actions
      • Set Temp_Point = Position of (Trained unit)
      • Unit - Create 1 Rifleman for (Owner of (Triggering unit)) at Temp_Point facing Default building facing degrees
      • Unit - Order (Last created unit) to Follow (Trained unit)
      • Custom script : call RemoveLocation (udg_Temp_Point)
This is not MUI though, if you want it to be MUI add a boolean condition when x player finishes the research.
Thank you so much! Warseeker and MasterBlaster! Though can i request one more trigger, speaking of curse of the forsaken do you guys remember the Regenerative Flesh upgrade? Where all forsaken units can regenerate OUTSIDE of the blight i want to know how it is triggered because i'm gonna be using it for my undead map also i think if we change the trigger of it i think we can also use it for the night elves like the night elves can now regenerate both day and night.
 
Level 30
Joined
Feb 18, 2014
Messages
3,623
Thank you so much! Warseeker and MasterBlaster! Though can i request one more trigger, speaking of curse of the forsaken do you guys remember the Regenerative Flesh upgrade? Where all forsaken units can regenerate OUTSIDE of the blight i want to know how it is triggered because i'm gonna be using it for my undead map also i think if we change the trigger of it i think we can also use it for the night elves like the night elves can now regenerate both day and night.
It's not triggered, it's an ability based on Blight Aura.
 
Status
Not open for further replies.
Top