Hero Random Spawn Variable HELP!!

JuiceBox

New Member
Reaction score
13
Trigger:
  • Variables
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set Heroes[1] = Archmage
      • Set Heroes[2] = Blademaster
      • Set Heroes[3] = Blood Mage
      • Set Heroes[4] = Crypt Lord
      • Set Heroes[5] = Death Knight
      • Set Heroes[6] = Demon Hunter
      • Set Heroes[7] = Dreadlord
      • Set Heroes[8] = Far Seer
      • Set Heroes[9] = Keeper of the Grove
      • Set Heroes[10] = Lich
      • Set Heroes[11] = Mountain King
      • Set Heroes[12] = Paladin
      • Set Heroes[13] = Priestess of the Moon
      • Set Heroes[14] = Shadow Hunter
      • Set Heroes[15] = Tauren Chieftain
      • Set Heroes[16] = Warden


Trigger:
  • Spawn Heroes
    • Events
      • Time - Elapsed game time is 15.00 seconds
    • Conditions
    • Actions
      • Unit Group - Pick every unit in PeasantGroup and do (Actions)
        • Loop - Actions
          • Set HeroesInteger = (Random integer number between 1 and 16)
          • Unit - Replace (Picked unit) with a Heroes[HeroesInteger] using The new unit's default life and mana
          • Special Effect - Create a special effect at (Position of (Picked unit)) using Abilities\Spells\Items\AIda\AIdaCaster.mdl
          • Set HeroesPlayer = (Owner of (Last replaced unit))


When the peasants were triggered to be replaced with a random hero, some peasant were replaced but some just vanished. What did I do wrong?! :banghead:

Will give reps for help!! :(
 

OMGedDude

New Member
Reaction score
5
I doubt theres something wrong with the Replace function but just in case try this:
Trigger:
  • Spawn Heroes
    • Events
      • Time - Elapsed game time is 15.00 seconds
    • Conditions
    • Actions
      • Unit Group - Pick every unit in PeasantGroup and do (Actions)
        • Loop - Actions
          • Set TempPoint = Position of (Picked Unit)
          • Unit - Remove (Picked Unit) from the game
          • Unit - Create 1 Heroes[Random number Between 1 and 16] at TempPoint facing (Default Building Facing) degrees
          • Special Effect - Create a special effect at TempPoint using Abilities\Spells\Items\AIda\AIdaCaster.mdl
          • Set HeroesPlayer = (Owner of (Last created unit))
          • Custom Script - call RemoveLocation( udg_TempPoint )


Its basically Replace split into 2 and there were some leaks in your script that I fixed
Make sure that all the peasants are being added to the PeasantGroup and none are being left out
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top