Unit turns into building?

Hi, i havea worker that has race Human, because I want him to be outisde teh buildings when building and be able to stop building or re-start, building.
But I also want him to be able to turn into a specific building, sacrifising itself. But how?

the night elf workers do that with buildings classified as ancient.
But there is no way to change the race of the worker with trigger, right?

What are the alternatives?
 
Level 1
Joined
May 3, 2020
Messages
2
So the building works like the peon does but ends as the building that was being built?


Make a skill that turns him into a building.
Maybe use the skill Root as the base but without the Uproot skill so it cannot go back to a worker.

-Make a Crow Form ability
-Change the Alternate Form Unit into what building you desire
-Change the Morphing Flags to Permanent and Requires Payment
-Change the Normal Form Unit into your worker
-And add the skill into your worker

It turns into the building without the building process so one thing to do is change the Casting Time although the worker needs an animation for that so it is complicated. And after built, the building's model
shows in Building animation (Depending on the model if it has a Building animation). So if you want to do that, you'll just have to make your own model for it.

If it's too complicated for you then you might just have to wait for another member with loads of World Editor knowledge to answer your problem.

This post is complicated
I'm complicated
 
Last edited:
Level 26
Joined
Aug 10, 2018
Messages
2,971
Not sure if there is an easy way of doing this.

Do you want it to work exactly how Night Elf buildings work? For instance can your worker cancel the Structure and do other stuff? Or do you want it to be sacrificed permanently?

Also, how many Workers do you have? Is it like 1 builder (tower defense style) or many possible workers?
 
Level 26
Joined
Aug 10, 2018
Messages
2,971
An idea:
When you order the builder to construct something, if the order is for a Night Elf structure, make the worker cast a hidden Morph ability that changes it to a Night Elf version of itself.

If the unit is ordered to build a non-Night Elf structure then morph it back to it's original form.

Edit:
Couldn't get it to work. Morphing the Peasant into a Wisp didn't change the building functionality, it still tried to build like a Peasant.

So instead of using Morph I tried to Replace the workers. This actually works, however there's a crash that happens if you alternate between ordering the worker to build a farm/moon well in rapid succession.
  • Moon Well
    • Events
      • Unit - A unit Is issued an order targeting a point
    • Conditions
      • (Unit-type of (Ordered unit)) Equal to Peasant
      • (Issued order) Equal to (Order(moonwell))
    • Actions
      • Set VariableSet TempPoint = (Target point of issued order)
      • Unit - Replace (Ordered unit) with a Peasant (Night Elf Form) using The old unit's relative life and mana
      • Selection - Add (Last replaced unit) to selection for (Triggering Player)
      • Unit - Order (Last replaced unit) to build a Moon Well at TempPoint
      • Custom script: call RemoveLocation (udg_TempPoint)
  • Farm
    • Events
      • Unit - A unit Is issued an order targeting a point
    • Conditions
      • (Unit-type of (Ordered unit)) Equal to Peasant (Night Elf Form)
      • (Issued order) Equal to (Order(farm))
    • Actions
      • Set VariableSet TempPoint = (Target point of issued order)
      • Unit - Replace (Ordered unit) with a Peasant using The old unit's relative life and mana
      • Selection - Add (Last replaced unit) to selection for (Triggering Player)
      • Unit - Order (Last replaced unit) to build a Farm at TempPoint
      • Custom script: call RemoveLocation (udg_TempPoint)
There shouldn't be any infinite loops here so it shouldn't be crashing... Unless i'm mistaken.
 
Last edited:
Level 26
Joined
Aug 10, 2018
Messages
2,971
what I meant is:
the regular peasant have HUman build ability.
the morfed peasant have Wisp build and can build ancients.
both same model file just different builds.

why wouldnt that work? weird!
Idk why, maybe you can get it to work. I literally moprhed the peasant into a wisp and tried to create a moon well and the wisp acted like a peasant. On top of that it couldnt even build the structure. Very odd.
 
Level 16
Joined
May 2, 2011
Messages
1,306
Idk why, maybe you can get it to work. I literally moprhed the peasant into a wisp and tried to create a moon well and the wisp acted like a peasant. On top of that it couldnt even build the structure. Very odd.
hmmmm
I remember having similar bug in my map. in previous version of my map, when blood mage enter the map, all his peasants are turned into elf workers with chaos ability (similar to troll and steam tank ability, and orcs too)

the old peasants which became workers cannot build all elf buildings, while newly built workers are just fine.
The old peasants can only build common buildings iirc.

could this have any connection to the problem?

iirc this could be solved this by triggering replacement for all peasants to workers.

this bug was annoying for naga worker slaves when they turned from from wisps
 
Last edited:
Top