Jump to content

battle generator / trigger _Army_Retreate


Arzok

Recommended Posts

Triggers in the battle generator are very interesting.

I have one question about the trigger _Army_Retreate

the test is

IF ( @alive_units < @army_rate AND @power < @enemy_power ) THEN

GOTO ARMY_RETREATE

ENDIF

I think it should be

IF ( @alive_units < @army_rate AND @power > @enemy_power ) THEN

GOTO ARMY_RETREATE

ENDIF

Am I right ?

Link to comment
Share on other sites

  • 3 months later...

Hi Arzok,

I think you may be mistaken mate, to me the original looks correct, have a look at this code:-

LABEL BEGIN

CreateGroupObject ( GROUP , @group_check , ARMY , @enemy_army , ALL , 100 , VISIBLE , NOT_EMPTY )

SetWorkArmy ( ARMY , @enemy_army )

SET @enemy_power = GetPower ( GROUP , @group_check )

SetWorkArmy ( ARMY , @army )

SET @alive_units = GetNUnits ( ARMY , @army , HUMAN , CREW )

CreateGroupObject ( GROUP , @group_check , ARMY , @army , ALL , 100 , NOT_EMPTY )

SET @power = GetPower ( GROUP , @group_check )

MUL ( @alive_units , 100 )

DIV ( @alive_units , @all_units )

IF ( @alive_units < @army_rate AND @power < @enemy_power ) THEN

GOTO ARMY_RETREATE

ENDIF

Delay ( 10000 )

GOTO BEGIN

LABEL ARMY_RETREATE

CreateGroupObject ( GROUP , @group_artillery , ARMY , @army , ARTILLERY , 100 )

CreateGroupObject ( GROUP , @group_hmg , ARMY , @army , HMG , 100 )

CreateGroupObject ( GROUP , @group_vehicle , ARMY , @army , ALL , 100 , BROKEN_ENGINE )

RunCommand ( GROUP , @group_artillery , OUT_CREW , ALL )

RunCommand ( GROUP , @group_hmg , OUT_CREW , ALL )

RunCommand ( GROUP , @group_vehicle , OUT_CREW , ALL )

Delay ( 15000 )

BodyMode ( ARMY , @army , FREE )

RunCommand ( ARMY , @army , STORM , RECT , @rect )

CreateGroupByRect ( GROUP , @group_destroy , ARMY , @army , ALL , 100 , RECT , @rect )

ReinforcementDestroy ( GROUP , @group_destroy )

SET @num = GetNUnits ( ARMY , @army , HUMAN , CREW )

IF ( @num = 0 ) THEN

HALT

ENDIF

GOTO ARMY_RETREATE

Looks to me as if @power is current value for @Army whereas @enemy_power is the inital power calculated at mission start which is a generic requirement because this is repeatable code that can deal with multiple sceanrios based on the initial parameters set by the battle generator.

Link to comment
Share on other sites

You are right.

enemy_power is the power of the enemy of the IA, ie the player.

so it works like this.

It is this trigger that ca be used to simulate the fact that the IA will not fight to the last man.

Link to comment
Share on other sites

×
×
  • Create New...