• 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.

Copying Heroes

Status
Not open for further replies.
Level 7
Joined
Dec 30, 2007
Messages
60
I'm making a boss fight where the Heroes essentially fight bizzaro versions of themselves.

I need to "clone" a group of units; for every Hero (Each Hero has its own unit variable, and they are also in a unit group "Heroes"), I have to create a new unit with the same ability point allocations and same items. The World Editor doesn't have a "copy unit" function, sadly.

Also, I don't know JASS. I don't know how to code in it, or how to implement it.

How do I do this, if it's even possible?



Also, another question, just so I can ask and get it over with. What exactly is the "For Every Integer A from 1 to X" function for? o_o
 
Here's your trigger, took me a few seconds to figure out how to do the items, but I think it will work.
  • Copy Hero
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Hero Mirror
    • Actions
      • Set TempLocC = (Target point of ability being cast)
      • Unit Group - Pick every unit in (Units within 300.00 of TempLocC matching ((((Matching unit) is A Hero) Equal to True) and ((((Matching unit) belongs to an enemy of (Owner of (Casting unit))) Equal to True) and ((Matching unit) Not equal to (Casting unit))))) and do (Actions)
        • Loop - Actions
          • Set Hero = (Picked unit)
          • Set TempLocA = (Position of Hero)
          • Set TempLocB = (TempLocA offset by 150.00 towards ((Facing of Hero) - 180.00) degrees)
          • Unit - Create 1 (Unit-type of Hero) for Neutral Hostile at TempLocB facing ((Facing of Hero) - 180.00) degrees
          • Set TempUnitA = (Last created unit)
          • Hero - Set TempUnitA Hero-level to (Hero level of Hero), Hide level-up graphics
          • Hero - Modify Strength of TempUnitA: Set to (Strength of Hero (Exclude bonuses))
          • Hero - Modify Agility of TempUnitA: Set to (Agility of Hero (Exclude bonuses))
          • Hero - Modify Intelligence of TempUnitA: Set to (Intelligence of Hero (Exclude bonuses))
          • Set TempIntA = 0
          • For each (Integer A) from 1 to 6, do (Actions)
            • Loop - Actions
              • Set TempIntA = (TempIntA + 1)
              • Hero - Create (Item-type of (Item carried by Hero in slot TempIntA)) and give it to TempUnitA
          • Set TempIntA = 0
          • Unit - Order TempUnitA to Attack Hero
          • Unit - Add a 20.00 second Generic expiration timer to TempUnitA
          • Custom script: call RemoveLocation(udg_TempLocA)
          • Custom script: call RemoveLocation(udg_TempLocB)
          • Custom script: set udg_Hero = null
          • Custom script: set udg_TempUnitA = null
  • Custom script: call RemoveLocation(udg_TempLocC)
 
Status
Not open for further replies.
Top