Trying to make function blow
On the initial phase enemy XBow escorting their LG bombarding player’s wagonberge without Barring LG’s Line of Fire
Code: Select all
Tilex=GetUnitX(LG);
Tilex+=1;
Tiley=GetUnitY(LG);
If(IsUnitValid(XBow) == 1)
{
If(GetAttrib(LG,"moralestate") < 3)
{
if(GetAttrib(LG,"moved”) == 1)
{
SetUnitDestination(XBow,Tilex,Tiley);
//Moveunittowardsdestination(XBow);
SetAttrib(Xbow,"movelast",1);
}
Else
{
SetUnitDestination(Xbow,-1,-1); //At first I wrote SetAttrib(Xbow,"AP",0);
}
}
}
At first I set Xbow’s Ap to 0,if the Light gun unmoved,however the Xbow just stayed put all day long even if the LG moved forward.
I guess it’s becuz AI’s action of LG executed after Xbow,and Xbow’s AP has been cut to zero when it’s his term of action.But what’s “movelast”for? Not for the selected id act after all the other units of the side have been used?
So I altered this sentence with SetUnitDestination to(-1,-1),but not tested yet.
Before commented out moveunittowardsdestination(),the AI Xbow always act before his turn,I do wrote if(side == 1) before this segment,it seems by this sentence the XBow got an extra turn?

