How to order a global retreat?

Started by AlsoKnownAs, April 11, 2010, 02:09:12 PM

Previous topic - Next topic

AlsoKnownAs

Hi everyone, hope you guys can help me out in this  :D .

I realize that my entire army does not retreat when I use the function;

QuoteAISetAttackState(player, e_attackState_Retreat);

Instead, only those that are in the attackWave retreats whereas the others who are coming to reinforce (called from the function AIWaveMerge(player, c_waveMain, c_waveAttack);) does not retreat and fought till they die if they are left behind or simply during the time when they are coming to merge with the attackWave.

Is there a way to call for a global retreat which applies to the merging wave and attack wave? Thanks in advance  ;D .

SuXue

maybe you can try running this for all waves w
AIWaveSetType(w, c_waveStateRetreat, AIWaveTargetGatherO(player, c_townMain))

AlsoKnownAs

Quote
 AIWaveSetType(w, c_waveStateRetreat, AIWaveTargetGatherO(player, c_townMain))

I've tried the above with no avail  :D , it seems like when a unit/unitgroup its planning to merge with a specific wave, it is somewhat designated a wave with specific integer/index attached to it (example: 14#0, 15#0, 16#0, 7#0 and etc...), completely random @_@. I'm not certain of this, but when you try to merge the main wave with the attack wave, the units that are on their journey will be displaced from its original main wave and placed in some temporary wave or something  ??? .

I can solve the problem by manually attaching these units to the wave, but that is not my objective. So, any help would very much be appreciated XD. Thanks SuXue, for helping  :D .

Kernel64

This: AIWaveTargetGatherD(..) could be your problem. Use this target only if you wish the AI to leave units behind from the wave you're controlling.

A retreat with this as target will cause the AI to leave a portion of its force behind.