What is SetRoute exactly for?
Posted: Sat Dec 17, 2022 12:45 am
I'm writing my own AutomaticMove,same trouble annoyed me when friendly units block the path,so I looking for solution in Loja_C.bsf.There's a SetRoute segment in it.
In this case,it was for retreat. It will work fine for attack as well,isn't it?
And in the end there's a AddVizWaitOnMove(id),what's that for?
likewise AddVizFunctionCall("CallUnitFunctionDirect", id, "UNIT_ASSAULT", id, enemy, 0);
Addviz means animationFunction?
Code: Select all
if (GetAttrib(id, "MoraleState") == 2)
{
if ((IsUnitSquadType(id, "Cavalry") == 1) && (GetUnitFacing(id) == 0))
{
// Fall back
if (CallUnitFunctionDirect(id, "CHECK_ALL_FALLBACK", id, GetUnitX(id), GetUnitY(id) - 1) >= 0)
{
CallUnitFunctionDirect(id, "ALL_FALLBACK", id, GetUnitX(id), GetUnitY(id) - 1);
}
}
else
{
// Retreat
x = GetUnitX(id);
limit = GetUnitY(id) - 3;
for (y = GetUnitY(id) - 1; y > limit; y--)
{
if (IsTileBlocked(id, x, y) == 0)
{
AddVizFunctionCall("SetRoute",id, x, y, 0);
}
else
{
y = limit;
}
}
}
}
And in the end there's a AddVizWaitOnMove(id),what's that for?
Code: Select all
if (GetTurn() > 2)
{
SetCannotControl(id, 0);
}
}
AddVizWaitOnMove(id);
Addviz means animationFunction?