Jump to content

runcommand move


Arzok

Recommended Posts

I want to move 5 trucks to make a convoy

The player has to protect this convoy.

I use

runcommand ( unit , 404 , move , array , "Array01" )

for the first truck.

Array is made of rectangles.

I have try with points, but when a truck is destroyed at the point, it blocks all others trucks.

But with rectangle, 50% of the trucks stops without reason in a rectangle (not the first, not always the same)

I think rectangle are wide enough

Have you some idea ?

Link to comment
Share on other sites

Thank you for the answear.

I tried for an other map with points and tanks (and attack)

It worked fine, except the fact that when a tank is destroyed just at a point, the others will stay blocked just before.

So I tried this time with rectangle, but with truck and move.

And sometimes, the truck stops (with no apparent reason, like trees...), and return "defend" order instead of move.

I use a delay of 30 seconds between trucks.

Link to comment
Share on other sites

  • 4 years later...

Yes, sometimes, with array, vehicules stop with no reason. So runcommand move must be used with point, but the point is comming from an array

In fact, the best wat is to re-use an already existing trigger by 1C, like move_tank.

For exemple, I adapt this one for the mission UC_Sud_04

///////////

PARAM IN @unit

PARAM IN @path

PARAM IN @army

SET @Check_Point = 0

SEt @element_of_array = 0

SetWorkArmy ( Army , @army )

SET @Array_len = ArrayLen ( @path )

label begin

Delay ( 108 )

Set @point_ofpath = ArrayGetElementName ( @path , @element_of_array )

SET @unit_live = GetNUnits ( UNIT , @unit , spg , "OK_ENGINE" , "NOT_EMPTY" , "OK_WEAPON" )

If ( @unit_live = 0 ) Then

firemode ( UNIT , @unit , free )

halt

EndIF

If ( @element_of_array < @Array_len ) Then

RunCommand ( Unit , @unit , STORM , point , @point_ofpath )

Else

set @element_of_array = 0

runcommand ( unit , @unit , defend )

halt

ENDIF

label wait

delay 20000

SET @unit_live = GetNUnits ( UNIT , @unit , spg , "OK_WEAPON" , "OK_ENGINE" , "NOT_EMPTY" )

If ( @unit_live = 0 ) Then

firemode ( UNIT , @unit , free )

halt

EndIF

RunCommand ( Unit , @unit , STORM , point , @point_ofpath )

Set @Dist = Distance ( Unit , @unit , point , @point_ofpath )

If ( @Dist < 15 ) Then

ADD ( @element_of_array , 1 )

goto begin

Else

goto wait

ENDIF

Halt

///////////

In this trigger, the IA checks regularly the distance between the point and the vehicule. When the distance is lower than 15 meters, the IA uses the next point.

you have to adapt it, replace spg by car, and storm by move.

You have to launch this trigger for each vehicule with :

delay 10000

Set @army = 3

Set @unit = 481

RunTriggerInstance ( "move_spg" , @unit , @unit , @path , @army )

delay 10000

Set @army = 3

Set @unit = 482

RunTriggerInstance ( "move_spg" , @unit , @unit , @path , @army )

and so on for each truck.

Link to comment
Share on other sites

×
×
  • Create New...