Tried SwapUnitType(id,0); and CallUnitFunctionDirect(id,"ALL_DISMOUNT",id,GetUnitX(id),GetUnitY(id));
neither works.
Gentlemen,any idea?

Moderator: rbodleyscott
Why do you use "ALL_DISMOUNT" instead of "ALL_REMOUNT"?locustmustdie wrote: ↑Sun Dec 04, 2022 12:15 pm design for pursuit stage action:Mount the Dismounted MAA to pursue the enemy on the blink of collapse.
Tried SwapUnitType(id,0); and CallUnitFunctionDirect(id,"ALL_DISMOUNT",id,GetUnitX(id),GetUnitY(id));
neither works.
Gentlemen,any idea?![]()
Code: Select all
if (evade == 1)
{
if ((IsUnitSquadType(me, "Foot_Dragoons") == 1) && (IsMounted(enemy) == 1))
{
CallUnitFunctionDirect(me, "ALL_REMOUNT", me, GetUnitX(me), GetUnitY(me));
}
...
lol,I misspelledCronos09 wrote: ↑Sun Dec 04, 2022 1:23 pmWhy do you use "ALL_DISMOUNT" instead of "ALL_REMOUNT"?locustmustdie wrote: ↑Sun Dec 04, 2022 12:15 pm design for pursuit stage action:Mount the Dismounted MAA to pursue the enemy on the blink of collapse.
Tried SwapUnitType(id,0); and CallUnitFunctionDirect(id,"ALL_DISMOUNT",id,GetUnitX(id),GetUnitY(id));
neither works.
Gentlemen,any idea?![]()
I tried to use something like that in FoG2 before:and it worked fine there.Code: Select all
if (evade == 1) { if ((IsUnitSquadType(me, "Foot_Dragoons") == 1) && (IsMounted(enemy) == 1)) { CallUnitFunctionDirect(me, "ALL_REMOUNT", me, GetUnitX(me), GetUnitY(me)); } ...
Code: Select all
for (i = 0; i < GetUnitCount(0); i++) //MAAs Remount to Pursue the defeated
{
id = GetUnitID(0,i);
if (id != -1)
{
if ((IsUnitValid(id) == 1) && (GetAttrib(id, "MoraleState") < 2))
{
if (StringCompare(GetWorkString(), "DIS_FOOT_MAA") == 1)
{
CallUnitFunctionDirect(id,"ALL_REMOUNT",id,GetUnitX(id),GetUnitY(id));
}
}
}
}
Sorry, I forgot to point out that you must fill FUNCTION CHECK_ALL_REMOUNT(me, tilex, tiley) for it. You can take the function body from FUNCTION DEPLOYCHECK_ALL_REMOUNT(me, tilex, tiley) without if (gForceSelection[GetUnitSide(me)] == 0).locustmustdie wrote: ↑Sun Dec 04, 2022 1:52 pm ...but,can it work for side0? I want Dis_Foot_MAA on my side to remount
I swich the side for remount,still doesn't work,some thing wrong
mineCode: Select all
for (i = 0; i < GetUnitCount(0); i++) //MAAs Remount to Pursue the defeated { id = GetUnitID(0,i); if (id != -1) { if ((IsUnitValid(id) == 1) && (GetAttrib(id, "MoraleState") < 2)) { if (StringCompare(GetWorkString(), "DIS_FOOT_MAA") == 1) { CallUnitFunctionDirect(id,"ALL_REMOUNT",id,GetUnitX(id),GetUnitY(id)); } } } }
I see,just like stakes,check_all first,then deployCronos09 wrote: ↑Sun Dec 04, 2022 6:13 pm Sorry, I forgot to point out that you must fill FUNCTION CHECK_ALL_REMOUNT(me, tilex, tiley) for it. You can take the function body from FUNCTION DEPLOYCHECK_ALL_REMOUNT(me, tilex, tiley) without if (gForceSelection[GetUnitSide(me)] == 0).
But it will be better, if you write FUNCTION ALL_REMOUNT1(me, tilex, tiley) in your Scenario.BSF and will use ALL_REMOUNT1 operator in your scripts.
Code: Select all
if (StringCompare(GetWorkString(), "DIS_FOOT_MAA") == 1)
Code: Select all
if(IsMounted(id) == 0)
{
GetAttribString(GetUnitTypeIndex(id), 0); //to swap if has a mounted version
if (StringCompare(GetWorkString(), "") == 0)
I can't explain the reason, because working with strings in scripts is not clear to me. It is the best option to use the current script constructions.locustmustdie wrote: ↑Mon Dec 05, 2022 7:28 am @cronos09
I got the bug now,it's cuz ofCode: Select all
if (StringCompare(GetWorkString(), "DIS_FOOT_MAA") == 1)
Can't figure out why,as the "DIS_FOOT_MAA"was copy&pasted from Scenario.BAM.
I fix that by alter it withworks fine now.Code: Select all
if(IsMounted(id) == 0) { GetAttribString(GetUnitTypeIndex(id), 0); //to swap if has a mounted version if (StringCompare(GetWorkString(), "") == 0)
Still confused about the reason.