• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

[Trigger] Dragon Growth

Status
Not open for further replies.
Level 3
Joined
May 22, 2012
Messages
50
Okay, have this trigger here, that my building makes a Dragon Whelp, and then he 'grows' into a new, bigger, dragon...

The issue is, I can't figure out how to make THAT, NEW unit, 'grow' into ANOTHER new, bigger, dragon...


Here is my Trigger, the first part works, but the part after the 2nd wait 10 seconds, dosn't work:
  • Red Dragon Whelp
    • Events
  • Unit - A unit Finishes training a unit
    • Conditions
  • (Unit-type of (Trained unit)) Equal to Red Dragon Whelp
    • Actions
      • Wait 10.00 seconds
      • Unit - Replace (Trained unit) with a Red Dragon Youngling using The old unit's life and mana
      • Wait 10.00 seconds
      • Unit - Replace (Last replaced unit) with a Red Dragon Young Drake using The old unit's life and mana
To try it, just build about 1-3 buildings and have them all train the dragon whelps, you will see what I'm talking about..

This issue has been solved.
 
Last edited:
Level 11
Joined
Nov 15, 2007
Messages
781
  • Red Dragon Whelp
  • Events
    • Unit - A unit Finishes training a unit
  • Conditions
    • (Unit-type of (Trained unit)) Equal to Red Dragon Whelp
  • Actions
    • Custom script: local unit u = GetTrainedUnit()
    • Wait 10.00 seconds
    • Custom script: set udg_unit = u
    • Unit - Replace unit with a Red Dragon Youngling using The old unit's life and mana
    • Custom script: set u = GetLastReplacedUnitBJ()
    • Wait 10.00 seconds
    • Custom script: set udg_unit = u
    • Unit - Replace unit with a Red Dragon Youngling using The old unit's life and mana
    • Custom script: set u = null
udg_unit is a unit variable named "unit" - in custom script, GUI-specified global variables are differentiated from local variables with the udg_ prefix. Things like "Last replaced unit" won't work with waits because they'll be overwritten. Local variables only work within the instance of the trigger being run, so they won't be overwritten, but with the downside that they can't be referenced by other triggers.
 
Level 3
Joined
May 22, 2012
Messages
50
  • Red Dragon Whelp
  • Events
    • Unit - A unit Finishes training a unit
  • Conditions
    • (Unit-type of (Trained unit)) Equal to Red Dragon Whelp
  • Actions
    • Custom script: local unit u = GetTrainedUnit()
    • Wait 10.00 seconds
    • Custom script: set udg_unit = u
    • Unit - Replace unit with a Red Dragon Youngling using The old unit's life and mana
    • Custom script: set u = GetLastReplacedUnitBJ()
    • Wait 10.00 seconds
    • Custom script: set udg_unit = u
    • Unit - Replace unit with a Red Dragon Youngling using The old unit's life and mana
    • Custom script: set u = null
udg_unit is a unit variable named "unit" - in custom script, GUI-specified global variables are differentiated from local variables with the udg_ prefix. Things like "Last replaced unit" won't work with waits because they'll be overwritten. Local variables only work within the instance of the trigger being run, so they won't be overwritten, but with the downside that they can't be referenced by other triggers.
So what I'm trying to do will work, but I can't use another trigger to change the unit? (What I want)

Edit: I added what you typed, and the udg_unit = u disabled my Trigger... (I'm sorry, but I'm not good with custom triggers) So I don't know if you typed it wrong, or if I put it in wrong... Edit2: I just relized, that yours says " Unit - Replace 'unit' with a Red Dragon Youngling using The old unit's life and mana" how do I make it say 'unit' ? Edit3: Do I just add in the Custom scripts, and change the Unit - Replace, or do I have to add a variable?
 
Last edited:
Status
Not open for further replies.
Top