Units can't build/construct?

Status
Not open for further replies.

Ghangis24

G

Ghangis24

I want to make a hero that can build stuff on top of using abilities etc,. but I cannot get him to construct anything once it's been placed on the map ready for construction. It just stays at low health. I've even tried using a peasant template but that didn't work either.

How do I get my units to build?
 
I just tested it and you need to give your hero the 'Repair' ability. I dunno why but it seems this is needed to make your hero build the building and not just placing it. Please try it and then tell me if you got it to work.
 
Or via triggering..
Create a dummy worker assuming that his rawcode is 'h000' .
Create a trigger for that event like:
  • Events
    • Unit - A unit Begins construction
  • Conditions
    • ((Triggering Unit) is a Hero) equal to true
  • Actions
    • Custom script: local location tmp_loc = GetUnitLoc(GetTriggerUnit())
    • Custom script: local unit bldg = GetConstructingStructure()
    • Custom script: local unit bldr = CreateNUnitsAtLoc( 1, 'h000', UnitOwner(GetTriggerUnit()), tmp_loc, bj_UNIT_FACING )
    • Custom script: call IssueTargetOrder( bldr, "repair", bldg )
    • Custom script: call RemoveLocation(tmp_loc)
    • Custom script: set bldg = null
    • Custom script: set bldr = null
and to remove the bldr after completing the structure.
  • Events
    • Unit - A unit Finishes construction.
  • Conditions
    • (Unit type of (Triggering Unit)) equal to DUMMYWORKER
  • Actions
    • Custom script: call KillUnit(GetTriggerUnit())
 
Status
Not open for further replies.
Back
Top