HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Repair, rebuild etc

12-04-2002, 10:08 PM#1
Guest
Finaly I've managed to make the AI script work thx to those who helped me here (very appreciated :ggani: ) but I still have some more questions.

First, how do make the AI repair damaged buildings and rebuild these that are destroyed without using triggers?

Secondly, can you make AI skipp an action if it's impossible to preform, ie building a unit for a strikeforce when the units factory is destroyd.

Third, in the example above the AI will just stop doing anything, but if the building is rebuild, will the AI continue like nothing's happened? emote_confused
12-04-2002, 10:34 PM#2
AIAndy
First: Repairing is automatically done when SetPeonRepair(true) is used. It is set automatically in StandardAI, in CampaignAI it is only set on hard difficulty. But you can set it from your script parts as well.
Rebuilding is harder. Best you put all the building of buildings in a seperate thread (using call StartThread(function func_name) ). Then put all that building (not StartThread) in a loop. That way he will rebuild what is destroyed. You also need to put building orders for the already existing buildings in that loop if you want them rebuilt.

Second: You will have to do that manually by putting an if then around the order.
e.g.: if GetUnitCountDone(NECROPOLIS_1) >= 1 then
SetBuildUnit(1, ACOLYTE)
endif

Third: It should, but I have not tried.
12-04-2002, 10:48 PM#3
Guest
wow that's fast thx