Jump to content

Mud & engine breakdown


Stimo

Recommended Posts

Two new scripts, to add a little more thrill in your missions.

First one, [Mud], is about vehicle entering mud, forest or other areas where the might get immobilized, or even break a track.

When you create your mission, you have to set some values :

- how many vehicles moving in the area could be stuck at the same time

- how many chance those vehicles have to be immobilized

- how long won't they be able to move

- how many chances do they have to break a track

Please note that in this version, humans also can have their boots trapped in mud.

It works by simply assign a "PositionMode : Hold" every second, for a random period of time at stuck vehicles, so the player can't make them move.

Here it is :

-------------------------------------------------------------

SetWorkArmy ( Army , 1 )

Label Is_someone_in_the_mud

Set @N = GetNunitsInArea ( Army , 1 , All , "Rect_Mud" , OK_Engine , Not_Empty )

If ( @N = 0 ) Then

Delay ( 2000 )

Goto Is_someone_in_the_mud

Endif

//5 units max can be stuck.

Set @N = RND ( )

Div ( @N , 20 )

CreateGroupByRect ( Group , "Immobilized" , Army , 1 , All , @N , Rect , "Rect_Mud" )

//Dice decides if vehicles are stuck

Set @RND = RND ( )

If ( @RND < 50 ) then

Delay ( 1000 )

Goto Is_someone_in_the_mud

Endif

//Vehicles are stuck for 0 < T < 100 seconds

Set @T = RND ( )

//Bad luck

If @T > 95 Then

Goto Track_Broke

Endif

Set @i = 0

Label Stuck

PositionMode ( Group , "Immobilized" , Hold )

SendMessage ( "Unit stuck in the mud !" , 3000 )

If ( @i < @T ) then

Delay ( 1000 )

Add ( @i , 1 )

Goto Stuck

Endif

PositionMode ( Group , "Immobilized" , Free )

SendMessage ( "The unit stuck in the mud made it out !" , 3000 )

Delay ( 20000 )

Goto Is_someone_in_the_mud

Halt

Label Track_Broke

DestroyObject ( Group , "Immobilized" , Tracks )

Goto Is_someone_in_the_mud

-------------------------------------------------------------

Second script, [breakdown], checks from time to time, randomly, if a particular vehicle's engine does have a failure.

If so, the vehicle may simply be immobilized, or can burn and even explode.

This can be used with B1bis or other temperamental vehicles :

-------------------------------------------------------------

SetWorkArmy ( Army , 1 )

Label Test

//Dice decides when motor will be tested for breakdown

Set @RND = RND ( )

If ( @RND < 10 Then

Delay ( 10000 )

Else

If ( @RND < 20 Then

Delay ( 20000 )

Else

If ( @RND < 30 Then

Delay ( 30000 )

Else

If ( @RND < 40 Then

Delay ( 40000 )

Else

If ( @RND < 50 Then

Delay ( 50000 )

Else

If ( @RND < 60 Then

Delay ( 60000 )

Else

If ( @RND < 70 Then

Delay ( 70000 )

Else

If ( @RND < 80 Then

Delay ( 80000 )

Else

If ( @RND < 90 Then

Delay ( 90000 )

Else

Delay ( 100000 )

Endif

Endif

Endif

Endif

Endif

Endif

Endif

Endif

Endif

//Dice decides if motor has a failure

Set @RND = RND ( )

If ( @RND < 33 ) then

DestroyObject ( Unit , 7 , Engine )

SendMessage ( "Motor failure ! Bailing out !" , 15000 )

RunCommand ( Unit , 7 , Out_Crew , Crew )

DestroyTrigger ( "Breakdown" )

Else

Delay ( 60000 )

Endif

Goto Test

Halt

-------------------------------------------------------------

Link to comment
Share on other sites

awesome scripts, this will add realism to the game!

a scenario idea with it: the Panthers at Kurks

wiki:"The Panther first saw action at Kursk on July 5, 1943. Early tanks were plagued with mechanical problems: the track and suspension often broke, and the engine was dangerously prone to overheating and bursting into flames. At Kursk, more Panthers were disabled by their own failings than by enemy action. For example, the XLVIII Panzer Corps reported on July 10, 1943, that they had 38 Panthers operational and 131 awaiting repair, out of about 200 they had started with on July 5"

Link to comment
Share on other sites

×
×
  • Create New...