On your problem:
What is the snippet you posted supposed to do?
Regardless of the purpose, there is a little error with the identifier for the plan you are setting up. Correcly, it should look like this:
//Create gather plan for Unit1.
int hunterGatherPlanID=aiPlanCreate("Unit1Hunt", cPlanHuntAggressive);
{
aiPlanSetDesiredPriority(hunterGatherPlanID, 12);
aiPlanSetBaseID(hunterGatherPlanID, kbBaseGetMainID(cMyID));
aiPlanAddUnitType(hunterGatherPlanID, cUnitTypeUlfsark, 1, 1, 1);
aiPlanSetVariableInt(hunterGatherPlanID, cGatherPlanPlanType, 0, cHuntAggressive);
aiPlanSetActive(hunterGatherPlanID);
}But before you get on the wrong track: Even with this correction, the script doesn't make much sense.
Here is a rough translation of the above snippet:
- Set up a hunting plan to hunt aggressive animals (wolves, lions, you know what I mean)
- Set prio and base.
- Add one Ulfsark to the plan. Now we have a plan with one ulfsark assigned to it. If the ai finds an available ulfsark, he would try to hunt aggressive animals. That doesn't make much sense, since an ulf can't carry resources.
- I am not aware of constants called "cGatherPlanPlanType" and "cHuntAggressive". I am not sure what this line is supposed to do. But it almost certainly won't compile.
- Activate the plan.
If you tell me what you wanted to do with this script, maybe I can help you.
About the ai training and using new units: I don't have the merest idea of modding, so I don't know how you could add the new unit to the ai database. All I can tell you, that there must be a long list identifying each and every unit type. The ai only uses these identifiers (like for example cUnitTypeUlfsark in the script above). If you know how to add an identifier to this list like "cUnitTypeMyArcher=1234", you are almost done. The rest is changing a few lines in the ai scripts.
[This message has been edited by kalus (edited 10-28-2004 @ 09:08 AM).]