| 03-17-2004, 12:29 PM | #1 |
Can you think of any reason why this shouldn't work? Never mind why I don't want to use a standard repair ability. In theory, it takes mr. peasant, runs him up to a construction site, and finishes construction. What happens at present is that the construction and health bar both fill up, the peasant slacks off (as planned,) but the building in question does not complete construction- no abilities or stats appear in the UI, etc. Can you help? function peasantBuild takes integer ID, integer buildID returns nothing local unit peasant = maj_Characters[ID] local unit build = maj_Characters[buildID] local real buildLife = GetUnitState(build, UNIT_STATE_LIFE) local real buildMaxLife = GetUnitState(build, UNIT_STATE_MAX_LIFE) local integer buildProgress call DisplayTimedTextToForce( GetPlayersAll(), 10, "peasant building." ) loop if ((peasant == null) or (build == null)) then return endif if inRange(peasant, build, maj_PEASANT_RANGE) then call QueueUnitAnimation(peasant, "stand work") set buildLife = buildLife + maj_PEASANT_REPAIR if (buildLife >= buildMaxLife) then call SetUnitAnimation(peasant, "stand") call SetUnitState(build, UNIT_STATE_LIFE, buildMaxLife) call UnitSetConstructionProgress(build, 100) return endif set buildProgress = R2I((buildLife * 100) / buildMaxLife) call UnitSetConstructionProgress(build, buildProgress) call SetUnitState(build, UNIT_STATE_LIFE, buildLife) else call IssueTargetOrder(peasant, "move", build) endif call TriggerSleepAction(2) endloop endfunction Oh, inRange() is a little function that checks whether the distance between two units, excluding their collision radii (stored seperately,) is less than what's specified. |
| 03-17-2004, 01:57 PM | #2 |
Criminey, use [ code ] tags on your stuff. Otherwise it is unreadable. |
| 03-17-2004, 04:53 PM | #3 | |
Quote:
Actually, it doesn't matter anymore (it seems that construction simply won't register unless a base repair ability is used,) but how would you use [code] tags? Simple enclosure seems to make the text disappear. |
| 03-18-2004, 09:14 PM | #4 |
<code>Your text</code> with ['s instead of <'s renders the text box. Code:
This is text that is inside code tabs |
