- UID
- 284290
- 阅读权限
- 20
- 注册时间
- 2017-1-6
- 最后登录
- 2017-12-13
- 在线时间
- 22 小时
- 性别
- 保密
骑士
- 耕战
- 0
- 鹰币
- 10
- 天龙币
- 0
- 回帖
- 12
|
发表于 2017-1-10 20:01:04
|
显示全部楼层
感恩 mozonglin 大师,
经您指点,第二个,关于AI围墙损毁问题已经解决,
AI围墙升级,我想把它加入到Utt AI上,只想求大师给一段 AI能在堡垒时代或工业时代,AI升级围墙的完整代码
以下是参考了百度贴吧,“凉悲澄”大师,所写
rule wallUpgradeMonitor
inactive
minInterval 30
{
if ((kbResourceGet(cResourceWood) < 400) && (kbResourceGet(cResourceGold) < 600))
xsDisableSelf(); // 凉悲澄”大师忽略了这句,进入总是报错,error 0003 aiLoaderStandard.xs 加入后虽不报错,但依然没能实现
return;
if (kbTechGetStatus(cTechBastion) == cTechStatusActive)
{
xsDisableSelf();
return;
}
int WallConnector = getUnit(cUnitTypeWallConnector, cMyID, cUnitStateAlive);
if (WallConnector >= 0)
{
createSimpleResearchPlan(cTechBastion, WallConnector, cEconomyEscrowID,80);
xsDisableSelf();
}
}
工业时代升级 rule age4Monitor 加入
//Enable fort upgrade
xsEnableRule("wallUpgradeMonitor");
但依然没能实现AI升级围墙的代码
----------------------------------
引用您修改的,“雷光AI” 怕耽误你时间所以摘录出
rule insertEye
inactive
group tcComplete
mininterval 30
{
if(cMyCiv == cCivXPSioux)
{
xsDisableSelf();
return;
}
if(xsGetTime() < 900000) // AI围墙升级时间是 18~20 分钟是在这里修改吗?
{
return;
}
vector mainBaseVec = kbBaseGetLocation(cMyID, kbBaseGetMainID(cMyID));
vector centerOffset = kbGetMapCenter() - mainBaseVec;
vector targetLocation = cInvalidVector;
int treeQuery = getUnitByLocation(cUnitTypeTree, cPlayerRelationAny, cUnitStateABQ, centerOffset, 300.0);
targetLocation = kbUnitGetPosition(treeQuery);
int tcQuery = getUnitByLocation(cUnitTypeTownCenter, cPlayerRelationAny, cUnitStateABQ, targetLocation, 60.0);
int wcQuery = getUnitCountByLocation(cUnitTypeWallConnector, cPlayerRelationSelf, cUnitStateABQ, targetLocation, 30.0);
if((tcQuery >= 0) || (wcQuery > 1))
return;
int wcPlan=aiPlanCreate("wall connector plan", cPlanBuild);
aiPlanSetVariableInt(wcPlan, cBuildPlanBuildingTypeID, 0, cUnitTypeWallConnector);
aiPlanSetVariableVector(wcPlan, cBuildPlanCenterPosition, 0, targetLocation);
aiPlanSetVariableFloat(wcPlan, cBuildPlanCenterPositionDistance, 0, 15.0);
aiPlanSetDesiredPriority(wcPlan, 99);
aiPlanSetMilitary(wcPlan, false);
aiPlanSetEconomy(wcPlan, true);
aiPlanSetEscrowID(wcPlan, cEconomyEscrowID);
aiPlanAddUnitType(wcPlan, gEconUnit, 1, 1, 1);
aiPlanSetVariableVector(wcPlan, cBuildPlanInfluencePosition, 0, targetLocation);
aiPlanSetVariableFloat(wcPlan, cBuildPlanInfluencePositionDistance, 0, 100.0);
aiPlanSetVariableFloat(wcPlan, cBuildPlanInfluencePositionValue, 0, 200.0);
aiPlanSetVariableInt(wcPlan, cBuildPlanInfluencePositionFalloff, 0, cBPIFalloffLinear);
aiPlanSetActive(wcPlan);
}
只想求大师给一段 AI能在堡垒时代或工业时代,AI升级围墙的代码,把它加入到您制作的Utt AI上,对于我来说觉得帝国就完美了! |
|