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

Modifying Limited Libraries

Level 25
Joined
Jun 5, 2008
Messages
2,573
Modifying Faulty Libraries

Oh well while helping HELL_YA with a issue on Replace Unit i stumbled upon a strange thing.

1.Replace Unit Ex library

Well you see, you can't replace units with the replace unit function if their type is the same.

Example:
You can't replace a zealot for a zealot, etc...

The solution is rather easy.

Go to the libraries, find the Built-In folder.

Find the Unit subgroup and open the Basic folder.

Now find the Replace Unit function and copy it.

Declare a new library, we will call it Replace Unit Ex.

Remove the line:
  • (Unit type of Unit) == Unit-Type
And use the Replace Unit Ex function from now on.
Is should show right below the Replace Unit native.

Works like a charm.
Hope it helps.
Will add more as i deem needed.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,285
Usless tutorial. There is no productive situation where a person will replace a unit with itself since it is itself already. If do get into such a situation through unsafe code, a conditional statmenet to catch it is all that is needed. If you were trying to do it to emulate WC3's replace unit function which removed and created a new unit, then simply set unit kills to 0 and life back to maximum.
 
Top